@ilo-org/react 0.0.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 (348) hide show
  1. package/.eslintrc.js +36 -0
  2. package/.storybook/main.js +28 -0
  3. package/.storybook/manager-head.html +7 -0
  4. package/.storybook/manager.js +6 -0
  5. package/.storybook/preview.tsx +33 -0
  6. package/.storybook/styles.scss +1 -0
  7. package/.storybook/theme.js +11 -0
  8. package/.turbo/turbo-build.log +513 -0
  9. package/.turbo/turbo-check.log +5 -0
  10. package/.turbo/turbo-test.log +1676 -0
  11. package/=6.4.0 +115 -0
  12. package/=7.21.4 +21 -0
  13. package/LICENSE +201 -0
  14. package/README.md +11 -0
  15. package/lib/index.esm.js +24 -0
  16. package/lib/index.esm.js.map +1 -0
  17. package/lib/index.js +24 -0
  18. package/lib/index.js.map +1 -0
  19. package/package.json +115 -0
  20. package/rollup.config.js +40 -0
  21. package/src/__tests__/Accordion.test.tsx +52 -0
  22. package/src/__tests__/Button.test.tsx +60 -0
  23. package/src/__tests__/Callout.test.tsx +41 -0
  24. package/src/__tests__/ContextMenu.test.tsx +19 -0
  25. package/src/__tests__/Dropdown.test.tsx +38 -0
  26. package/src/__tests__/Form.test.tsx +34 -0
  27. package/src/__tests__/Heading.test.tsx +51 -0
  28. package/src/__tests__/Hero.test.tsx +22 -0
  29. package/src/__tests__/Image.test.tsx +21 -0
  30. package/src/__tests__/LinkList.test.tsx +17 -0
  31. package/src/__tests__/List.test.tsx +37 -0
  32. package/src/__tests__/Loading.text.tsx +33 -0
  33. package/src/__tests__/Notification.test.tsx +39 -0
  34. package/src/__tests__/Pagination.test.tsx +58 -0
  35. package/src/__tests__/Profile.test.tsx +48 -0
  36. package/src/__tests__/ReadMore.test.tsx +42 -0
  37. package/src/__tests__/RichText.test.tsx +16 -0
  38. package/src/__tests__/SearchField.test.tsx +35 -0
  39. package/src/__tests__/TableOfContents.test.tsx +12 -0
  40. package/src/__tests__/Tag.test.tsx +10 -0
  41. package/src/components/Accordion/Accordion.args.ts +19 -0
  42. package/src/components/Accordion/Accordion.props.d.ts +39 -0
  43. package/src/components/Accordion/Accordion.tsx +70 -0
  44. package/src/components/Accordion/AccordionButton.props.d.ts +13 -0
  45. package/src/components/Accordion/AccordionButton.tsx +60 -0
  46. package/src/components/Accordion/AccordionItem.props.d.ts +25 -0
  47. package/src/components/Accordion/AccordionItem.tsx +33 -0
  48. package/src/components/Accordion/AccordionPanel.props.d.ts +20 -0
  49. package/src/components/Accordion/AccordionPanel.tsx +47 -0
  50. package/src/components/Accordion/index.ts +4 -0
  51. package/src/components/Button/Button.args.ts +353 -0
  52. package/src/components/Button/Button.props.d.ts +74 -0
  53. package/src/components/Button/Button.tsx +67 -0
  54. package/src/components/Button/index.ts +1 -0
  55. package/src/components/Callout/Callout.args.ts +64 -0
  56. package/src/components/Callout/Callout.props.d.ts +61 -0
  57. package/src/components/Callout/Callout.tsx +80 -0
  58. package/src/components/Callout/index.ts +1 -0
  59. package/src/components/Checkbox/Checkbox.args.ts +22 -0
  60. package/src/components/Checkbox/Checkbox.props.d.ts +61 -0
  61. package/src/components/Checkbox/Checkbox.tsx +92 -0
  62. package/src/components/Checkbox/index.ts +1 -0
  63. package/src/components/ChoiceGroup/ChoiceGroup.args.ts +90 -0
  64. package/src/components/ChoiceGroup/ChoiceGroup.props.d.ts +57 -0
  65. package/src/components/ChoiceGroup/ChoiceGroup.tsx +42 -0
  66. package/src/components/ChoiceGroup/index.ts +1 -0
  67. package/src/components/Collapse/Collapse.props.d.ts +92 -0
  68. package/src/components/Collapse/Collapse.tsx +130 -0
  69. package/src/components/Collapse/index.ts +1 -0
  70. package/src/components/ContextMenu/ContextMenu.args.ts +62 -0
  71. package/src/components/ContextMenu/ContextMenu.props.d.ts +28 -0
  72. package/src/components/ContextMenu/ContextMenu.tsx +32 -0
  73. package/src/components/ContextMenu/index.ts +1 -0
  74. package/src/components/Credit/Credit.args.ts +14 -0
  75. package/src/components/Credit/Credit.props.d.ts +11 -0
  76. package/src/components/Credit/Credit.tsx +41 -0
  77. package/src/components/Credit/index.ts +1 -0
  78. package/src/components/DatePicker/DatePicker.args.ts +82 -0
  79. package/src/components/DatePicker/DatePicker.props.d.ts +68 -0
  80. package/src/components/DatePicker/DatePicker.tsx +119 -0
  81. package/src/components/DatePicker/index.ts +1 -0
  82. package/src/components/Dropdown/Dropdown.args.ts +220 -0
  83. package/src/components/Dropdown/Dropdown.props.d.ts +84 -0
  84. package/src/components/Dropdown/Dropdown.tsx +82 -0
  85. package/src/components/Dropdown/index.ts +1 -0
  86. package/src/components/Empty/Empty.args.ts +14 -0
  87. package/src/components/Empty/Empty.props.d.ts +6 -0
  88. package/src/components/Empty/Empty.tsx +16 -0
  89. package/src/components/Empty/index.ts +1 -0
  90. package/src/components/Fieldset/Fieldset.props.d.ts +36 -0
  91. package/src/components/Fieldset/Fieldset.tsx +90 -0
  92. package/src/components/Fieldset/index.ts +1 -0
  93. package/src/components/FileUpload/FileUpload.args.ts +62 -0
  94. package/src/components/FileUpload/FileUpload.props.d.ts +63 -0
  95. package/src/components/FileUpload/FileUpload.tsx +82 -0
  96. package/src/components/FileUpload/index.ts +1 -0
  97. package/src/components/Form/Form.args.ts +265 -0
  98. package/src/components/Form/Form.props.d.ts +84 -0
  99. package/src/components/Form/Form.tsx +83 -0
  100. package/src/components/Form/index.ts +1 -0
  101. package/src/components/FormElement/FormElement.props.d.ts +53 -0
  102. package/src/components/FormElement/FormElement.tsx +26 -0
  103. package/src/components/FormElement/index.ts +1 -0
  104. package/src/components/FormGroup/FormGroup.args.ts +84 -0
  105. package/src/components/FormGroup/FormGroup.props.d.ts +71 -0
  106. package/src/components/FormGroup/FormGroup.tsx +73 -0
  107. package/src/components/FormGroup/index.ts +1 -0
  108. package/src/components/GlobalProvider/GlobalProvider.props.d.ts +15 -0
  109. package/src/components/GlobalProvider/GlobalProvider.tsx +27 -0
  110. package/src/components/GlobalProvider/index.js +4 -0
  111. package/src/components/Heading/Heading.args.ts +46 -0
  112. package/src/components/Heading/Heading.props.d.ts +24 -0
  113. package/src/components/Heading/Heading.tsx +28 -0
  114. package/src/components/Heading/index.ts +1 -0
  115. package/src/components/Hero/Hero.args.ts +296 -0
  116. package/src/components/Hero/Hero.props.d.ts +29 -0
  117. package/src/components/Hero/Hero.tsx +35 -0
  118. package/src/components/Hero/HeroCard.props.d.ts +65 -0
  119. package/src/components/Hero/HeroCard.tsx +53 -0
  120. package/src/components/Hero/index.ts +2 -0
  121. package/src/components/Icon/Icon.args.ts +15 -0
  122. package/src/components/Icon/Icon.props.d.ts +16 -0
  123. package/src/components/Icon/Icon.tsx +25 -0
  124. package/src/components/Icon/index.ts +1 -0
  125. package/src/components/Image/Image.args.ts +35 -0
  126. package/src/components/Image/Image.props.d.ts +38 -0
  127. package/src/components/Image/Image.tsx +51 -0
  128. package/src/components/Image/index.ts +1 -0
  129. package/src/components/Input/Input.args.ts +139 -0
  130. package/src/components/Input/Input.props.d.ts +63 -0
  131. package/src/components/Input/Input.tsx +63 -0
  132. package/src/components/Input/index.ts +1 -0
  133. package/src/components/Link/Link.args.ts +36 -0
  134. package/src/components/Link/Link.props.d.ts +34 -0
  135. package/src/components/Link/Link.tsx +49 -0
  136. package/src/components/Link/index.ts +1 -0
  137. package/src/components/LinkList/LinkList.args.ts +193 -0
  138. package/src/components/LinkList/LinkList.props.d.ts +52 -0
  139. package/src/components/LinkList/LinkList.tsx +59 -0
  140. package/src/components/LinkList/index.ts +1 -0
  141. package/src/components/List/List.args.ts +38 -0
  142. package/src/components/List/List.props.d.ts +36 -0
  143. package/src/components/List/List.tsx +47 -0
  144. package/src/components/List/ListItem.props.d.ts +25 -0
  145. package/src/components/List/ListItem.tsx +23 -0
  146. package/src/components/List/index.ts +2 -0
  147. package/src/components/Loading/Loading.args.ts +55 -0
  148. package/src/components/Loading/Loading.props.d.ts +23 -0
  149. package/src/components/Loading/Loading.tsx +24 -0
  150. package/src/components/Loading/index.ts +1 -0
  151. package/src/components/Notification/Notification.args.ts +157 -0
  152. package/src/components/Notification/Notification.props.d.ts +67 -0
  153. package/src/components/Notification/Notification.tsx +78 -0
  154. package/src/components/Notification/index.ts +1 -0
  155. package/src/components/NumberPicker/NumberPicker.args.ts +58 -0
  156. package/src/components/NumberPicker/NumberPicker.props.d.ts +56 -0
  157. package/src/components/NumberPicker/NumberPicker.tsx +65 -0
  158. package/src/components/NumberPicker/index.ts +1 -0
  159. package/src/components/Pagination/Pagination.args.ts +43 -0
  160. package/src/components/Pagination/Pagination.props.d.ts +66 -0
  161. package/src/components/Pagination/Pagination.tsx +114 -0
  162. package/src/components/Pagination/index.ts +1 -0
  163. package/src/components/Profile/Profile.args.ts +58 -0
  164. package/src/components/Profile/Profile.props.d.ts +43 -0
  165. package/src/components/Profile/Profile.tsx +43 -0
  166. package/src/components/Profile/index.ts +1 -0
  167. package/src/components/Radio/Radio.args.ts +22 -0
  168. package/src/components/Radio/Radio.props.d.ts +61 -0
  169. package/src/components/Radio/Radio.tsx +64 -0
  170. package/src/components/Radio/index.ts +1 -0
  171. package/src/components/ReadMore/ReadMore.props.d.ts +38 -0
  172. package/src/components/ReadMore/ReadMore.tsx +55 -0
  173. package/src/components/ReadMore/index.ts +1 -0
  174. package/src/components/ReadMore/readMore.args.ts +35 -0
  175. package/src/components/RichText/RichText.props.d.ts +11 -0
  176. package/src/components/RichText/RichText.tsx +22 -0
  177. package/src/components/RichText/index.ts +1 -0
  178. package/src/components/RichText/richText.args.ts +15 -0
  179. package/src/components/SearchField/SearchField.args.ts +73 -0
  180. package/src/components/SearchField/SearchField.props.d.ts +35 -0
  181. package/src/components/SearchField/SearchField.tsx +55 -0
  182. package/src/components/SearchField/index.ts +1 -0
  183. package/src/components/TableOfContents/TableOfContents.args.ts +35 -0
  184. package/src/components/TableOfContents/TableOfContents.props.d.ts +23 -0
  185. package/src/components/TableOfContents/TableOfContents.tsx +32 -0
  186. package/src/components/TableOfContents/index.ts +1 -0
  187. package/src/components/Tag/Tag.args.ts +15 -0
  188. package/src/components/Tag/Tag.props.d.ts +34 -0
  189. package/src/components/Tag/Tag.tsx +99 -0
  190. package/src/components/Tag/TagSet.args.ts +39 -0
  191. package/src/components/Tag/TagSet.props.d.ts +36 -0
  192. package/src/components/Tag/TagSet.tsx +71 -0
  193. package/src/components/Tag/index.ts +2 -0
  194. package/src/components/Textarea/Textarea.args.ts +62 -0
  195. package/src/components/Textarea/Textarea.props.d.ts +71 -0
  196. package/src/components/Textarea/Textarea.tsx +67 -0
  197. package/src/components/Textarea/index.ts +1 -0
  198. package/src/components/Tooltip/Tooltip.args.ts +43 -0
  199. package/src/components/Tooltip/Tooltip.props.d.ts +48 -0
  200. package/src/components/Tooltip/Tooltip.tsx +139 -0
  201. package/src/components/Tooltip/index.ts +1 -0
  202. package/src/components/Video/Video.args.ts +81 -0
  203. package/src/components/Video/Video.props.d.ts +82 -0
  204. package/src/components/Video/Video.tsx +29 -0
  205. package/src/components/Video/VideoPlayer.props.d.ts +80 -0
  206. package/src/components/Video/VideoPlayer.tsx +285 -0
  207. package/src/components/Video/index.ts +1 -0
  208. package/src/hooks/useGlobalSettings.ts +13 -0
  209. package/src/hooks/useVideoPlayer.ts +85 -0
  210. package/src/index.ts +19 -0
  211. package/src/public/favicon.ico +0 -0
  212. package/src/public/index.html +43 -0
  213. package/src/public/logo192.png +0 -0
  214. package/src/public/logo512.png +0 -0
  215. package/src/public/manifest.json +25 -0
  216. package/src/public/robots.txt +3 -0
  217. package/src/setup.ts +6 -0
  218. package/src/stories/Accordion.stories.tsx +94 -0
  219. package/src/stories/Button.stories.tsx +491 -0
  220. package/src/stories/Callout.stories.tsx +154 -0
  221. package/src/stories/ContextMenu.stories.tsx +72 -0
  222. package/src/stories/Dropdown.stories.tsx +85 -0
  223. package/src/stories/Empty.stories.tsx +48 -0
  224. package/src/stories/Form.stories.tsx +67 -0
  225. package/src/stories/Heading.stories.tsx +191 -0
  226. package/src/stories/Hero.stories.tsx +129 -0
  227. package/src/stories/Image.stories.tsx +71 -0
  228. package/src/stories/Introduction.stories.mdx +12 -0
  229. package/src/stories/Link.stories.tsx +99 -0
  230. package/src/stories/LinkList.stories.tsx +68 -0
  231. package/src/stories/List.stories.tsx +246 -0
  232. package/src/stories/Loading.stories.tsx +103 -0
  233. package/src/stories/Notification.stories.tsx +154 -0
  234. package/src/stories/Pagination.stories.tsx +63 -0
  235. package/src/stories/Profile.stories.tsx +84 -0
  236. package/src/stories/ReadMore.stories.tsx +80 -0
  237. package/src/stories/RichText.stories.tsx +59 -0
  238. package/src/stories/SearchField.stories.tsx +87 -0
  239. package/src/stories/TableOfContents.stories.tsx +50 -0
  240. package/src/stories/Tag.stories.tsx +194 -0
  241. package/src/stories/Tooltip.stories.tsx +83 -0
  242. package/src/stories/Video.stories.tsx +69 -0
  243. package/src/stories/assets/code-brackets.svg +1 -0
  244. package/src/stories/assets/colors.svg +1 -0
  245. package/src/stories/assets/comments.svg +1 -0
  246. package/src/stories/assets/direction.svg +1 -0
  247. package/src/stories/assets/flow.svg +1 -0
  248. package/src/stories/assets/plugin.svg +1 -0
  249. package/src/stories/assets/repo.svg +1 -0
  250. package/src/stories/assets/stackalt.svg +1 -0
  251. package/src/types/index.ts +49 -0
  252. package/src/types/temp.d.ts +9 -0
  253. package/src/utils/checkArrayDuplicates.ts +3 -0
  254. package/src/utils/createChainedFunction.ts +31 -0
  255. package/src/utils/getDefaultDimensionValue.ts +28 -0
  256. package/src/utils/hoursMinutesSeconds.ts +8 -0
  257. package/src/utils/transitionEndListener.ts +29 -0
  258. package/src/utils/triggerBrowserReflow.ts +4 -0
  259. package/storybook-static/0.f9bb25299a048d2bb825.manager.bundle.js +2 -0
  260. package/storybook-static/0.f9bb25299a048d2bb825.manager.bundle.js.LICENSE.txt +8 -0
  261. package/storybook-static/01daf23af61cc99e9d75.woff2 +0 -0
  262. package/storybook-static/06a2da828c8b6497ba7a.woff +0 -0
  263. package/storybook-static/0fa24adac56865ac7e5f.ttf +0 -0
  264. package/storybook-static/12ec02e7e66abaf38243.eot +0 -0
  265. package/storybook-static/164.8f6e5926.iframe.bundle.js +2 -0
  266. package/storybook-static/164.8f6e5926.iframe.bundle.js.LICENSE.txt +8 -0
  267. package/storybook-static/181.1d6d475b.iframe.bundle.js +1 -0
  268. package/storybook-static/1cc3364249fd0db446ad.ttf +0 -0
  269. package/storybook-static/1dbed2ef5cef8fcb4cbe.ttf +0 -0
  270. package/storybook-static/1fa1c16a4a45d13f0df8.ttf +0 -0
  271. package/storybook-static/23cdaa8575b5e003dcde.eot +0 -0
  272. package/storybook-static/248db78ddf1e3568728d.woff +0 -0
  273. package/storybook-static/27d33755a2b827666dc5.woff +0 -0
  274. package/storybook-static/29.8e0bc9a8.iframe.bundle.js +2 -0
  275. package/storybook-static/29.8e0bc9a8.iframe.bundle.js.LICENSE.txt +102 -0
  276. package/storybook-static/2ac1a95228cf06e17040.woff2 +0 -0
  277. package/storybook-static/337.b8defe66.iframe.bundle.js +2 -0
  278. package/storybook-static/337.b8defe66.iframe.bundle.js.LICENSE.txt +11 -0
  279. package/storybook-static/3579203659b1428de036.eot +0 -0
  280. package/storybook-static/36229f80a738c199462d.woff2 +0 -0
  281. package/storybook-static/409a9c398a28ee4d74ff.eot +0 -0
  282. package/storybook-static/431.8ab7c276.iframe.bundle.js +1 -0
  283. package/storybook-static/431.b32fed6077acc140df7c.manager.bundle.js +1 -0
  284. package/storybook-static/4bf5fc6f93ba10519c82.eot +0 -0
  285. package/storybook-static/51d7da3f5e58e3a24a84.woff +0 -0
  286. package/storybook-static/697.1f42ad69d33c2733c631.manager.bundle.js +1 -0
  287. package/storybook-static/697.9e56beef.iframe.bundle.js +1 -0
  288. package/storybook-static/6a159f0a2005668f1f78.woff +0 -0
  289. package/storybook-static/6f781753b674130d947a.ttf +0 -0
  290. package/storybook-static/70a240717e773fe567b3.woff2 +0 -0
  291. package/storybook-static/720.f44d4e1f5203b6083ae4.manager.bundle.js +1 -0
  292. package/storybook-static/730.1240c246.iframe.bundle.js +1 -0
  293. package/storybook-static/730.7223b772132e3e068755.manager.bundle.js +1 -0
  294. package/storybook-static/73ba1c910e0f7bfc6b18.woff2 +0 -0
  295. package/storybook-static/88739612501023fa15e3.woff +0 -0
  296. package/storybook-static/8a142c29a318c432117a.woff +0 -0
  297. package/storybook-static/914.8ddb80ae2badda1468b0.manager.bundle.js +2 -0
  298. package/storybook-static/914.8ddb80ae2badda1468b0.manager.bundle.js.LICENSE.txt +94 -0
  299. package/storybook-static/978.236a5d9d5736517b960e.manager.bundle.js +2 -0
  300. package/storybook-static/978.236a5d9d5736517b960e.manager.bundle.js.LICENSE.txt +12 -0
  301. package/storybook-static/978.32e8032b.iframe.bundle.js +2 -0
  302. package/storybook-static/978.32e8032b.iframe.bundle.js.LICENSE.txt +12 -0
  303. package/storybook-static/9db5d05810cb98f2831f.ttf +0 -0
  304. package/storybook-static/9ff97e342523931a4992.eot +0 -0
  305. package/storybook-static/a40d436619020fb67db5.woff +0 -0
  306. package/storybook-static/a41d7e330757fb4b2125.woff2 +0 -0
  307. package/storybook-static/ab3494afe25b712485ed.woff +0 -0
  308. package/storybook-static/b53d0e74edc5a5fbef0a.ttf +0 -0
  309. package/storybook-static/b70a9c0ad8e8b43f5e6c.ttf +0 -0
  310. package/storybook-static/c12a83f816844ff94375.ttf +0 -0
  311. package/storybook-static/c5116d16544f932eba4b.eot +0 -0
  312. package/storybook-static/c807e115c00aaffbac11.woff2 +0 -0
  313. package/storybook-static/cadb6b94d6b0ecc3a86a.woff2 +0 -0
  314. package/storybook-static/d0cff1b064bcd84324fe.eot +0 -0
  315. package/storybook-static/d3434771ad7e9030387e.ttf +0 -0
  316. package/storybook-static/d8610c2a4fe5c177f4f6.woff +0 -0
  317. package/storybook-static/d970f426740b938f39e1.woff +0 -0
  318. package/storybook-static/d9c7eba773ff1c8df5bb.eot +0 -0
  319. package/storybook-static/dd4645bdb2f1e1a47ed7.woff2 +0 -0
  320. package/storybook-static/e0a63577ac642885f067.eot +0 -0
  321. package/storybook-static/e2625b8a1277972c9240.ttf +0 -0
  322. package/storybook-static/f469ea3aa8aacf7ad83a.eot +0 -0
  323. package/storybook-static/f632ebfa0d7b7085d542.woff2 +0 -0
  324. package/storybook-static/f93e2252d7112c3bcca5.woff2 +0 -0
  325. package/storybook-static/favicon.ico +0 -0
  326. package/storybook-static/iframe.html +348 -0
  327. package/storybook-static/index.html +59 -0
  328. package/storybook-static/main.01e6a863.iframe.bundle.js +1 -0
  329. package/storybook-static/main.dc406261155f1ebb44ce.manager.bundle.js +1 -0
  330. package/storybook-static/reactPlayerDailyMotion.469cc00f.iframe.bundle.js +1 -0
  331. package/storybook-static/reactPlayerFacebook.1423bb15.iframe.bundle.js +1 -0
  332. package/storybook-static/reactPlayerFilePlayer.e19e24a0.iframe.bundle.js +1 -0
  333. package/storybook-static/reactPlayerKaltura.d1eb0868.iframe.bundle.js +1 -0
  334. package/storybook-static/reactPlayerMixcloud.9f1b1691.iframe.bundle.js +1 -0
  335. package/storybook-static/reactPlayerPreview.9295696b.iframe.bundle.js +1 -0
  336. package/storybook-static/reactPlayerSoundCloud.d420395c.iframe.bundle.js +1 -0
  337. package/storybook-static/reactPlayerStreamable.9b655bf3.iframe.bundle.js +1 -0
  338. package/storybook-static/reactPlayerTwitch.e90e6dea.iframe.bundle.js +1 -0
  339. package/storybook-static/reactPlayerVidyard.a37ae6b3.iframe.bundle.js +1 -0
  340. package/storybook-static/reactPlayerVimeo.a7f367ee.iframe.bundle.js +1 -0
  341. package/storybook-static/reactPlayerWistia.fb351944.iframe.bundle.js +1 -0
  342. package/storybook-static/reactPlayerYouTube.3514e11a.iframe.bundle.js +1 -0
  343. package/storybook-static/runtime~main.012769eac0433a7ec083.manager.bundle.js +1 -0
  344. package/storybook-static/runtime~main.f3168ed5.iframe.bundle.js +1 -0
  345. package/storybook-static/static/css/main.3d116812.css +3 -0
  346. package/storybook-static/static/css/main.3d116812.css.map +1 -0
  347. package/tsconfig.build.json +15 -0
  348. package/tsconfig.json +7 -0
package/package.json ADDED
@@ -0,0 +1,115 @@
1
+ {
2
+ "name": "@ilo-org/react",
3
+ "description": "React components for the ILO's Design System",
4
+ "version": "0.0.1",
5
+ "author": "@justintemps",
6
+ "license": "Apache-2.0",
7
+ "main": "lib/index.js",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "module": "lib/index.esm.js",
12
+ "types": "lib/index.d.ts",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/international-labour-organization/designsystem.git",
16
+ "directory": "packages/react"
17
+ },
18
+ "keywords": [
19
+ "ui_patterns",
20
+ "prototyping",
21
+ "react",
22
+ "designsystem",
23
+ "components"
24
+ ],
25
+ "dependencies": {
26
+ "@ilo-org/brand-assets": "0.0.1",
27
+ "@ilo-org/fonts": "0.0.1",
28
+ "@ilo-org/icons-react": "0.0.1",
29
+ "@ilo-org/styles": "0.0.1",
30
+ "@ilo-org/themes": "0.0.1",
31
+ "@ilo-org/utils": "0.0.1",
32
+ "classnames": "^2.3.1",
33
+ "dom-helpers": "^5.2.1",
34
+ "global": "^4.4.0",
35
+ "react": "^17.0.2",
36
+ "react-dom": "^17.0.2",
37
+ "react-scripts": "5.0.0",
38
+ "react-transition-group": "^4.4.1",
39
+ "typescript": "4.3.4"
40
+ },
41
+ "devDependencies": {
42
+ "@ilo-org/eslint-config": "^0.0.1",
43
+ "@ilo-org/prettier-config": "^0.0.1",
44
+ "@ilo-org/typescript-config": "^0.0.1",
45
+ "@rollup/plugin-commonjs": "^17.1.0",
46
+ "@rollup/plugin-json": "^4.1.0",
47
+ "@rollup/plugin-node-resolve": "^11.2.1",
48
+ "@storybook/addon-a11y": "^6.4.12",
49
+ "@storybook/addon-actions": "^6.4.12",
50
+ "@storybook/addon-docs": "^6.4.19",
51
+ "@storybook/addon-essentials": "^6.4.12",
52
+ "@storybook/addon-links": "^6.4.12",
53
+ "@storybook/builder-webpack5": "^6.4.12",
54
+ "@storybook/client-api": "^6.4.0",
55
+ "@storybook/manager-webpack5": "^6.4.12",
56
+ "@storybook/node-logger": "^6.4.12",
57
+ "@storybook/preset-create-react-app": "^4.0.0",
58
+ "@storybook/preset-scss": "^1.0.3",
59
+ "@storybook/react": "^6.4.12",
60
+ "@storybook/testing-react": "^1.2.3",
61
+ "@storybook/theming": "^6.4.19",
62
+ "@testing-library/jest-dom": "^5.16.1",
63
+ "@testing-library/react": "^12.1.2",
64
+ "@testing-library/user-event": "^13.5.0",
65
+ "@types/jest": "^27.4.1",
66
+ "@types/node": "^17.0.21",
67
+ "@types/react": "17.0.11",
68
+ "@types/react-dom": "^17.0.13",
69
+ "classnames": "2.2.6",
70
+ "http-server": "^14.1.0",
71
+ "jest-environment-jsdom": "^27.5.1",
72
+ "react-player": "2.10.1",
73
+ "rollup": "^2.56.3",
74
+ "rollup-plugin-peer-deps-external": "^2.2.4",
75
+ "rollup-plugin-postcss": "^3.1.8",
76
+ "rollup-plugin-terser": "^7.0.2",
77
+ "rollup-plugin-typescript2": "^0.29.0",
78
+ "sass": "^1.49.9",
79
+ "screenfull": "^5.2.0",
80
+ "storybook-addon-performance": "^0.16.1",
81
+ "ts-jest": "^27.1.3",
82
+ "tslib": "^2.3.1",
83
+ "webpack": "^5.68.0"
84
+ },
85
+ "browserslist": {
86
+ "production": [
87
+ ">0.2%",
88
+ "not dead",
89
+ "not op_mini all"
90
+ ],
91
+ "development": [
92
+ "last 1 chrome version",
93
+ "last 1 firefox version",
94
+ "last 1 safari version"
95
+ ]
96
+ },
97
+ "scripts": {
98
+ "start": "react-scripts start",
99
+ "build-test": "react-scripts build",
100
+ "test": "NODE_OPTIONS=--experimental-vm-modules SKIP_PREFLIGHT_CHECK=true react-scripts test --watchAll=false --setupFilesAfterEnv ./src/setup.ts",
101
+ "test:update": "SKIP_PREFLIGHT_CHECK=true react-scripts test -u --watchAll=false --setupFilesAfterEnv ./src/setup.ts",
102
+ "eject": "react-scripts eject",
103
+ "storybook": "start-storybook -p 6006",
104
+ "storybook:static": "http-server ./storybook-static",
105
+ "build": "pnpm run build:rollup && npm run build:storybook",
106
+ "build:storybook": "build-storybook",
107
+ "build:rollup": "rollup -c",
108
+ "check": "tsc --noEmit",
109
+ "format": "prettier --check . --ignore-path ../../.prettierignore",
110
+ "format:fix": "prettier --write . --ignore-path ../../.prettierignore",
111
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
112
+ "lint:fix": "pnpm lint -- --fix"
113
+ },
114
+ "readme": "# ILO Design System - React Package\n\n## Status: Proof of Concept\n\nThis package provides the implementation of the Design System using [React](https://reactjs.org/). It also includes a [Storybook](https://storybook.js.org/) project for documentation and development of React components.\n\nThis is just a POC, so the package doesn't expose components or include a build step. Only the Storybook project is implemented.\n\n## Styling\n\nUse the `styles` package to manage styling for React components\n"
115
+ }
@@ -0,0 +1,40 @@
1
+ import peerDepsExternal from "rollup-plugin-peer-deps-external";
2
+ import resolve from "@rollup/plugin-node-resolve";
3
+ import commonjs from "@rollup/plugin-commonjs";
4
+ import typescript from "rollup-plugin-typescript2";
5
+ import postcss from "rollup-plugin-postcss";
6
+ import json from "@rollup/plugin-json";
7
+ import { terser } from "rollup-plugin-terser";
8
+
9
+ const packageJson = require("./package.json");
10
+
11
+ export default {
12
+ input: "src/index.ts",
13
+ external: [...Object.keys(packageJson.dependencies)],
14
+ output: [
15
+ {
16
+ file: packageJson.main,
17
+ format: "cjs",
18
+ sourcemap: true,
19
+ },
20
+ {
21
+ file: packageJson.module,
22
+ format: "esm",
23
+ sourcemap: true,
24
+ },
25
+ ],
26
+ plugins: [
27
+ peerDepsExternal(),
28
+ resolve(),
29
+ commonjs(),
30
+ typescript({
31
+ useTsconfigDeclarationDir: true,
32
+ tsconfig: "./tsconfig.build.json",
33
+ }),
34
+ postcss({
35
+ extensions: [".css"],
36
+ }),
37
+ json(),
38
+ terser(),
39
+ ],
40
+ };
@@ -0,0 +1,52 @@
1
+ import { render, screen, fireEvent } from "@testing-library/react";
2
+ import { composeStories } from "@storybook/testing-react";
3
+ import * as stories from "../stories/Accordion.stories";
4
+ import { Accordion, AccordionItem } from "../components/Accordion";
5
+ import accordionArgs from "../components/Accordion/Accordion.args";
6
+
7
+ const { AccordionLarge } = composeStories(stories);
8
+
9
+ // Need to finish writting accordion tests
10
+
11
+ describe("<Accordion>", () => {
12
+ it("Expect button to exist and aria expanded value to change on accordion button click.", () => {
13
+ render(<AccordionLarge />);
14
+ const buttonElement = screen.getAllByRole("button");
15
+ const ariaExpanded = buttonElement[0].getAttribute("aria-expanded");
16
+ expect(buttonElement).not.toBeNull();
17
+ fireEvent.click(buttonElement[0]);
18
+ expect(buttonElement[0]).toHaveAttribute(
19
+ "aria-expanded",
20
+ `${!ariaExpanded}`
21
+ );
22
+ });
23
+
24
+ it("Should render `h1` with story text.", () => {
25
+ render(<AccordionLarge />);
26
+ const buttonElement = screen.getAllByRole("button");
27
+ expect(buttonElement).not.toBeNull();
28
+ fireEvent.click(buttonElement[0]);
29
+ expect(buttonElement[0]).toHaveAttribute("aria-expanded", "false");
30
+ });
31
+
32
+ it("Should render `h2` with story text.", () => {
33
+ render(<AccordionLarge />);
34
+ const buttonElement = screen.getAllByRole("button");
35
+ expect(buttonElement).not.toBeNull();
36
+ fireEvent.click(buttonElement[0]);
37
+ expect(buttonElement[0]).toHaveAttribute("aria-expanded", "false");
38
+ });
39
+
40
+ it("Should print a warning if two <AccordionItem /> have same id", async () => {
41
+ const consoleWarn = jest.spyOn(console, "warn").mockImplementation(() => {
42
+ // do nothing
43
+ });
44
+ render(
45
+ <Accordion {...accordionArgs.large}>
46
+ <AccordionItem id="test-1">Item/</AccordionItem>
47
+ <AccordionItem id="test-1">Item/</AccordionItem>
48
+ </Accordion>
49
+ );
50
+ expect(consoleWarn).toHaveBeenCalled();
51
+ });
52
+ });
@@ -0,0 +1,60 @@
1
+ import { fireEvent, render, screen } from "@testing-library/react";
2
+ import { Button } from "../components/Button";
3
+ import buttonArgs from "../components/Button/Button.args";
4
+
5
+ describe("<Button>", () => {
6
+ it("Should render `button` with correct class name from type prop", () => {
7
+ render(<Button {...buttonArgs.primary} />);
8
+ const buttonElement = screen.getAllByRole("button");
9
+ expect(buttonElement).not.toBeNull();
10
+ expect(buttonElement[0].getAttribute("class")).toEqual(
11
+ expect.stringContaining(buttonArgs.primary.type as string)
12
+ );
13
+ });
14
+
15
+ it("Should render `button` with correct size class name from prop size", () => {
16
+ render(<Button {...buttonArgs.primary} />);
17
+ const buttonElement = screen.getAllByRole("button");
18
+ expect(buttonElement).not.toBeNull();
19
+ expect(buttonElement[0].getAttribute("class")).toEqual(
20
+ expect.stringContaining(buttonArgs.primary.size)
21
+ );
22
+ });
23
+
24
+ it("Should render `button` with correct label from prop label", () => {
25
+ render(<Button {...buttonArgs.primary} />);
26
+ const buttonElement = screen.getAllByRole("button");
27
+ expect(buttonElement).not.toBeNull();
28
+ expect(buttonElement[0].textContent).toEqual(buttonArgs.primary.label);
29
+ });
30
+
31
+ it("Should render `button` as anchor, with the correct url", () => {
32
+ render(<Button {...buttonArgs.large} />);
33
+ const buttonElement = screen.getAllByRole("link");
34
+ expect(buttonElement).not.toBeNull();
35
+ expect(buttonElement[0]).toHaveAttribute("href", buttonArgs.large.url);
36
+ });
37
+
38
+ it("Should render `button` with disabled attribute", () => {
39
+ render(<Button {...buttonArgs.disabled} />);
40
+ const buttonElement = screen.getAllByRole("button");
41
+ expect(buttonElement).not.toBeNull();
42
+ expect(buttonElement[0]).toHaveAttribute("disabled", "");
43
+ });
44
+
45
+ it("Should render `button` as anchor with target attribute and rel attribute", () => {
46
+ render(<Button {...buttonArgs.large} />);
47
+ const buttonElement = screen.getAllByRole("link");
48
+ expect(buttonElement).not.toBeNull();
49
+ expect(buttonElement[0]).toHaveAttribute("target", buttonArgs.large.target);
50
+ expect(buttonElement[0]).toHaveAttribute("rel", "noopener noreferrer");
51
+ });
52
+
53
+ it('calls "callback" prop on button click', () => {
54
+ const onClick = jest.fn();
55
+ render(<Button {...buttonArgs.primary} callback={onClick} />);
56
+ const buttonElement = screen.getAllByRole("button");
57
+ fireEvent.click(buttonElement[0]);
58
+ expect(onClick).toHaveBeenCalled();
59
+ });
60
+ });
@@ -0,0 +1,41 @@
1
+ import { render, screen } from "@testing-library/react";
2
+ import userEvent from "@testing-library/user-event";
3
+ import { Callout } from "../components/Callout";
4
+ import calloutArgs from "../components/Callout/Callout.args";
5
+
6
+ // const { InfoCallout, ErrorCallout, SuccessCallout, WarningCallout } =
7
+ // composeStories(stories);
8
+
9
+ describe("<Callout>", () => {
10
+ it("Should render Callout headline with content.", () => {
11
+ const { container } = render(<Callout {...calloutArgs.hascta} />);
12
+ expect(container.children[0]).not.toBeNull();
13
+ const headlineElement = document.querySelector('[class*="--headline"]');
14
+ console.log(headlineElement);
15
+ expect(headlineElement?.textContent).toEqual(calloutArgs?.hascta?.headline);
16
+ });
17
+
18
+ it("Should render Callout copy with content.", () => {
19
+ const { container } = render(<Callout {...calloutArgs.hascta} />);
20
+ expect(container.children[0]).not.toBeNull();
21
+ const copyElement = document.querySelector('[class*="--copy"]');
22
+ expect(copyElement?.textContent).toEqual(calloutArgs?.hascta?.copy);
23
+ });
24
+
25
+ it("Should render `button` with correct label from prop toggleClosedLabel", () => {
26
+ render(<Callout {...calloutArgs.hascta} />);
27
+ const buttonElement = screen.getAllByRole("button");
28
+ expect(buttonElement).not.toBeNull();
29
+ expect(buttonElement[0].textContent).toEqual(
30
+ calloutArgs?.hascta?.toggleClosedLabel
31
+ );
32
+ });
33
+
34
+ it("Should open the callout on button click", () => {
35
+ const { container } = render(<Callout {...calloutArgs.hascta} />);
36
+ expect(container.children[0]).not.toBeNull();
37
+ userEvent.click(screen.getByRole("button"));
38
+ const calloutOpenElement = document.querySelector('[class*="--open"]');
39
+ expect(calloutOpenElement).not.toBeNull();
40
+ });
41
+ });
@@ -0,0 +1,19 @@
1
+ import { render } from "@testing-library/react";
2
+ import { ContextMenu } from "../components/ContextMenu";
3
+ import contextMenuArgs from "../components/ContextMenu/ContextMenu.args";
4
+
5
+ describe("<ContextMenu>", () => {
6
+ it("Should render `ul` with some items.", () => {
7
+ const { container } = render(<ContextMenu {...contextMenuArgs.basic} />);
8
+ expect(container).not.toBeNull();
9
+ });
10
+
11
+ it("Should render `ul` with `li`s with the `endsection` prop containing the class `endsection`", () => {
12
+ const { container } = render(
13
+ <ContextMenu {...contextMenuArgs.withsection} />
14
+ );
15
+ expect(container).not.toBeNull();
16
+ const endsectionElement = document.querySelector(".endsection");
17
+ expect(endsectionElement).not.toBeNull();
18
+ });
19
+ });
@@ -0,0 +1,38 @@
1
+ import { fireEvent, render, screen } from "@testing-library/react";
2
+ import { Dropdown } from "../components/Dropdown";
3
+ import dropdownArgs from "../components/Dropdown/Dropdown.args";
4
+
5
+ describe("<Dropdown>", () => {
6
+ it("Should render `Dropdown` with correct label from prop label", () => {
7
+ const { container } = render(<Dropdown {...dropdownArgs.basic} />);
8
+ expect(container.children[0]).not.toBeNull();
9
+ expect(container.querySelector("label")?.textContent).toEqual(
10
+ dropdownArgs.basic.label
11
+ );
12
+ });
13
+
14
+ it("should display the correct number of options", () => {
15
+ render(<Dropdown {...dropdownArgs.basic} />);
16
+ expect(screen.getAllByRole("option").length).toBe(
17
+ dropdownArgs?.basic?.options?.length
18
+ );
19
+ });
20
+
21
+ it("selects the correct option", () => {
22
+ render(<Dropdown {...dropdownArgs.basic} />);
23
+ fireEvent.change(screen.getByRole("combobox"), {
24
+ target: { value: "option two" },
25
+ });
26
+ const chosenoption = document.querySelector('option[value="option two"]');
27
+ expect((chosenoption as HTMLOptionElement).selected).toBeTruthy();
28
+ });
29
+
30
+ it('calls "callback" prop on button click', () => {
31
+ const onClick = jest.fn();
32
+ render(<Dropdown {...dropdownArgs.basic} callback={onClick} />);
33
+ fireEvent.change(screen.getByRole("combobox"), {
34
+ target: { value: "option two" },
35
+ });
36
+ expect(onClick).toHaveBeenCalled();
37
+ });
38
+ });
@@ -0,0 +1,34 @@
1
+ import { render, screen } from "@testing-library/react";
2
+ import { Form } from "../components/Form";
3
+ import FormArgs from "../components/Form/Form.args";
4
+
5
+ describe("<Form>", () => {
6
+ it("Should render `Form` with correct label from prop input.placeholder", () => {
7
+ const { container } = render(<Form {...FormArgs.basic} />);
8
+ expect(container.children[0]).not.toBeNull();
9
+ const inputElement = screen.getAllByPlaceholderText(
10
+ FormArgs.basic.items[0].field.placeholder
11
+ );
12
+ expect(inputElement[0]).not.toBeNull();
13
+ });
14
+
15
+ it("Should render `Form input` with disabled attribute", () => {
16
+ const { container } = render(<Form {...FormArgs.hasdisabled} />);
17
+ expect(container.children[0]).not.toBeNull();
18
+ const inputElement = screen.getByPlaceholderText(
19
+ FormArgs.hasdisabled.items[0].field.placeholder
20
+ );
21
+ expect(inputElement).toHaveAttribute("disabled", "");
22
+ });
23
+
24
+ it("Should render `Form input` with error class", () => {
25
+ const { container } = render(<Form {...FormArgs.haserror} />);
26
+ expect(container.children[0]).not.toBeNull();
27
+ const inputElement = screen.getAllByPlaceholderText(
28
+ FormArgs.haserror.items[0].field.placeholder
29
+ );
30
+ expect(inputElement[0].getAttribute("class")).toEqual(
31
+ expect.stringContaining("error")
32
+ );
33
+ });
34
+ });
@@ -0,0 +1,51 @@
1
+ import { render, screen } from "@testing-library/react";
2
+ import { composeStories } from "@storybook/testing-react";
3
+ import headingArgs from "../components/Heading/Heading.args";
4
+ import * as stories from "../stories/Heading.stories";
5
+
6
+ const { Heading1, Heading2, Heading3, Heading4, Heading5, Heading6 } =
7
+ composeStories(stories);
8
+
9
+ describe("<Heading>", () => {
10
+ it("Should render `h1` with story text.", () => {
11
+ render(<Heading1 />);
12
+ const headingElement = screen.getByRole("heading", { level: 1 });
13
+ expect(headingElement).not.toBeNull();
14
+ expect(headingElement.textContent).toEqual(headingArgs.heading1.children);
15
+ });
16
+
17
+ it("Should render `h2` with story text.", () => {
18
+ render(<Heading2 />);
19
+ const headingElement = screen.getByRole("heading", { level: 2 });
20
+ expect(headingElement).not.toBeNull();
21
+ expect(headingElement.textContent).toEqual(headingArgs.heading2.children);
22
+ });
23
+
24
+ it("Should render `h3` with story text.", () => {
25
+ render(<Heading3 />);
26
+ const headingElement = screen.getByRole("heading", { level: 3 });
27
+ expect(headingElement).not.toBeNull();
28
+ expect(headingElement.textContent).toEqual(headingArgs.heading3.children);
29
+ });
30
+
31
+ it("Should render `h4` with story text.", () => {
32
+ render(<Heading4 />);
33
+ const headingElement = screen.getByRole("heading", { level: 4 });
34
+ expect(headingElement).not.toBeNull();
35
+ expect(headingElement.textContent).toEqual(headingArgs.heading4.children);
36
+ });
37
+
38
+ it("Should render `h5` with story text.", () => {
39
+ render(<Heading5 />);
40
+ const headingElement = screen.getByRole("heading", { level: 5 });
41
+ expect(headingElement).not.toBeNull();
42
+ expect(headingElement.textContent).toEqual(headingArgs.heading5.children);
43
+ });
44
+
45
+ it("Should render `h6` with story text.", () => {
46
+ render(<Heading6 />);
47
+ const headingElement = screen.getByRole("heading", { level: 6 });
48
+ expect(headingElement).not.toBeNull();
49
+ expect(headingElement.textContent).toEqual(headingArgs.heading6.children);
50
+ });
51
+ });
@@ -0,0 +1,22 @@
1
+ import { render } from "@testing-library/react";
2
+ import { Hero } from "../components/Hero";
3
+ import heroArgs from "../components/Hero/Hero.args";
4
+
5
+ describe("<Hero>", () => {
6
+ it("Should render with correct content", () => {
7
+ const { container } = render(<Hero {...heroArgs.homeHero} />);
8
+ expect(container).not.toBeNull();
9
+ expect(container.querySelector("h2")?.textContent).toEqual(
10
+ heroArgs.homeHero.heroCard.title
11
+ );
12
+ });
13
+
14
+ it("Should render Hero with intro.", () => {
15
+ const { container } = render(<Hero {...heroArgs.articleHero} />);
16
+ expect(container).not.toBeNull();
17
+ const introElement = document.querySelector('[class*="--intro"]');
18
+ expect(introElement?.textContent).toEqual(
19
+ heroArgs?.articleHero?.heroCard?.intro
20
+ );
21
+ });
22
+ });
@@ -0,0 +1,21 @@
1
+ import { render } from "@testing-library/react";
2
+ import { Image } from "../components/Image";
3
+ import imageArgs from "../components/Image/Image.args";
4
+
5
+ describe("<Image>", () => {
6
+ it("Should render `img` with correct image src", () => {
7
+ const { container } = render(<Image {...imageArgs.image} />);
8
+ expect(container).not.toBeNull();
9
+ expect(container.querySelector("img")?.getAttribute("src")).toEqual(
10
+ imageArgs.image.url?.[0].src
11
+ );
12
+ });
13
+
14
+ it("Should render `img` with correct image alt", () => {
15
+ const { container } = render(<Image {...imageArgs.image} />);
16
+ expect(container).not.toBeNull();
17
+ expect(container.querySelector("img")?.getAttribute("alt")).toEqual(
18
+ imageArgs.image.alt
19
+ );
20
+ });
21
+ });
@@ -0,0 +1,17 @@
1
+ import { render } from "@testing-library/react";
2
+ import { LinkList } from "../components/LinkList";
3
+ import linkListArgs from "../components/LinkList/LinkList.args";
4
+
5
+ describe("<LinkList>", () => {
6
+ it("Should render `ul` with some items.", () => {
7
+ const { container } = render(<LinkList {...linkListArgs.basic} />);
8
+ expect(container).not.toBeNull();
9
+ });
10
+
11
+ it("Should render `ul` with `li`s with the `indented` prop containing the class `indented`", () => {
12
+ const { container } = render(<LinkList {...linkListArgs.withindented} />);
13
+ expect(container).not.toBeNull();
14
+ const indentedElement = document.querySelectorAll(".indented");
15
+ expect(indentedElement).not.toEqual([]);
16
+ });
17
+ });
@@ -0,0 +1,37 @@
1
+ import { render } from "@testing-library/react";
2
+ import { List } from "../components/List";
3
+ import listArgs from "../components/List/List.args";
4
+
5
+ describe("<List>", () => {
6
+ it("Should render `ol` with some items.", () => {
7
+ const { container } = render(<List {...listArgs.ordered} />);
8
+ expect(container).not.toBeNull();
9
+ expect(container.children[0].getAttribute("class")).toEqual(
10
+ expect.stringContaining(listArgs.ordered.ordered as string)
11
+ );
12
+ });
13
+
14
+ it("Should render `ul` with some items.", () => {
15
+ const { container } = render(<List {...listArgs.unordered} />);
16
+ expect(container).not.toBeNull();
17
+ expect(container.children[0].getAttribute("class")).toEqual(
18
+ expect.stringContaining(listArgs.unordered.ordered as string)
19
+ );
20
+ });
21
+
22
+ it("Should render `ul` horizontally with some items.", () => {
23
+ const { container } = render(<List {...listArgs.horizontal} />);
24
+ expect(container).not.toBeNull();
25
+ expect(container.children[0].getAttribute("class")).toEqual(
26
+ expect.stringContaining(listArgs.horizontal.alignment as string)
27
+ );
28
+ });
29
+
30
+ it("Should render `ul` unstyled with some items.", () => {
31
+ const { container } = render(<List {...listArgs.unstyled} />);
32
+ expect(container).not.toBeNull();
33
+ expect(container.children[0].getAttribute("class")).toEqual(
34
+ expect.stringContaining(listArgs.unstyled.ordered as string)
35
+ );
36
+ });
37
+ });
@@ -0,0 +1,33 @@
1
+ import { render } from "@testing-library/react";
2
+ import { Loading } from "../components/Loading";
3
+ import loadingArgs from "../components/Loading/Loading.args";
4
+
5
+ describe("<Loading>", () => {
6
+ it("Should render `Loading` with correct label from prop label", () => {
7
+ const { container } = render(<Loading {...loadingArgs.loadinglarge} />);
8
+ expect(container.children[0]).not.toBeNull();
9
+ const paragraphElement = document.querySelector(
10
+ 'p[class*="--copy"]'
11
+ ) as Element;
12
+ expect(paragraphElement).not.toBeNull();
13
+ expect(paragraphElement.textContent).toEqual(
14
+ loadingArgs.loadinglarge.message
15
+ );
16
+ });
17
+
18
+ it("Should render `Loading` with correct class derived from prop status", () => {
19
+ const { container } = render(<Loading {...loadingArgs.loadinglarge} />);
20
+ expect(container.children[0]).not.toBeNull();
21
+ expect(container.children[0].getAttribute("class")).toContain(
22
+ loadingArgs.loadinglarge.status
23
+ );
24
+ });
25
+
26
+ it("Should render `Loading` with correct class derived from prop size", () => {
27
+ const { container } = render(<Loading {...loadingArgs.loadinglarge} />);
28
+ expect(container.children[0]).not.toBeNull();
29
+ expect(container.children[0].getAttribute("class")).toContain(
30
+ loadingArgs.loadinglarge.size
31
+ );
32
+ });
33
+ });
@@ -0,0 +1,39 @@
1
+ import { render, screen } from "@testing-library/react";
2
+ import userEvent from "@testing-library/user-event";
3
+ import { Notification } from "../components/Notification";
4
+ import notificationArgs from "../components/Notification/Notification.args";
5
+
6
+ describe("<Notification>", () => {
7
+ it("Should render Notification headline with content.", () => {
8
+ const { container } = render(<Notification {...notificationArgs.hascta} />);
9
+ expect(container.children[0]).not.toBeNull();
10
+ const headlineElement = document.querySelector('[class*="--headline"]');
11
+ console.log(headlineElement);
12
+ expect(headlineElement?.textContent).toEqual(
13
+ notificationArgs?.hascta?.headline
14
+ );
15
+ });
16
+
17
+ it("Should render Notification copy with content.", () => {
18
+ const { container } = render(<Notification {...notificationArgs.hascta} />);
19
+ expect(container.children[0]).not.toBeNull();
20
+ const copyElement = document.querySelector('[class*="--copy"]');
21
+ expect(copyElement?.textContent).toEqual(notificationArgs?.hascta?.copy);
22
+ });
23
+
24
+ it("Should render `button` with correct label from prop closelabel", () => {
25
+ render(<Notification {...notificationArgs.hascta} />);
26
+ const buttonElement = screen.getAllByRole("button");
27
+ expect(buttonElement).not.toBeNull();
28
+ expect(buttonElement[0].textContent).toEqual(
29
+ notificationArgs?.hascta?.closelabel
30
+ );
31
+ });
32
+
33
+ it("Should delete the component on click of the button", () => {
34
+ const { container } = render(<Notification {...notificationArgs.hascta} />);
35
+ expect(container.children[0]).not.toBeNull();
36
+ userEvent.click(screen.getByRole("button"));
37
+ expect(container.children[0]).toBeUndefined();
38
+ });
39
+ });