@uh-design-system/component-library 0.5.2 → 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 (243) 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 +109 -49
  8. package/dist/cjs/ds-checkbox.cjs.entry.js +88 -79
  9. package/dist/cjs/ds-icon.cjs.entry.js +943 -0
  10. package/dist/cjs/ds-input-validity.cjs.entry.js +14 -15
  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 +153 -0
  14. package/dist/cjs/ds-radio-button.cjs.entry.js +151 -0
  15. package/dist/cjs/ds-spinner.cjs.entry.js +62 -0
  16. package/dist/cjs/ds-text-input.cjs.entry.js +90 -77
  17. package/dist/cjs/ds-visually-hidden.cjs.entry.js +3 -6
  18. package/dist/cjs/index-Bp6Dd2i1.js +94 -0
  19. package/dist/cjs/{store-9bd20f3c.js → index-DwLFyR5p.js} +6 -2
  20. package/dist/cjs/{index-bf84b124.js → index-Mjp9Y-Sw.js} +701 -55
  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 +78 -3
  27. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +18 -17
  28. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +91 -50
  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 +124 -145
  33. package/dist/collection/components/01-base-components/ds-button/ds-button.js +150 -65
  34. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +121 -23
  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 -72
  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 +46 -46
  43. package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +120 -111
  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 +2 -3
  47. package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +214 -63
  48. package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.js +215 -50
  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.css +2 -2
  53. package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +60 -30
  54. package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.features.stories.js +4 -4
  55. package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.js +4 -9
  56. package/dist/collection/components/01-base-components/ds-link/ds-link.css +24 -14
  57. package/dist/collection/components/01-base-components/ds-link/ds-link.js +74 -75
  58. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.examples.stories.js +27 -27
  59. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.features.stories.js +38 -21
  60. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +8 -67
  61. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +10 -12
  62. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +30 -52
  63. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.examples.stories.js +4 -4
  64. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.features.stories.js +6 -6
  65. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.stories.js +4 -28
  66. package/dist/collection/components/01-base-components/ds-radio-button/ds-radio-button.css +115 -0
  67. package/dist/collection/components/01-base-components/ds-radio-button/ds-radio-button.js +449 -0
  68. package/dist/collection/components/01-base-components/ds-radio-button/stories/ds-radio-button.features.stories.js +72 -0
  69. package/dist/collection/components/01-base-components/ds-radio-button/stories/ds-radio-button.stories.js +22 -0
  70. package/dist/collection/components/01-base-components/ds-radio-button-group/ds-radio-button-group.css +30 -0
  71. package/dist/collection/components/01-base-components/ds-radio-button-group/ds-radio-button-group.js +360 -0
  72. package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.examples.stories.js +42 -0
  73. package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.features.stories.js +71 -0
  74. package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.stories.js +60 -0
  75. package/dist/collection/components/01-base-components/ds-spinner/ds-spinner.css +279 -0
  76. package/dist/collection/components/01-base-components/ds-spinner/ds-spinner.js +221 -0
  77. package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.examples.stories.js +120 -0
  78. package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.features.stories.js +107 -0
  79. package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.stories.js +14 -0
  80. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +85 -118
  81. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +230 -155
  82. package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.js +26 -21
  83. package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.features.stories.js +40 -40
  84. package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.stories.js +30 -56
  85. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
  86. package/dist/collection/store.js +7 -1
  87. package/dist/collection/utils/attributes/attributes.js +2 -2
  88. package/dist/collection/utils/button/buttonUtils.js +14 -0
  89. package/dist/collection/utils/colours/colourTypes.js +3 -3
  90. package/dist/collection/utils/colours/colourUtils.js +5 -3
  91. package/dist/collection/utils/controls/controlUtils.js +35 -1
  92. package/dist/collection/utils/link/linkUtils.js +3 -2
  93. package/dist/collection/utils/spinner/spinnerUtils.js +20 -0
  94. package/dist/collection/utils/tests/testUtils.js +1 -0
  95. package/dist/collection/utils/typography/typographyUtils.js +3 -3
  96. package/dist/collection/utils/utils.js +10 -9
  97. package/dist/component-library/{utils-cfc536bc.js → attributes-BD_lNRxn.js} +1 -1
  98. package/dist/component-library/component-library.css +1 -1
  99. package/dist/component-library/component-library.esm.js +1 -1
  100. package/dist/component-library/controlUtils-CNER0MvM.js +1 -0
  101. package/dist/component-library/ds-accordion.entry.js +1 -0
  102. package/dist/component-library/ds-button.entry.js +1 -0
  103. package/dist/component-library/ds-card.entry.js +1 -0
  104. package/dist/component-library/ds-checkbox-group.entry.js +1 -1
  105. package/dist/component-library/ds-checkbox.entry.js +1 -1
  106. package/dist/component-library/ds-icon.entry.js +1 -0
  107. package/dist/component-library/ds-input-validity.entry.js +1 -1
  108. package/dist/component-library/ds-link-with-arrow.entry.js +1 -1
  109. package/dist/component-library/ds-link.entry.js +1 -1
  110. package/dist/component-library/ds-radio-button-group.entry.js +1 -0
  111. package/dist/component-library/ds-radio-button.entry.js +1 -0
  112. package/dist/component-library/ds-spinner.entry.js +1 -0
  113. package/dist/component-library/ds-text-input.entry.js +1 -1
  114. package/dist/component-library/ds-visually-hidden.entry.js +1 -1
  115. package/dist/component-library/index-BfTCfPZ1.js +6 -0
  116. package/dist/component-library/index-Cm7V4EAn.js +2 -0
  117. package/dist/component-library/index-DuYjhvTn.js +1 -0
  118. package/dist/component-library/index.esm.js +1 -1
  119. package/dist/component-library/linkUtils-02nCfO0F.js +1 -0
  120. package/dist/component-library/utils-CqaqnfY4.js +1 -0
  121. package/dist/components/attributes.js +3 -3
  122. package/dist/components/controlUtils.js +35 -2
  123. package/dist/components/ds-accordion.js +58 -42
  124. package/dist/components/ds-button2.js +78 -39
  125. package/dist/components/ds-card.d.ts +11 -0
  126. package/dist/components/ds-card.js +91 -0
  127. package/dist/components/ds-checkbox-group.js +116 -56
  128. package/dist/components/ds-checkbox2.js +93 -80
  129. package/dist/components/ds-icon2.js +292 -292
  130. package/dist/components/ds-input-validity2.js +17 -14
  131. package/dist/components/ds-link-with-arrow.js +22 -22
  132. package/dist/components/ds-link.js +43 -40
  133. package/dist/components/ds-radio-button-group.d.ts +11 -0
  134. package/dist/components/ds-radio-button-group.js +185 -0
  135. package/dist/components/ds-radio-button.d.ts +11 -0
  136. package/dist/components/ds-radio-button.js +198 -0
  137. package/dist/components/ds-spinner.d.ts +11 -0
  138. package/dist/components/ds-spinner.js +6 -0
  139. package/dist/components/ds-spinner2.js +89 -0
  140. package/dist/components/ds-text-input.js +126 -104
  141. package/dist/components/ds-visually-hidden2.js +2 -3
  142. package/dist/components/index.js +208 -2
  143. package/dist/components/index2.js +713 -39
  144. package/dist/components/index3.js +69 -57
  145. package/dist/components/linkUtils.js +4 -2
  146. package/dist/docs.d.ts +443 -0
  147. package/dist/docs.json +4790 -0
  148. package/dist/esm/{utils-cfc536bc.js → attributes-BD_lNRxn.js} +3 -26
  149. package/dist/esm/component-library.js +6 -5
  150. package/dist/esm/controlUtils-CNER0MvM.js +37 -0
  151. package/dist/esm/ds-accordion.entry.js +77 -0
  152. package/dist/esm/ds-button.entry.js +105 -0
  153. package/dist/esm/ds-card.entry.js +56 -0
  154. package/dist/esm/ds-checkbox-group.entry.js +108 -46
  155. package/dist/esm/ds-checkbox.entry.js +78 -67
  156. package/dist/esm/ds-icon.entry.js +941 -0
  157. package/dist/esm/ds-input-validity.entry.js +14 -13
  158. package/dist/esm/ds-link-with-arrow.entry.js +21 -18
  159. package/dist/esm/ds-link.entry.js +34 -29
  160. package/dist/esm/ds-radio-button-group.entry.js +151 -0
  161. package/dist/esm/ds-radio-button.entry.js +149 -0
  162. package/dist/esm/ds-spinner.entry.js +60 -0
  163. package/dist/esm/ds-text-input.entry.js +88 -73
  164. package/dist/esm/ds-visually-hidden.entry.js +3 -4
  165. package/dist/esm/index-BfTCfPZ1.js +92 -0
  166. package/dist/esm/{index-434995e1.js → index-Cm7V4EAn.js} +699 -34
  167. package/dist/{components/store.js → esm/index-DuYjhvTn.js} +6 -3
  168. package/dist/esm/index.js +2 -2
  169. package/dist/esm/{linkUtils-3d1b28cf.js → linkUtils-02nCfO0F.js} +4 -2
  170. package/dist/esm/loader.js +4 -4
  171. package/dist/esm/utils-CqaqnfY4.js +25 -0
  172. package/dist/hydrate/index.d.ts +271 -0
  173. package/dist/hydrate/index.js +22280 -0
  174. package/dist/hydrate/index.mjs +22272 -0
  175. package/dist/hydrate/package.json +12 -0
  176. package/dist/styles/helpers.css +15 -0
  177. package/dist/styles/helpers.css.map +1 -0
  178. package/dist/styles/mixins/_breakpoints.scss +13 -0
  179. package/dist/styles/mixins/_focus.scss +26 -0
  180. package/dist/styles/mixins/_wrapper.scss +5 -0
  181. package/dist/styles/mixins/imports-default/_imports.scss +2 -0
  182. package/dist/styles/mixins/tokens/_breakpoints.scss +13 -0
  183. package/dist/styles/mixins/tokens/_semantic-colours.scss +75 -0
  184. package/dist/styles/mixins.scss +12 -0
  185. package/dist/styles/variables.css +176 -0
  186. package/dist/styles/variables.css.map +1 -0
  187. package/dist/types/components/01-base-components/ds-accordion/ds-accordion.d.ts +11 -8
  188. package/dist/types/components/01-base-components/ds-button/ds-button.d.ts +16 -11
  189. package/dist/types/components/01-base-components/ds-button/stories/ds-button.examples.stories.d.ts +1 -0
  190. package/dist/types/components/01-base-components/ds-button/stories/ds-button.features.stories.d.ts +1 -0
  191. package/dist/types/components/01-base-components/ds-card/ds-card.d.ts +20 -0
  192. package/dist/types/components/01-base-components/ds-card/stories/ds-card.examples.stories.d.ts +8 -0
  193. package/dist/types/components/01-base-components/ds-card/stories/ds-card.features.stories.d.ts +8 -0
  194. package/dist/types/components/01-base-components/ds-card/stories/ds-card.stories.d.ts +7 -0
  195. package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +21 -22
  196. package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +21 -11
  197. package/dist/types/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.d.ts +3 -0
  198. package/dist/types/components/01-base-components/ds-icon/ds-icon.d.ts +7 -5
  199. package/dist/types/components/01-base-components/ds-input-validity/ds-input-validity.d.ts +5 -6
  200. package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +13 -14
  201. package/dist/types/components/01-base-components/ds-link/stories/ds-link.features.stories.d.ts +2 -0
  202. package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +5 -7
  203. package/dist/types/components/01-base-components/ds-radio-button/ds-radio-button.d.ts +44 -0
  204. package/dist/types/components/01-base-components/ds-radio-button/stories/ds-radio-button.features.stories.d.ts +15 -0
  205. package/dist/types/components/01-base-components/ds-radio-button/stories/ds-radio-button.stories.d.ts +7 -0
  206. package/dist/types/components/01-base-components/ds-radio-button-group/ds-radio-button-group.d.ts +34 -0
  207. package/dist/types/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.examples.stories.d.ts +6 -0
  208. package/dist/types/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.features.stories.d.ts +11 -0
  209. package/dist/types/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.stories.d.ts +7 -0
  210. package/dist/types/components/01-base-components/ds-spinner/ds-spinner.d.ts +17 -0
  211. package/dist/types/components/01-base-components/ds-spinner/stories/ds-spinner.examples.stories.d.ts +7 -0
  212. package/dist/types/components/01-base-components/ds-spinner/stories/ds-spinner.features.stories.d.ts +7 -0
  213. package/dist/types/components/01-base-components/ds-spinner/stories/ds-spinner.stories.d.ts +7 -0
  214. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +37 -32
  215. package/dist/types/components.d.ts +1287 -228
  216. package/dist/types/stencil-public-runtime.d.ts +22 -0
  217. package/dist/types/store.d.ts +6 -1
  218. package/dist/types/utils/attributes/attributes.d.ts +1 -1
  219. package/dist/types/utils/button/buttonUtils.d.ts +1 -0
  220. package/dist/types/utils/colours/colourTypes.d.ts +3 -3
  221. package/dist/types/utils/controls/controlUtils.d.ts +2 -0
  222. package/dist/types/utils/link/linkUtils.d.ts +1 -1
  223. package/dist/types/utils/spinner/spinnerUtils.d.ts +1 -0
  224. package/dist/types/utils/tests/testUtils.d.ts +1 -0
  225. package/dist/types/utils/utils.d.ts +2 -1
  226. package/package.json +40 -36
  227. package/dist/cjs/controlUtils-041de0fd.js +0 -7
  228. package/dist/cjs/ds-accordion_3.cjs.entry.js +0 -1095
  229. package/dist/cjs/index-5b0b9d4c.js +0 -82
  230. package/dist/component-library/controlUtils-9ca4087b.js +0 -1
  231. package/dist/component-library/ds-accordion_3.entry.js +0 -1
  232. package/dist/component-library/index-434995e1.js +0 -2
  233. package/dist/component-library/index-72ac5051.js +0 -6
  234. package/dist/component-library/linkUtils-3d1b28cf.js +0 -1
  235. package/dist/component-library/store-b8d17c10.js +0 -1
  236. package/dist/esm/controlUtils-9ca4087b.js +0 -4
  237. package/dist/esm/ds-accordion_3.entry.js +0 -1089
  238. package/dist/esm/index-72ac5051.js +0 -80
  239. package/dist/esm/store-b8d17c10.js +0 -204
  240. package/dist/loader/package.json +0 -11
  241. /package/dist/cjs/{app-globals-3a1e7e63.js → app-globals-V2Kpy_OQ.js} +0 -0
  242. /package/dist/component-library/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
  243. /package/dist/esm/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
@@ -1,89 +1,254 @@
1
1
  import { html } from "lit";
2
+ import { getShadowRoot } from "../../../../utils/tests/testUtils";
3
+ import { expect, userEvent, waitFor } from "@storybook/test";
2
4
  const meta = {
3
5
  title: 'Base Components/CheckboxGroup/Features',
4
6
  component: 'ds-checkbox-group',
5
- render: (args) => html `
7
+ render: args => html `
6
8
  <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>
9
+ ds-legend=${args.dsLegend}
10
+ ds-assistive-text=${args.dsAssistiveText}
11
+ ds-direction=${args.dsDirection}
12
+ ds-error-text=${args.dsErrorText}
13
+ ds-required=${args.dsRequired}
14
+ ds-all-required=${args.dsAllRequired}
15
+ ds-optional=${args.dsOptional}
16
+ ds-optional-text=${args.dsOptionalText}>
17
+ <ds-checkbox ds-text="Value text"></ds-checkbox>
18
+ <ds-checkbox ds-text="Value text"></ds-checkbox>
19
+ <ds-checkbox ds-text="Value text"></ds-checkbox>
15
20
  </ds-checkbox-group>
16
21
  `,
17
22
  };
18
23
  export default meta;
19
24
  export const Vertical = {
20
25
  args: {
21
- legend: 'Group legend',
22
- assistiveText: 'Assistive text',
23
- direction: 'vertical',
26
+ dsLegend: 'Group legend',
27
+ dsAssistiveText: 'Assistive text',
28
+ dsDirection: 'vertical',
29
+ dsRequired: false,
30
+ dsAllRequired: false,
31
+ dsOptional: false,
24
32
  },
25
33
  };
26
34
  export const VerticalInvalid = {
27
35
  args: {
28
- legend: 'Group legend',
29
- assistiveText: 'Assistive text',
30
- direction: 'vertical',
31
- errorText: 'Error text',
36
+ dsLegend: 'Group legend',
37
+ dsAssistiveText: 'Assistive text',
38
+ dsDirection: 'vertical',
39
+ dsErrorText: 'Error text',
40
+ dsRequired: false,
41
+ dsAllRequired: false,
42
+ dsOptional: false,
32
43
  },
33
44
  };
34
45
  export const Horizontal = {
35
46
  args: {
36
- legend: 'Group legend',
37
- assistiveText: 'Assistive text',
38
- direction: 'horizontal',
47
+ dsLegend: 'Group legend',
48
+ dsAssistiveText: 'Assistive text',
49
+ dsDirection: 'horizontal',
50
+ dsRequired: false,
51
+ dsAllRequired: false,
52
+ dsOptional: false,
39
53
  },
40
54
  };
41
55
  export const HorizontalInvalid = {
42
56
  args: {
43
- legend: 'Group legend',
44
- assistiveText: 'Assistive text',
45
- direction: 'horizontal',
46
- errorText: 'Error text',
57
+ dsLegend: 'Group legend',
58
+ dsAssistiveText: 'Assistive text',
59
+ dsDirection: 'horizontal',
60
+ dsErrorText: 'Error text',
61
+ dsRequired: false,
62
+ dsAllRequired: false,
63
+ dsOptional: false,
64
+ },
65
+ };
66
+ export const Required = {
67
+ args: {
68
+ dsLegend: 'Group legend',
69
+ dsAssistiveText: 'Assistive text',
70
+ dsDirection: 'horizontal',
71
+ dsRequired: true,
72
+ dsAllRequired: false,
73
+ },
74
+ play: async ({ canvasElement, step }) => {
75
+ const shadowRoot = await getShadowRoot(canvasElement, 'ds-checkbox-group');
76
+ const slottedCheckboxWebcs = canvasElement.querySelectorAll('ds-checkbox');
77
+ const slottedCheckboxInputs = [];
78
+ for (const webc of slottedCheckboxWebcs) {
79
+ slottedCheckboxInputs.push(webc.shadowRoot.querySelector('input'));
80
+ }
81
+ const inputValidity = shadowRoot.querySelector('ds-input-validity');
82
+ await waitFor(() => {
83
+ expect(inputValidity.querySelector('small')).not.toBeInTheDocument();
84
+ });
85
+ await step('Checking a child checkbox should not show any error message', async () => {
86
+ slottedCheckboxInputs[0].click();
87
+ await waitFor(() => {
88
+ expect(inputValidity.querySelector('small')).not.toBeInTheDocument();
89
+ });
90
+ });
91
+ await step('Unchecking a child checkbox should show an error message', async () => {
92
+ slottedCheckboxInputs[0].click();
93
+ await waitFor(() => {
94
+ expect(inputValidity.querySelector('small')).toBeInTheDocument();
95
+ expect(inputValidity.querySelector('small')).toHaveTextContent('Please select at least one option.');
96
+ });
97
+ });
98
+ },
99
+ };
100
+ export const AllRequired = {
101
+ args: {
102
+ dsLegend: 'Group legend',
103
+ dsAssistiveText: 'Assistive text',
104
+ dsDirection: 'horizontal',
105
+ dsRequired: false,
106
+ dsAllRequired: true,
107
+ },
108
+ play: async ({ canvasElement, step }) => {
109
+ const shadowRoot = await getShadowRoot(canvasElement, 'ds-checkbox-group');
110
+ const slottedCheckboxWebcs = canvasElement.querySelectorAll('ds-checkbox');
111
+ const slottedCheckboxInputs = [];
112
+ for (const webc of slottedCheckboxWebcs) {
113
+ slottedCheckboxInputs.push(webc.shadowRoot.querySelector('input'));
114
+ }
115
+ const inputValidity = shadowRoot.querySelector('ds-input-validity');
116
+ await waitFor(() => {
117
+ expect(inputValidity.querySelector('small')).not.toBeInTheDocument();
118
+ });
119
+ await step('Checking all child checkboxes should not show an error message', async () => {
120
+ for (const slottedCheckboxInput of slottedCheckboxInputs) {
121
+ slottedCheckboxInput.click();
122
+ }
123
+ await waitFor(() => {
124
+ expect(inputValidity.querySelector('small')).not.toBeInTheDocument();
125
+ });
126
+ });
127
+ await step('Unchecking all child checkboxes should show an error message', async () => {
128
+ for (const slottedCheckboxInput of slottedCheckboxInputs) {
129
+ slottedCheckboxInput.click();
130
+ }
131
+ await waitFor(() => {
132
+ expect(inputValidity.querySelector('small')).toBeInTheDocument();
133
+ expect(inputValidity.querySelector('small')).toHaveTextContent('Please select all options.');
134
+ });
135
+ });
136
+ },
137
+ };
138
+ export const Optional = {
139
+ args: {
140
+ dsLegend: 'Group legend',
141
+ dsAssistiveText: 'Assistive text',
142
+ dsDirection: 'horizontal',
143
+ dsRequired: false,
144
+ dsAllRequired: false,
145
+ dsOptional: true,
146
+ dsOptionalText: '(optional)',
47
147
  },
48
148
  };
49
149
  export const Nested = {
50
150
  args: {
51
- text: 'Parent checkbox',
52
- checked: false,
53
- disabled: false,
151
+ dsText: 'Parent checkbox',
152
+ dsChecked: false,
153
+ dsDisabled: false,
54
154
  },
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>
155
+ render: args => html `
156
+ <ds-checkbox-group ds-text=${args.dsText} ds-checked=${args.dsChecked} ds-disabled=${args.dsDisabled}>
157
+ <ds-checkbox ds-text="Child checkbox"></ds-checkbox>
158
+ <ds-checkbox ds-text="Child checkbox"></ds-checkbox>
159
+ <ds-checkbox ds-text="Child checkbox"></ds-checkbox>
64
160
  </ds-checkbox-group>
65
161
  `,
66
162
  };
67
163
  export const DeeplyNested = {
68
164
  render: () => html `
69
165
  <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"
166
+ ds-legend="Grandparent legend"
167
+ ds-assistive-text="Grandparent assistive text"
168
+ ds-error-text="Grandparent error text"
169
+ ds-text="Grandparent checkbox"
170
+ ds-checked="false"
171
+ ds-disabled="false"
76
172
  >
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>
173
+ <ds-checkbox ds-text="Parent checkbox"></ds-checkbox>
174
+ <ds-checkbox-group id="parent-checkbox-group" ds-text="Parent checkbox" ds-checked="HTMLDsCheckboxGroupElement" ds-disabled="false">
175
+ <ds-checkbox ds-text="Child checkbox"></ds-checkbox>
176
+ <ds-checkbox ds-text="Child checkbox"></ds-checkbox>
177
+ <ds-checkbox ds-text="Child checkbox"></ds-checkbox>
86
178
  </ds-checkbox-group>
87
179
  </ds-checkbox-group>
88
180
  `,
181
+ play: async ({ canvasElement, step }) => {
182
+ const grandParentShadowRoot = await getShadowRoot(canvasElement, 'ds-checkbox-group');
183
+ const grandParentCheckboxWebc = grandParentShadowRoot.querySelector('ds-checkbox');
184
+ const grandParentCheckboxInput = grandParentCheckboxWebc.shadowRoot.querySelector('input');
185
+ const parentShadowRoot = await getShadowRoot(canvasElement, 'ds-checkbox-group#parent-checkbox-group');
186
+ const parentCheckboxWebc = parentShadowRoot.querySelector('ds-checkbox');
187
+ const parentCheckboxInput = parentCheckboxWebc.shadowRoot.querySelector('input');
188
+ const slottedCheckboxWebcs = canvasElement.querySelectorAll('ds-checkbox');
189
+ const slottedCheckboxInputs = [];
190
+ for (const webc of slottedCheckboxWebcs) {
191
+ slottedCheckboxInputs.push(webc.shadowRoot.querySelector('input'));
192
+ }
193
+ await waitFor(() => {
194
+ expect(grandParentCheckboxInput.checked).toBe(false);
195
+ expect(parentCheckboxInput.checked).toBe(false);
196
+ });
197
+ await step('Clicking an unchecked grand parent checkbox should check all checkboxes', async () => {
198
+ await userEvent.click(grandParentCheckboxInput);
199
+ await waitFor(() => {
200
+ expect(grandParentCheckboxInput.checked).toBe(true);
201
+ expect(parentCheckboxInput.checked).toBe(true);
202
+ slottedCheckboxInputs.forEach(checkbox => {
203
+ expect(checkbox.checked).toBe(true);
204
+ });
205
+ });
206
+ });
207
+ await waitFor(() => {
208
+ expect(grandParentCheckboxInput.checked).toBe(true);
209
+ expect(parentCheckboxInput.checked).toBe(true);
210
+ });
211
+ await step('Clicking a checked grand parent checkbox should uncheck all checkboxes', async () => {
212
+ await userEvent.click(grandParentCheckboxInput);
213
+ await waitFor(() => {
214
+ expect(grandParentCheckboxInput.checked).toBe(false);
215
+ expect(parentCheckboxInput.checked).toBe(false);
216
+ slottedCheckboxInputs.forEach(checkbox => {
217
+ expect(checkbox.checked).toBe(false);
218
+ });
219
+ });
220
+ });
221
+ await waitFor(() => {
222
+ expect(grandParentCheckboxInput.checked).toBe(false);
223
+ expect(parentCheckboxInput.checked).toBe(false);
224
+ });
225
+ await step('Clicking all unchecked child checkboxes should check parent and grandparent checkbox', async () => {
226
+ for (const checkbox of slottedCheckboxInputs) {
227
+ await userEvent.click(checkbox);
228
+ await waitFor(() => {
229
+ expect(checkbox.checked).toBe(true);
230
+ });
231
+ }
232
+ await waitFor(() => {
233
+ expect(grandParentCheckboxInput.checked).toBe(true);
234
+ expect(parentCheckboxInput.checked).toBe(true);
235
+ });
236
+ });
237
+ await waitFor(() => {
238
+ expect(grandParentCheckboxInput.checked).toBe(true);
239
+ expect(parentCheckboxInput.checked).toBe(true);
240
+ });
241
+ await step('Clicking all checked child checkboxes should uncheck parent and grandparent checkbox', async () => {
242
+ for (const checkbox of slottedCheckboxInputs) {
243
+ await userEvent.click(checkbox);
244
+ await waitFor(() => {
245
+ expect(checkbox.checked).toBe(false);
246
+ });
247
+ }
248
+ await waitFor(() => {
249
+ expect(grandParentCheckboxInput.checked).toBe(false);
250
+ expect(parentCheckboxInput.checked).toBe(false);
251
+ });
252
+ });
253
+ },
89
254
  };
@@ -4,44 +4,46 @@ const meta = {
4
4
  component: 'ds-checkbox-group',
5
5
  render: (args) => html `
6
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}
7
+ ds-legend=${args.dsLegend}
8
+ ds-assistive-text=${args.dsAssistiveText}
9
+ ds-direction=${args.dsDirection}
10
+ ds-error-text=${args.dsErrorText}
11
+ ds-text=${args.dsText}
12
+ ds-checked=${args.dsChecked}
13
+ ds-disabled=${args.dsDisabled}
14
+ ds-required=${args.dsRequired}
15
+ ds-all-required=${args.dsAllRequired}
16
+ ds-optional=${args.dsOptional}
17
+ ds-optional-text=${args.dsOptionalText}
14
18
  >
15
- <ds-checkbox text="Value text"></ds-checkbox>
16
- <ds-checkbox text="Value text"></ds-checkbox>
17
- <ds-checkbox text="Value text"></ds-checkbox>
19
+ <ds-checkbox ds-text="Value text"></ds-checkbox>
20
+ <ds-checkbox ds-text="Value text"></ds-checkbox>
21
+ <ds-checkbox ds-text="Value text"></ds-checkbox>
18
22
  </ds-checkbox-group>
19
23
  `,
20
24
  };
21
25
  export default meta;
22
26
  export const Default = {
23
27
  args: {
24
- legend: 'Group legend',
25
- assistiveText: 'Assistive text',
28
+ dsLegend: 'Group legend',
29
+ dsAssistiveText: 'Assistive text',
30
+ dsDisabled: false,
31
+ dsRequired: false,
32
+ dsAllRequired: false,
33
+ dsOptional: false
26
34
  },
27
35
  };
28
36
  export const Playground = {
29
37
  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' },
38
+ dsLegend: 'Group legend',
39
+ dsAssistiveText: 'Assistive text',
40
+ dsDirection: 'vertical',
41
+ dsErrorText: '',
42
+ dsText: '',
43
+ dsChecked: false,
44
+ dsDisabled: false,
45
+ dsRequired: false,
46
+ dsAllRequired: false,
47
+ dsOptional: false
46
48
  },
47
49
  };
@@ -2,17 +2,17 @@ import { Fragment, h } from "@stencil/core";
2
2
  import { icons } from "../../../components/00-foundations/icons/iconList";
3
3
  import { remToPx } from "../../../utils/utils";
4
4
  export class DsIcon {
5
- name;
6
- colour;
7
- size = '1.5rem';
5
+ dsName;
6
+ dsColour;
7
+ dsSize = '1.5rem';
8
8
  dsTitle = 'Icon';
9
- role = 'img';
10
- hidden = true;
9
+ dsRole = 'img';
10
+ dsHidden = true;
11
11
  message = '';
12
12
  getIcon() {
13
- const selectedIcon = icons.find(icon => icon.name === this.name);
13
+ const selectedIcon = icons.find(icon => icon.name === this.dsName);
14
14
  if (!selectedIcon) {
15
- console.warn(`Icon with name "${this.name}" not found.`);
15
+ console.warn(`Icon with name "${this.dsName}" not found.`);
16
16
  return '';
17
17
  }
18
18
  const svgElement = this.parseSvg(selectedIcon.component);
@@ -27,13 +27,13 @@ export class DsIcon {
27
27
  return svgDoc.querySelector('svg');
28
28
  }
29
29
  getIconColour() {
30
- const colour = this.colour ? `var(--${this.colour})` : 'currentColor';
30
+ const colour = this.dsColour ? `var(--${this.dsColour})` : 'currentColor';
31
31
  return colour;
32
32
  }
33
33
  setIconAttributes(svgElement) {
34
- const size = this.size || '1.5rem';
34
+ const size = this.dsSize || '1.5rem';
35
35
  const colour = this.getIconColour() || 'currentColor';
36
- const role = this.role || 'img';
36
+ const role = this.dsRole || 'img';
37
37
  const title = this.dsTitle || '';
38
38
  svgElement.setAttribute('width', remToPx(size));
39
39
  svgElement.setAttribute('height', remToPx(size));
@@ -48,7 +48,7 @@ export class DsIcon {
48
48
  }
49
49
  }
50
50
  render() {
51
- return (h(Fragment, { key: '58309a22dafbad09a1f9e884657aad264261174e' }, h("span", { key: '3295d61af901e74ea7c39d1e7a4b7e083f44794f', class: "ds-icon--container", innerHTML: this.getIcon(), "aria-hidden": this.hidden ? 'true' : 'false' })));
51
+ return (h(Fragment, { key: '4d9d8d8b048557f295902bd35c628faa85c604d8' }, h("span", { key: '3737f3c81cdeaf17592b8c8fc321e25a126eedb6', class: "ds-icon--container", innerHTML: this.getIcon(), "aria-hidden": this.dsHidden ? 'true' : 'false' })));
52
52
  }
53
53
  static get is() { return "ds-icon"; }
54
54
  static get encapsulation() { return "shadow"; }
@@ -64,8 +64,9 @@ export class DsIcon {
64
64
  }
65
65
  static get properties() {
66
66
  return {
67
- "name": {
67
+ "dsName": {
68
68
  "type": "string",
69
+ "attribute": "ds-name",
69
70
  "mutable": false,
70
71
  "complexType": {
71
72
  "original": "string",
@@ -76,15 +77,15 @@ export class DsIcon {
76
77
  "optional": false,
77
78
  "docs": {
78
79
  "tags": [],
79
- "text": ""
80
+ "text": "Name of the icon to display"
80
81
  },
81
82
  "getter": false,
82
83
  "setter": false,
83
- "attribute": "name",
84
84
  "reflect": false
85
85
  },
86
- "colour": {
86
+ "dsColour": {
87
87
  "type": "string",
88
+ "attribute": "ds-colour",
88
89
  "mutable": false,
89
90
  "complexType": {
90
91
  "original": "string",
@@ -95,35 +96,40 @@ export class DsIcon {
95
96
  "optional": false,
96
97
  "docs": {
97
98
  "tags": [],
98
- "text": ""
99
+ "text": "Color of the icon"
99
100
  },
100
101
  "getter": false,
101
102
  "setter": false,
102
- "attribute": "colour",
103
103
  "reflect": false
104
104
  },
105
- "size": {
105
+ "dsSize": {
106
106
  "type": "string",
107
+ "attribute": "ds-size",
107
108
  "mutable": false,
108
109
  "complexType": {
109
- "original": "string",
110
- "resolved": "string",
111
- "references": {}
110
+ "original": "Size",
111
+ "resolved": "\"1.5rem\" | \"1rem\" | \"2rem\" | \"3rem\" | \"4rem\"",
112
+ "references": {
113
+ "Size": {
114
+ "location": "global",
115
+ "id": "global::Size"
116
+ }
117
+ }
112
118
  },
113
119
  "required": false,
114
120
  "optional": false,
115
121
  "docs": {
116
122
  "tags": [],
117
- "text": ""
123
+ "text": "Size of the icon"
118
124
  },
119
125
  "getter": false,
120
126
  "setter": false,
121
- "attribute": "size",
122
127
  "reflect": false,
123
128
  "defaultValue": "'1.5rem'"
124
129
  },
125
130
  "dsTitle": {
126
131
  "type": "string",
132
+ "attribute": "ds-title",
127
133
  "mutable": false,
128
134
  "complexType": {
129
135
  "original": "string",
@@ -134,16 +140,16 @@ export class DsIcon {
134
140
  "optional": false,
135
141
  "docs": {
136
142
  "tags": [],
137
- "text": ""
143
+ "text": "Tooltip of the icon"
138
144
  },
139
145
  "getter": false,
140
146
  "setter": false,
141
- "attribute": "title",
142
147
  "reflect": false,
143
148
  "defaultValue": "'Icon'"
144
149
  },
145
- "role": {
150
+ "dsRole": {
146
151
  "type": "string",
152
+ "attribute": "ds-role",
147
153
  "mutable": false,
148
154
  "complexType": {
149
155
  "original": "string",
@@ -154,16 +160,16 @@ export class DsIcon {
154
160
  "optional": false,
155
161
  "docs": {
156
162
  "tags": [],
157
- "text": ""
163
+ "text": "Passed to the `role` attribute of the `svg` element"
158
164
  },
159
165
  "getter": false,
160
166
  "setter": false,
161
- "attribute": "role",
162
167
  "reflect": false,
163
168
  "defaultValue": "'img'"
164
169
  },
165
- "hidden": {
170
+ "dsHidden": {
166
171
  "type": "boolean",
172
+ "attribute": "ds-hidden",
167
173
  "mutable": false,
168
174
  "complexType": {
169
175
  "original": "boolean",
@@ -174,11 +180,10 @@ export class DsIcon {
174
180
  "optional": false,
175
181
  "docs": {
176
182
  "tags": [],
177
- "text": ""
183
+ "text": "Passed to the `title` attribute of the `svg` element"
178
184
  },
179
185
  "getter": false,
180
186
  "setter": false,
181
- "attribute": "hidden",
182
187
  "reflect": false,
183
188
  "defaultValue": "true"
184
189
  }
@@ -4,62 +4,35 @@ const meta = {
4
4
  title: 'Base Components/Icon',
5
5
  component: 'ds-icon',
6
6
  argTypes: {
7
- name: {
7
+ dsName: {
8
8
  options: icons.map(icon => icon.name),
9
9
  control: {
10
10
  type: 'select',
11
11
  },
12
- name: 'Icon',
13
12
  },
14
- colour: {
13
+ dsColour: {
15
14
  options: getColourVariables('palette').map(colour => colour.name),
16
15
  control: {
17
16
  type: 'select',
18
17
  },
19
- name: 'Colour',
20
- },
21
- size: {
22
- options: [1, 1.5, 2, 3, 4].map(size => `${size}rem`),
23
- control: {
24
- type: 'select',
25
- },
26
- name: 'Size',
27
- },
28
- dsTitle: {
29
- control: {
30
- type: 'text',
31
- },
32
- name: 'Title',
33
- },
34
- hidden: {
35
- control: {
36
- type: 'boolean',
37
- },
38
- name: 'Hidden (aria-hidden)',
39
- },
40
- role: {
41
- control: {
42
- type: 'text',
43
- },
44
- name: 'Role',
45
18
  },
46
19
  },
47
20
  };
48
21
  export default meta;
49
22
  export const Default = {};
50
23
  Default.args = {
51
- name: 'archive',
52
- role: 'img',
24
+ dsName: 'archive',
25
+ dsRole: 'img',
53
26
  dsTitle: 'Icon',
54
- hidden: true,
27
+ dsHidden: true,
55
28
  };
56
29
  export const Playground = {
57
30
  args: {
58
- name: 'archive',
59
- colour: 'primary',
60
- size: '1.5rem',
31
+ dsName: 'archive',
32
+ dsColour: 'primary',
33
+ dsSize: '1.5rem',
61
34
  dsTitle: 'Icon',
62
- role: 'img',
63
- hidden: true,
35
+ dsRole: 'img',
36
+ dsHidden: true,
64
37
  },
65
38
  };
@@ -13,10 +13,10 @@
13
13
  gap: var(--ds-spacing-2xSmall);
14
14
  }
15
15
  .ds-input-validity--error {
16
- color: var(--ds-textColor-danger);
16
+ color: var(--ds-palette-red-70);
17
17
  }
18
18
  .ds-input-validity--success {
19
- color: var(--ds-textColor-success);
19
+ color: var(--ds-palette-green-70);
20
20
  }
21
21
  .ds-input-validity ds-icon {
22
22
  display: block;