@dxc-technology/halstack-react 0.0.0-50712b5 → 0.0.0-50acff4

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 (674) hide show
  1. package/BackgroundColorContext.d.ts +1 -0
  2. package/BackgroundColorContext.js +30 -0
  3. package/HalstackContext.d.ts +1246 -0
  4. package/HalstackContext.js +310 -0
  5. package/README.md +28 -47
  6. package/accordion/Accordion.accessibility.test.d.ts +1 -0
  7. package/accordion/Accordion.accessibility.test.js +71 -0
  8. package/accordion/Accordion.d.ts +4 -0
  9. package/accordion/Accordion.js +168 -0
  10. package/accordion/Accordion.stories.tsx +241 -0
  11. package/accordion/Accordion.test.d.ts +1 -0
  12. package/accordion/Accordion.test.js +56 -0
  13. package/accordion/types.d.ts +57 -0
  14. package/accordion/types.js +5 -0
  15. package/accordion-group/AccordionGroup.accessibility.test.d.ts +1 -0
  16. package/accordion-group/AccordionGroup.accessibility.test.js +82 -0
  17. package/accordion-group/AccordionGroup.d.ts +7 -0
  18. package/accordion-group/AccordionGroup.js +101 -0
  19. package/accordion-group/AccordionGroup.stories.tsx +252 -0
  20. package/accordion-group/AccordionGroup.test.d.ts +1 -0
  21. package/accordion-group/AccordionGroup.test.js +94 -0
  22. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  23. package/accordion-group/AccordionGroupAccordion.js +31 -0
  24. package/accordion-group/AccordionGroupContext.d.ts +3 -0
  25. package/accordion-group/AccordionGroupContext.js +8 -0
  26. package/accordion-group/types.d.ts +67 -0
  27. package/accordion-group/types.js +5 -0
  28. package/action-icon/ActionIcon.accessibility.test.d.ts +1 -0
  29. package/action-icon/ActionIcon.accessibility.test.js +63 -0
  30. package/action-icon/ActionIcon.d.ts +4 -0
  31. package/action-icon/ActionIcon.js +48 -0
  32. package/action-icon/ActionIcon.stories.tsx +41 -0
  33. package/action-icon/ActionIcon.test.d.ts +1 -0
  34. package/action-icon/ActionIcon.test.js +64 -0
  35. package/action-icon/types.d.ts +26 -0
  36. package/action-icon/types.js +5 -0
  37. package/alert/Alert.accessibility.test.d.ts +1 -0
  38. package/alert/Alert.accessibility.test.js +95 -0
  39. package/alert/Alert.d.ts +4 -0
  40. package/alert/Alert.js +203 -0
  41. package/alert/Alert.stories.tsx +198 -0
  42. package/alert/Alert.test.d.ts +1 -0
  43. package/alert/Alert.test.js +75 -0
  44. package/alert/types.d.ts +49 -0
  45. package/alert/types.js +5 -0
  46. package/badge/Badge.accessibility.test.d.ts +1 -0
  47. package/badge/Badge.accessibility.test.js +129 -0
  48. package/badge/Badge.d.ts +4 -0
  49. package/badge/Badge.js +161 -0
  50. package/badge/Badge.stories.tsx +210 -0
  51. package/badge/Badge.test.d.ts +1 -0
  52. package/badge/Badge.test.js +30 -0
  53. package/badge/types.d.ts +54 -0
  54. package/badge/types.js +5 -0
  55. package/bleed/Bleed.d.ts +3 -0
  56. package/bleed/Bleed.js +43 -0
  57. package/bleed/Bleed.stories.tsx +342 -0
  58. package/bleed/types.d.ts +37 -0
  59. package/bleed/types.js +5 -0
  60. package/box/Box.accessibility.test.d.ts +1 -0
  61. package/box/Box.accessibility.test.js +33 -0
  62. package/box/Box.d.ts +4 -0
  63. package/box/Box.js +75 -0
  64. package/box/Box.stories.tsx +119 -0
  65. package/box/Box.test.d.ts +1 -0
  66. package/box/Box.test.js +13 -0
  67. package/box/types.d.ts +32 -0
  68. package/box/types.js +5 -0
  69. package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +1 -0
  70. package/breadcrumbs/Breadcrumbs.accessibility.test.js +96 -0
  71. package/breadcrumbs/Breadcrumbs.d.ts +4 -0
  72. package/breadcrumbs/Breadcrumbs.js +79 -0
  73. package/breadcrumbs/Breadcrumbs.stories.tsx +194 -0
  74. package/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
  75. package/breadcrumbs/Breadcrumbs.test.js +168 -0
  76. package/breadcrumbs/Item.d.ts +4 -0
  77. package/breadcrumbs/Item.js +52 -0
  78. package/breadcrumbs/dropdownTheme.d.ts +53 -0
  79. package/breadcrumbs/dropdownTheme.js +62 -0
  80. package/breadcrumbs/types.d.ts +16 -0
  81. package/breadcrumbs/types.js +5 -0
  82. package/bulleted-list/BulletedList.accessibility.test.d.ts +1 -0
  83. package/bulleted-list/BulletedList.accessibility.test.js +119 -0
  84. package/bulleted-list/BulletedList.d.ts +7 -0
  85. package/bulleted-list/BulletedList.js +92 -0
  86. package/bulleted-list/BulletedList.stories.tsx +115 -0
  87. package/bulleted-list/types.d.ts +38 -0
  88. package/bulleted-list/types.js +5 -0
  89. package/button/Button.accessibility.test.d.ts +1 -0
  90. package/button/Button.accessibility.test.js +127 -0
  91. package/button/Button.d.ts +4 -0
  92. package/button/Button.js +121 -0
  93. package/button/Button.stories.tsx +325 -0
  94. package/button/Button.test.d.ts +1 -0
  95. package/button/Button.test.js +38 -0
  96. package/button/types.d.ts +57 -0
  97. package/button/types.js +5 -0
  98. package/card/Card.accessibility.test.d.ts +1 -0
  99. package/card/Card.accessibility.test.js +36 -0
  100. package/card/Card.d.ts +4 -0
  101. package/card/Card.js +121 -0
  102. package/card/Card.stories.tsx +171 -0
  103. package/card/Card.test.d.ts +1 -0
  104. package/card/Card.test.js +39 -0
  105. package/card/types.d.ts +62 -0
  106. package/card/types.js +5 -0
  107. package/checkbox/Checkbox.accessibility.test.d.ts +1 -0
  108. package/checkbox/Checkbox.accessibility.test.js +87 -0
  109. package/checkbox/Checkbox.d.ts +4 -0
  110. package/checkbox/Checkbox.js +212 -0
  111. package/checkbox/Checkbox.stories.tsx +222 -0
  112. package/checkbox/Checkbox.test.d.ts +1 -0
  113. package/checkbox/Checkbox.test.js +199 -0
  114. package/checkbox/types.d.ts +72 -0
  115. package/checkbox/types.js +5 -0
  116. package/chip/Chip.accessibility.test.d.ts +1 -0
  117. package/chip/Chip.accessibility.test.js +67 -0
  118. package/chip/Chip.d.ts +4 -0
  119. package/chip/Chip.js +126 -0
  120. package/chip/Chip.stories.tsx +195 -0
  121. package/chip/Chip.test.d.ts +1 -0
  122. package/chip/Chip.test.js +41 -0
  123. package/chip/types.d.ts +45 -0
  124. package/chip/types.js +5 -0
  125. package/common/coreTokens.d.ts +237 -0
  126. package/common/coreTokens.js +184 -0
  127. package/common/utils.d.ts +1 -0
  128. package/{dist/common → common}/utils.js +6 -12
  129. package/common/variables.d.ts +1392 -0
  130. package/common/variables.js +1264 -0
  131. package/container/Container.d.ts +4 -0
  132. package/container/Container.js +194 -0
  133. package/container/Container.stories.tsx +214 -0
  134. package/container/types.d.ts +74 -0
  135. package/container/types.js +5 -0
  136. package/contextual-menu/ContextualMenu.accessibility.test.d.ts +1 -0
  137. package/contextual-menu/ContextualMenu.accessibility.test.js +98 -0
  138. package/contextual-menu/ContextualMenu.d.ts +5 -0
  139. package/contextual-menu/ContextualMenu.js +108 -0
  140. package/contextual-menu/ContextualMenu.stories.tsx +223 -0
  141. package/contextual-menu/ContextualMenu.test.d.ts +1 -0
  142. package/contextual-menu/ContextualMenu.test.js +247 -0
  143. package/contextual-menu/GroupItem.d.ts +4 -0
  144. package/contextual-menu/GroupItem.js +67 -0
  145. package/contextual-menu/ItemAction.d.ts +4 -0
  146. package/contextual-menu/ItemAction.js +50 -0
  147. package/contextual-menu/MenuItem.d.ts +4 -0
  148. package/contextual-menu/MenuItem.js +29 -0
  149. package/contextual-menu/SingleItem.d.ts +4 -0
  150. package/contextual-menu/SingleItem.js +38 -0
  151. package/contextual-menu/types.d.ts +61 -0
  152. package/contextual-menu/types.js +5 -0
  153. package/date-input/Calendar.d.ts +4 -0
  154. package/date-input/Calendar.js +230 -0
  155. package/date-input/DateInput.accessibility.test.d.ts +1 -0
  156. package/date-input/DateInput.accessibility.test.js +229 -0
  157. package/date-input/DateInput.d.ts +4 -0
  158. package/date-input/DateInput.js +228 -0
  159. package/date-input/DateInput.stories.tsx +291 -0
  160. package/date-input/DateInput.test.d.ts +1 -0
  161. package/date-input/DateInput.test.js +808 -0
  162. package/date-input/DatePicker.d.ts +4 -0
  163. package/date-input/DatePicker.js +121 -0
  164. package/date-input/YearPicker.d.ts +4 -0
  165. package/date-input/YearPicker.js +105 -0
  166. package/date-input/types.d.ts +164 -0
  167. package/date-input/types.js +5 -0
  168. package/dialog/Dialog.accessibility.test.d.ts +1 -0
  169. package/dialog/Dialog.accessibility.test.js +69 -0
  170. package/dialog/Dialog.d.ts +4 -0
  171. package/dialog/Dialog.js +93 -0
  172. package/dialog/Dialog.stories.tsx +369 -0
  173. package/dialog/Dialog.test.d.ts +1 -0
  174. package/dialog/Dialog.test.js +370 -0
  175. package/dialog/types.d.ts +36 -0
  176. package/dialog/types.js +5 -0
  177. package/divider/Divider.accessibility.test.d.ts +1 -0
  178. package/divider/Divider.accessibility.test.js +33 -0
  179. package/divider/Divider.d.ts +4 -0
  180. package/divider/Divider.js +36 -0
  181. package/divider/Divider.stories.tsx +223 -0
  182. package/divider/Divider.test.d.ts +1 -0
  183. package/divider/Divider.test.js +38 -0
  184. package/divider/types.d.ts +21 -0
  185. package/divider/types.js +5 -0
  186. package/dropdown/Dropdown.accessibility.test.d.ts +1 -0
  187. package/dropdown/Dropdown.accessibility.test.js +183 -0
  188. package/dropdown/Dropdown.d.ts +4 -0
  189. package/dropdown/Dropdown.js +320 -0
  190. package/dropdown/Dropdown.stories.tsx +427 -0
  191. package/dropdown/Dropdown.test.d.ts +1 -0
  192. package/dropdown/Dropdown.test.js +628 -0
  193. package/dropdown/DropdownMenu.d.ts +4 -0
  194. package/dropdown/DropdownMenu.js +63 -0
  195. package/dropdown/DropdownMenuItem.d.ts +4 -0
  196. package/dropdown/DropdownMenuItem.js +71 -0
  197. package/dropdown/types.d.ts +96 -0
  198. package/dropdown/types.js +5 -0
  199. package/file-input/FileInput.accessibility.test.d.ts +1 -0
  200. package/file-input/FileInput.accessibility.test.js +167 -0
  201. package/file-input/FileInput.d.ts +4 -0
  202. package/file-input/FileInput.js +438 -0
  203. package/file-input/FileInput.stories.tsx +618 -0
  204. package/file-input/FileInput.test.d.ts +1 -0
  205. package/file-input/FileInput.test.js +404 -0
  206. package/file-input/FileItem.d.ts +4 -0
  207. package/file-input/FileItem.js +125 -0
  208. package/file-input/types.d.ts +125 -0
  209. package/file-input/types.js +5 -0
  210. package/flex/Flex.d.ts +4 -0
  211. package/flex/Flex.js +57 -0
  212. package/flex/Flex.stories.tsx +112 -0
  213. package/flex/types.d.ts +97 -0
  214. package/flex/types.js +5 -0
  215. package/footer/Footer.accessibility.test.d.ts +1 -0
  216. package/footer/Footer.accessibility.test.js +125 -0
  217. package/footer/Footer.d.ts +4 -0
  218. package/footer/Footer.js +140 -0
  219. package/footer/Footer.stories.tsx +208 -0
  220. package/footer/Footer.test.d.ts +1 -0
  221. package/footer/Footer.test.js +85 -0
  222. package/footer/Icons.d.ts +3 -0
  223. package/footer/Icons.js +108 -0
  224. package/footer/types.d.ts +64 -0
  225. package/footer/types.js +5 -0
  226. package/grid/Grid.d.ts +7 -0
  227. package/grid/Grid.js +76 -0
  228. package/grid/Grid.stories.tsx +221 -0
  229. package/grid/types.d.ts +115 -0
  230. package/grid/types.js +5 -0
  231. package/header/Header.accessibility.test.d.ts +1 -0
  232. package/header/Header.accessibility.test.js +94 -0
  233. package/header/Header.d.ts +8 -0
  234. package/header/Header.js +210 -0
  235. package/header/Header.stories.tsx +267 -0
  236. package/header/Header.test.d.ts +1 -0
  237. package/header/Header.test.js +66 -0
  238. package/header/Icons.d.ts +2 -0
  239. package/{dist/header → header}/Icons.js +8 -43
  240. package/header/types.d.ts +33 -0
  241. package/header/types.js +5 -0
  242. package/heading/Heading.accessibility.test.d.ts +1 -0
  243. package/heading/Heading.accessibility.test.js +33 -0
  244. package/heading/Heading.d.ts +4 -0
  245. package/{dist/heading → heading}/Heading.js +31 -124
  246. package/heading/Heading.stories.tsx +54 -0
  247. package/heading/Heading.test.d.ts +1 -0
  248. package/heading/Heading.test.js +156 -0
  249. package/heading/types.d.ts +33 -0
  250. package/heading/types.js +5 -0
  251. package/icon/Icon.accessibility.test.d.ts +1 -0
  252. package/icon/Icon.accessibility.test.js +30 -0
  253. package/icon/Icon.d.ts +4 -0
  254. package/icon/Icon.js +33 -0
  255. package/icon/Icon.stories.tsx +28 -0
  256. package/icon/types.d.ts +4 -0
  257. package/icon/types.js +5 -0
  258. package/image/Image.accessibility.test.d.ts +1 -0
  259. package/image/Image.accessibility.test.js +56 -0
  260. package/image/Image.d.ts +4 -0
  261. package/image/Image.js +70 -0
  262. package/image/Image.stories.tsx +129 -0
  263. package/image/types.d.ts +72 -0
  264. package/image/types.js +5 -0
  265. package/inset/Inset.d.ts +3 -0
  266. package/inset/Inset.js +43 -0
  267. package/inset/Inset.stories.tsx +230 -0
  268. package/inset/types.d.ts +37 -0
  269. package/inset/types.js +5 -0
  270. package/layout/ApplicationLayout.d.ts +20 -0
  271. package/layout/ApplicationLayout.js +137 -0
  272. package/layout/ApplicationLayout.stories.tsx +162 -0
  273. package/layout/Icons.d.ts +7 -0
  274. package/layout/Icons.js +48 -0
  275. package/layout/types.d.ts +41 -0
  276. package/layout/types.js +5 -0
  277. package/link/Link.accessibility.test.d.ts +1 -0
  278. package/link/Link.accessibility.test.js +108 -0
  279. package/link/Link.d.ts +4 -0
  280. package/link/Link.js +117 -0
  281. package/link/Link.stories.tsx +253 -0
  282. package/link/Link.test.d.ts +1 -0
  283. package/link/Link.test.js +63 -0
  284. package/link/types.d.ts +54 -0
  285. package/link/types.js +5 -0
  286. package/main.d.ts +50 -0
  287. package/{dist/main.js → main.js} +142 -137
  288. package/nav-tabs/NavTabs.accessibility.test.d.ts +1 -0
  289. package/nav-tabs/NavTabs.accessibility.test.js +44 -0
  290. package/nav-tabs/NavTabs.d.ts +7 -0
  291. package/nav-tabs/NavTabs.js +108 -0
  292. package/nav-tabs/NavTabs.stories.tsx +294 -0
  293. package/nav-tabs/NavTabs.test.d.ts +1 -0
  294. package/nav-tabs/NavTabs.test.js +77 -0
  295. package/nav-tabs/NavTabsContext.d.ts +3 -0
  296. package/nav-tabs/NavTabsContext.js +8 -0
  297. package/nav-tabs/Tab.d.ts +4 -0
  298. package/nav-tabs/Tab.js +117 -0
  299. package/nav-tabs/types.d.ts +52 -0
  300. package/nav-tabs/types.js +5 -0
  301. package/number-input/NumberInput.accessibility.test.d.ts +1 -0
  302. package/number-input/NumberInput.accessibility.test.js +227 -0
  303. package/number-input/NumberInput.d.ts +4 -0
  304. package/number-input/NumberInput.js +89 -0
  305. package/number-input/NumberInput.stories.tsx +126 -0
  306. package/number-input/NumberInput.test.d.ts +1 -0
  307. package/number-input/NumberInput.test.js +988 -0
  308. package/number-input/NumberInputContext.d.ts +3 -0
  309. package/number-input/NumberInputContext.js +8 -0
  310. package/number-input/types.d.ts +136 -0
  311. package/number-input/types.js +5 -0
  312. package/package.json +67 -51
  313. package/paginator/Paginator.accessibility.test.d.ts +1 -0
  314. package/paginator/Paginator.accessibility.test.js +78 -0
  315. package/paginator/Paginator.d.ts +4 -0
  316. package/paginator/Paginator.js +138 -0
  317. package/paginator/Paginator.stories.tsx +87 -0
  318. package/paginator/Paginator.test.d.ts +1 -0
  319. package/paginator/Paginator.test.js +334 -0
  320. package/paginator/types.d.ts +38 -0
  321. package/paginator/types.js +5 -0
  322. package/paragraph/Paragraph.accessibility.test.d.ts +1 -0
  323. package/paragraph/Paragraph.accessibility.test.js +28 -0
  324. package/paragraph/Paragraph.d.ts +5 -0
  325. package/paragraph/Paragraph.js +22 -0
  326. package/paragraph/Paragraph.stories.tsx +27 -0
  327. package/password-input/PasswordInput.accessibility.test.d.ts +1 -0
  328. package/password-input/PasswordInput.accessibility.test.js +152 -0
  329. package/password-input/PasswordInput.d.ts +4 -0
  330. package/password-input/PasswordInput.js +100 -0
  331. package/password-input/PasswordInput.stories.tsx +108 -0
  332. package/password-input/PasswordInput.test.d.ts +1 -0
  333. package/password-input/PasswordInput.test.js +197 -0
  334. package/password-input/types.d.ts +111 -0
  335. package/password-input/types.js +5 -0
  336. package/progress-bar/ProgressBar.accessibility.test.d.ts +1 -0
  337. package/progress-bar/ProgressBar.accessibility.test.js +35 -0
  338. package/progress-bar/ProgressBar.d.ts +4 -0
  339. package/progress-bar/ProgressBar.js +146 -0
  340. package/progress-bar/ProgressBar.stories.tsx +93 -0
  341. package/progress-bar/ProgressBar.test.d.ts +1 -0
  342. package/progress-bar/ProgressBar.test.js +93 -0
  343. package/progress-bar/types.d.ts +37 -0
  344. package/progress-bar/types.js +5 -0
  345. package/quick-nav/QuickNav.accessibility.test.d.ts +1 -0
  346. package/quick-nav/QuickNav.accessibility.test.js +57 -0
  347. package/quick-nav/QuickNav.d.ts +4 -0
  348. package/quick-nav/QuickNav.js +94 -0
  349. package/quick-nav/QuickNav.stories.tsx +356 -0
  350. package/quick-nav/types.d.ts +21 -0
  351. package/quick-nav/types.js +5 -0
  352. package/radio-group/Radio.d.ts +4 -0
  353. package/radio-group/Radio.js +121 -0
  354. package/radio-group/RadioGroup.accessibility.test.d.ts +1 -0
  355. package/radio-group/RadioGroup.accessibility.test.js +97 -0
  356. package/radio-group/RadioGroup.d.ts +4 -0
  357. package/radio-group/RadioGroup.js +233 -0
  358. package/radio-group/RadioGroup.stories.tsx +214 -0
  359. package/radio-group/RadioGroup.test.d.ts +1 -0
  360. package/radio-group/RadioGroup.test.js +754 -0
  361. package/radio-group/types.d.ts +114 -0
  362. package/radio-group/types.js +5 -0
  363. package/resultset-table/Icons.d.ts +7 -0
  364. package/resultset-table/Icons.js +47 -0
  365. package/resultset-table/ResultsetTable.accessibility.test.d.ts +1 -0
  366. package/resultset-table/ResultsetTable.accessibility.test.js +284 -0
  367. package/resultset-table/ResultsetTable.d.ts +7 -0
  368. package/resultset-table/ResultsetTable.js +171 -0
  369. package/resultset-table/ResultsetTable.stories.tsx +413 -0
  370. package/resultset-table/ResultsetTable.test.d.ts +1 -0
  371. package/resultset-table/ResultsetTable.test.js +379 -0
  372. package/resultset-table/types.d.ts +100 -0
  373. package/resultset-table/types.js +5 -0
  374. package/select/Listbox.d.ts +4 -0
  375. package/select/Listbox.js +151 -0
  376. package/select/Option.d.ts +4 -0
  377. package/select/Option.js +89 -0
  378. package/select/Select.accessibility.test.d.ts +1 -0
  379. package/select/Select.accessibility.test.js +227 -0
  380. package/select/Select.d.ts +4 -0
  381. package/select/Select.js +602 -0
  382. package/select/Select.stories.tsx +928 -0
  383. package/select/Select.test.d.ts +1 -0
  384. package/select/Select.test.js +2267 -0
  385. package/select/types.d.ts +209 -0
  386. package/select/types.js +5 -0
  387. package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
  388. package/sidenav/Sidenav.accessibility.test.js +59 -0
  389. package/sidenav/Sidenav.d.ts +10 -0
  390. package/sidenav/Sidenav.js +201 -0
  391. package/sidenav/Sidenav.stories.tsx +277 -0
  392. package/sidenav/Sidenav.test.d.ts +1 -0
  393. package/sidenav/Sidenav.test.js +37 -0
  394. package/sidenav/SidenavContext.d.ts +5 -0
  395. package/sidenav/SidenavContext.js +13 -0
  396. package/sidenav/types.d.ts +76 -0
  397. package/sidenav/types.js +5 -0
  398. package/slider/Slider.accessibility.test.d.ts +1 -0
  399. package/slider/Slider.accessibility.test.js +103 -0
  400. package/slider/Slider.d.ts +4 -0
  401. package/slider/Slider.js +283 -0
  402. package/slider/Slider.stories.tsx +180 -0
  403. package/slider/Slider.test.d.ts +1 -0
  404. package/slider/Slider.test.js +256 -0
  405. package/slider/types.d.ts +86 -0
  406. package/slider/types.js +5 -0
  407. package/spinner/Spinner.accessibility.test.d.ts +1 -0
  408. package/spinner/Spinner.accessibility.test.js +96 -0
  409. package/spinner/Spinner.d.ts +4 -0
  410. package/spinner/Spinner.js +210 -0
  411. package/spinner/Spinner.stories.tsx +129 -0
  412. package/spinner/Spinner.test.d.ts +1 -0
  413. package/spinner/Spinner.test.js +55 -0
  414. package/spinner/types.d.ts +32 -0
  415. package/spinner/types.js +5 -0
  416. package/status-light/StatusLight.accessibility.test.d.ts +1 -0
  417. package/status-light/StatusLight.accessibility.test.js +157 -0
  418. package/status-light/StatusLight.d.ts +4 -0
  419. package/status-light/StatusLight.js +51 -0
  420. package/status-light/StatusLight.stories.tsx +74 -0
  421. package/status-light/StatusLight.test.d.ts +1 -0
  422. package/status-light/StatusLight.test.js +25 -0
  423. package/status-light/types.d.ts +17 -0
  424. package/status-light/types.js +5 -0
  425. package/switch/Switch.accessibility.test.d.ts +1 -0
  426. package/switch/Switch.accessibility.test.js +98 -0
  427. package/switch/Switch.d.ts +4 -0
  428. package/switch/Switch.js +211 -0
  429. package/switch/Switch.stories.tsx +149 -0
  430. package/switch/Switch.test.d.ts +1 -0
  431. package/switch/Switch.test.js +180 -0
  432. package/switch/types.d.ts +66 -0
  433. package/switch/types.js +5 -0
  434. package/table/DropdownTheme.js +62 -0
  435. package/table/Table.accessibility.test.d.ts +1 -0
  436. package/table/Table.accessibility.test.js +92 -0
  437. package/table/Table.d.ts +8 -0
  438. package/table/Table.js +161 -0
  439. package/table/Table.stories.tsx +663 -0
  440. package/table/Table.test.d.ts +1 -0
  441. package/table/Table.test.js +111 -0
  442. package/table/types.d.ts +49 -0
  443. package/table/types.js +5 -0
  444. package/tabs/Tab.d.ts +4 -0
  445. package/tabs/Tab.js +117 -0
  446. package/tabs/Tabs.accessibility.test.d.ts +1 -0
  447. package/tabs/Tabs.accessibility.test.js +56 -0
  448. package/tabs/Tabs.d.ts +4 -0
  449. package/tabs/Tabs.js +373 -0
  450. package/tabs/Tabs.stories.tsx +230 -0
  451. package/tabs/Tabs.test.d.ts +1 -0
  452. package/tabs/Tabs.test.js +276 -0
  453. package/tabs/types.d.ts +92 -0
  454. package/tabs/types.js +5 -0
  455. package/tag/Tag.accessibility.test.d.ts +1 -0
  456. package/tag/Tag.accessibility.test.js +69 -0
  457. package/tag/Tag.d.ts +4 -0
  458. package/tag/Tag.js +151 -0
  459. package/tag/Tag.stories.tsx +152 -0
  460. package/tag/Tag.test.d.ts +1 -0
  461. package/tag/Tag.test.js +41 -0
  462. package/tag/types.d.ts +69 -0
  463. package/tag/types.js +5 -0
  464. package/text-input/Suggestion.d.ts +4 -0
  465. package/text-input/Suggestion.js +67 -0
  466. package/text-input/Suggestions.d.ts +4 -0
  467. package/text-input/Suggestions.js +94 -0
  468. package/text-input/TextInput.accessibility.test.d.ts +1 -0
  469. package/text-input/TextInput.accessibility.test.js +320 -0
  470. package/text-input/TextInput.d.ts +4 -0
  471. package/text-input/TextInput.js +571 -0
  472. package/text-input/TextInput.stories.tsx +477 -0
  473. package/text-input/TextInput.test.d.ts +1 -0
  474. package/text-input/TextInput.test.js +1755 -0
  475. package/text-input/types.d.ts +205 -0
  476. package/text-input/types.js +5 -0
  477. package/textarea/Textarea.accessibility.test.d.ts +1 -0
  478. package/textarea/Textarea.accessibility.test.js +155 -0
  479. package/textarea/Textarea.d.ts +4 -0
  480. package/textarea/Textarea.js +235 -0
  481. package/textarea/Textarea.stories.tsx +174 -0
  482. package/textarea/Textarea.test.d.ts +1 -0
  483. package/textarea/Textarea.test.js +406 -0
  484. package/textarea/types.d.ts +141 -0
  485. package/textarea/types.js +5 -0
  486. package/toggle-group/ToggleGroup.accessibility.test.d.ts +1 -0
  487. package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
  488. package/toggle-group/ToggleGroup.d.ts +4 -0
  489. package/toggle-group/ToggleGroup.js +199 -0
  490. package/toggle-group/ToggleGroup.stories.tsx +218 -0
  491. package/toggle-group/ToggleGroup.test.d.ts +1 -0
  492. package/toggle-group/ToggleGroup.test.js +137 -0
  493. package/toggle-group/types.d.ts +114 -0
  494. package/toggle-group/types.js +5 -0
  495. package/typography/Typography.accessibility.test.d.ts +1 -0
  496. package/typography/Typography.accessibility.test.js +339 -0
  497. package/typography/Typography.d.ts +4 -0
  498. package/typography/Typography.js +23 -0
  499. package/typography/Typography.stories.tsx +196 -0
  500. package/typography/types.d.ts +18 -0
  501. package/typography/types.js +5 -0
  502. package/useTheme.d.ts +1145 -0
  503. package/{dist/useTheme.js → useTheme.js} +4 -11
  504. package/useTranslatedLabels.d.ts +85 -0
  505. package/useTranslatedLabels.js +14 -0
  506. package/utils/BaseTypography.d.ts +21 -0
  507. package/utils/BaseTypography.js +94 -0
  508. package/utils/FocusLock.d.ts +13 -0
  509. package/utils/FocusLock.js +125 -0
  510. package/wizard/Wizard.accessibility.test.d.ts +1 -0
  511. package/wizard/Wizard.accessibility.test.js +55 -0
  512. package/wizard/Wizard.d.ts +4 -0
  513. package/wizard/Wizard.js +239 -0
  514. package/wizard/Wizard.stories.tsx +272 -0
  515. package/wizard/Wizard.test.d.ts +1 -0
  516. package/wizard/Wizard.test.js +114 -0
  517. package/wizard/types.d.ts +64 -0
  518. package/wizard/types.js +5 -0
  519. package/babel.config.js +0 -8
  520. package/dist/BackgroundColorContext.js +0 -46
  521. package/dist/ThemeContext.js +0 -250
  522. package/dist/V3Select/V3Select.js +0 -549
  523. package/dist/V3Select/index.d.ts +0 -27
  524. package/dist/V3Textarea/V3Textarea.js +0 -264
  525. package/dist/V3Textarea/index.d.ts +0 -27
  526. package/dist/accordion/Accordion.js +0 -353
  527. package/dist/accordion/index.d.ts +0 -28
  528. package/dist/accordion-group/AccordionGroup.js +0 -186
  529. package/dist/accordion-group/index.d.ts +0 -16
  530. package/dist/alert/Alert.js +0 -403
  531. package/dist/alert/index.d.ts +0 -51
  532. package/dist/badge/Badge.js +0 -63
  533. package/dist/box/Box.js +0 -156
  534. package/dist/box/index.d.ts +0 -25
  535. package/dist/button/Button.js +0 -238
  536. package/dist/button/index.d.ts +0 -24
  537. package/dist/card/Card.js +0 -254
  538. package/dist/card/index.d.ts +0 -22
  539. package/dist/checkbox/Checkbox.js +0 -299
  540. package/dist/checkbox/index.d.ts +0 -24
  541. package/dist/chip/Chip.js +0 -265
  542. package/dist/chip/index.d.ts +0 -22
  543. package/dist/common/OpenSans.css +0 -81
  544. package/dist/common/RequiredComponent.js +0 -40
  545. package/dist/common/fonts/OpenSans-Bold.ttf +0 -0
  546. package/dist/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  547. package/dist/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  548. package/dist/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  549. package/dist/common/fonts/OpenSans-Italic.ttf +0 -0
  550. package/dist/common/fonts/OpenSans-Light.ttf +0 -0
  551. package/dist/common/fonts/OpenSans-LightItalic.ttf +0 -0
  552. package/dist/common/fonts/OpenSans-Regular.ttf +0 -0
  553. package/dist/common/fonts/OpenSans-SemiBold.ttf +0 -0
  554. package/dist/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  555. package/dist/common/variables.js +0 -1574
  556. package/dist/date/Date.js +0 -379
  557. package/dist/date/index.d.ts +0 -27
  558. package/dist/date-input/DateInput.js +0 -400
  559. package/dist/date-input/index.d.ts +0 -95
  560. package/dist/dialog/Dialog.js +0 -218
  561. package/dist/dialog/index.d.ts +0 -18
  562. package/dist/dropdown/Dropdown.js +0 -544
  563. package/dist/dropdown/index.d.ts +0 -26
  564. package/dist/file-input/FileInput.js +0 -644
  565. package/dist/file-input/FileItem.js +0 -287
  566. package/dist/file-input/index.d.ts +0 -81
  567. package/dist/footer/Footer.js +0 -421
  568. package/dist/footer/Icons.js +0 -77
  569. package/dist/footer/index.d.ts +0 -25
  570. package/dist/header/Header.js +0 -470
  571. package/dist/header/index.d.ts +0 -25
  572. package/dist/heading/index.d.ts +0 -17
  573. package/dist/input-text/Icons.js +0 -22
  574. package/dist/input-text/InputText.js +0 -705
  575. package/dist/input-text/index.d.ts +0 -36
  576. package/dist/layout/ApplicationLayout.js +0 -327
  577. package/dist/layout/Icons.js +0 -55
  578. package/dist/link/Link.js +0 -237
  579. package/dist/link/index.d.ts +0 -23
  580. package/dist/main.d.ts +0 -40
  581. package/dist/number-input/NumberInput.js +0 -136
  582. package/dist/number-input/NumberInputContext.js +0 -16
  583. package/dist/number-input/index.d.ts +0 -113
  584. package/dist/paginator/Icons.js +0 -66
  585. package/dist/paginator/Paginator.js +0 -305
  586. package/dist/paginator/index.d.ts +0 -20
  587. package/dist/password-input/PasswordInput.js +0 -203
  588. package/dist/password-input/index.d.ts +0 -94
  589. package/dist/progress-bar/ProgressBar.js +0 -242
  590. package/dist/progress-bar/index.d.ts +0 -18
  591. package/dist/radio/Radio.js +0 -209
  592. package/dist/radio/index.d.ts +0 -23
  593. package/dist/resultsetTable/ResultsetTable.js +0 -358
  594. package/dist/resultsetTable/index.d.ts +0 -19
  595. package/dist/select/Select.js +0 -1096
  596. package/dist/select/index.d.ts +0 -53
  597. package/dist/sidenav/Sidenav.js +0 -179
  598. package/dist/sidenav/index.d.ts +0 -13
  599. package/dist/slider/Slider.js +0 -404
  600. package/dist/slider/index.d.ts +0 -29
  601. package/dist/spinner/Spinner.js +0 -381
  602. package/dist/spinner/index.d.ts +0 -17
  603. package/dist/switch/Switch.js +0 -222
  604. package/dist/switch/index.d.ts +0 -24
  605. package/dist/table/Table.js +0 -132
  606. package/dist/table/index.d.ts +0 -13
  607. package/dist/tabs/Tabs.js +0 -343
  608. package/dist/tabs/index.d.ts +0 -19
  609. package/dist/tag/Tag.js +0 -282
  610. package/dist/tag/index.d.ts +0 -24
  611. package/dist/text-input/TextInput.js +0 -974
  612. package/dist/text-input/index.d.ts +0 -135
  613. package/dist/textarea/Textarea.js +0 -369
  614. package/dist/textarea/index.d.ts +0 -117
  615. package/dist/toggle/Toggle.js +0 -220
  616. package/dist/toggle/index.d.ts +0 -21
  617. package/dist/toggle-group/ToggleGroup.js +0 -327
  618. package/dist/toggle-group/index.d.ts +0 -21
  619. package/dist/upload/Upload.js +0 -205
  620. package/dist/upload/buttons-upload/ButtonsUpload.js +0 -135
  621. package/dist/upload/buttons-upload/Icons.js +0 -40
  622. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  623. package/dist/upload/dragAndDropArea/Icons.js +0 -39
  624. package/dist/upload/file-upload/FileToUpload.js +0 -189
  625. package/dist/upload/file-upload/Icons.js +0 -66
  626. package/dist/upload/files-upload/FilesToUpload.js +0 -123
  627. package/dist/upload/index.d.ts +0 -15
  628. package/dist/upload/transaction/Icons.js +0 -160
  629. package/dist/upload/transaction/Transaction.js +0 -148
  630. package/dist/upload/transactions/Transactions.js +0 -138
  631. package/dist/wizard/Icons.js +0 -65
  632. package/dist/wizard/Wizard.js +0 -405
  633. package/dist/wizard/index.d.ts +0 -18
  634. package/test/Accordion.test.js +0 -33
  635. package/test/AccordionGroup.test.js +0 -125
  636. package/test/Alert.test.js +0 -53
  637. package/test/Box.test.js +0 -10
  638. package/test/Button.test.js +0 -18
  639. package/test/Card.test.js +0 -30
  640. package/test/Checkbox.test.js +0 -45
  641. package/test/Chip.test.js +0 -25
  642. package/test/Date.test.js +0 -395
  643. package/test/DateInput.test.js +0 -242
  644. package/test/Dialog.test.js +0 -23
  645. package/test/Dropdown.test.js +0 -145
  646. package/test/FileInput.test.js +0 -201
  647. package/test/Footer.test.js +0 -94
  648. package/test/Header.test.js +0 -34
  649. package/test/Heading.test.js +0 -83
  650. package/test/InputText.test.js +0 -240
  651. package/test/Link.test.js +0 -43
  652. package/test/NumberInput.test.js +0 -259
  653. package/test/Paginator.test.js +0 -181
  654. package/test/PasswordInput.test.js +0 -83
  655. package/test/ProgressBar.test.js +0 -35
  656. package/test/Radio.test.js +0 -37
  657. package/test/ResultsetTable.test.js +0 -330
  658. package/test/Select.test.js +0 -415
  659. package/test/Sidenav.test.js +0 -45
  660. package/test/Slider.test.js +0 -74
  661. package/test/Spinner.test.js +0 -32
  662. package/test/Switch.test.js +0 -45
  663. package/test/Table.test.js +0 -36
  664. package/test/Tabs.test.js +0 -109
  665. package/test/Tag.test.js +0 -32
  666. package/test/TextInput.test.js +0 -732
  667. package/test/Textarea.test.js +0 -193
  668. package/test/ToggleGroup.test.js +0 -85
  669. package/test/Upload.test.js +0 -60
  670. package/test/V3Select.test.js +0 -212
  671. package/test/V3TextArea.test.js +0 -51
  672. package/test/Wizard.test.js +0 -130
  673. package/test/mocks/pngMock.js +0 -1
  674. package/test/mocks/svgMock.js +0 -1
@@ -1,415 +0,0 @@
1
- import React from "react";
2
- import DxcSelect from "../src/select/Select";
3
- import { render, fireEvent } from "@testing-library/react";
4
- import userEvent from "@testing-library/user-event";
5
-
6
- const single_options = [
7
- { label: "Option 01", value: "1" },
8
- { label: "Option 02", value: "2" },
9
- { label: "Option 03", value: "3" },
10
- { label: "Option 04", value: "4" },
11
- { label: "Option 05", value: "5" },
12
- { label: "Option 06", value: "6" },
13
- { label: "Option 07", value: "7" },
14
- { label: "Option 08", value: "8" },
15
- { label: "Option 09", value: "9" },
16
- { label: "Option 10", value: "10" },
17
- { label: "Option 11", value: "11" },
18
- { label: "Option 12", value: "12" },
19
- { label: "Option 13", value: "13" },
20
- { label: "Option 14", value: "14" },
21
- { label: "Option 15", value: "15" },
22
- { label: "Option 16", value: "16" },
23
- { label: "Option 17", value: "17" },
24
- { label: "Option 18", value: "18" },
25
- { label: "Option 19", value: "19" },
26
- { label: "Option 20", value: "20" },
27
- ];
28
-
29
- const group_options = [
30
- {
31
- label: "Group 1",
32
- options: [
33
- { label: "Option 001", value: "1" },
34
- { label: "Option 002", value: "2" },
35
- { label: "Option 003", value: "3" },
36
- ],
37
- },
38
- {
39
- label: "Group 2",
40
- options: [
41
- { label: "Option 0004", value: "4" },
42
- { label: "Option 05", value: "5" },
43
- { label: "Option 006", value: "6" },
44
- ],
45
- },
46
- {
47
- label: "Group 3",
48
- options: [
49
- { label: "Option 0007", value: "7" },
50
- { label: "Option 008", value: "8" },
51
- { label: "Option 9", value: "9" },
52
- ],
53
- },
54
- {
55
- label: "Group 4",
56
- options: [
57
- { label: "Option 10", value: "10" },
58
- { label: "Option 11", value: "11" },
59
- { label: "Option 12", value: "12" },
60
- ],
61
- },
62
- {
63
- label: "Group 5",
64
- options: [
65
- { label: "Option x", value: "13" },
66
- { label: "Option y", value: "14" },
67
- { label: "Option z", value: "15" },
68
- ],
69
- },
70
- {
71
- label: "Group 6",
72
- options: [
73
- { label: "Option 001", value: "16" },
74
- { label: "Option 002", value: "17" },
75
- { label: "Option 003", value: "18" },
76
- ],
77
- },
78
- {
79
- label: "Group 7",
80
- options: [
81
- { label: "Option 001", value: "19" },
82
- { label: "Option 002", value: "20" },
83
- { label: "Option 003", value: "21" },
84
- ],
85
- },
86
- ];
87
-
88
- describe("Select component tests", () => {
89
- test("Renders with correct label, helper text and placeholder", () => {
90
- const { getByText } = render(
91
- <DxcSelect label="test-select-label" helperText="test-select-helper-text" placeholder="Example text" />
92
- );
93
-
94
- expect(getByText("test-select-label")).toBeTruthy();
95
- expect(getByText("test-select-helper-text")).toBeTruthy();
96
- expect(getByText("Example text")).toBeTruthy();
97
- });
98
- test("Renders with correct optional label", () => {
99
- const { getByText } = render(<DxcSelect label="test-select-label" optional />);
100
-
101
- expect(getByText("test-select-label")).toBeTruthy();
102
- expect(getByText("(Optional)")).toBeTruthy();
103
- });
104
- test("Renders with error message", () => {
105
- const { getByText, getByRole } = render(<DxcSelect label="test-select-label" error="Error message." />);
106
- const select = getByRole("combobox");
107
-
108
- expect(getByText("Error message.")).toBeTruthy();
109
- expect(select.getAttribute("aria-invalid")).toBe("true");
110
- });
111
- test("Disabled select - Clear all options action must be shown but not clickable", () => {
112
- const { getByRole, getByText, queryByRole } = render(
113
- <DxcSelect label="test-select-label" value={["1", "2"]} options={single_options} disabled searchable multiple />
114
- );
115
- const select = getByRole("combobox");
116
-
117
- userEvent.click(select);
118
- expect(queryByRole("listbox")).toBeFalsy();
119
- userEvent.click(getByRole("button"));
120
- expect(getByText("Option 01, Option 02")).toBeTruthy();
121
- });
122
- test("Focused select does not open the listbox", () => {
123
- const { getByRole, queryByRole } = render(
124
- <DxcSelect label="test-select-label" value={["1", "2"]} options={single_options} disabled searchable multiple />
125
- );
126
- const select = getByRole("combobox");
127
-
128
- fireEvent.focus(select);
129
- expect(queryByRole("listbox")).toBeFalsy();
130
- });
131
- test("Controlled - Not optional constraint", () => {
132
- // scrollIntoView & scrollTo are not implemented in jsdom
133
- window.HTMLElement.prototype.scrollIntoView = () => {};
134
- window.HTMLElement.prototype.scrollTo = () => {};
135
- const onChange = jest.fn();
136
- const onBlur = jest.fn();
137
- const { getByRole, getAllByRole } = render(
138
- <DxcSelect label="test-select-label" options={single_options} onChange={onChange} onBlur={onBlur} />
139
- );
140
- const select = getByRole("combobox");
141
-
142
- expect(select.getAttribute("aria-required")).toBe("true");
143
- fireEvent.focus(select);
144
- fireEvent.blur(select);
145
- expect(onBlur).toHaveBeenCalled();
146
- expect(onBlur).toHaveBeenCalledWith({ value: "", error: "This field is required. Please, enter a value." });
147
- userEvent.click(select);
148
- userEvent.click(getAllByRole("option")[0]);
149
- expect(onChange).toHaveBeenCalled();
150
- expect(onChange).toHaveBeenCalledWith({ value: "1", error: null });
151
- fireEvent.focus(select);
152
- fireEvent.blur(select);
153
- expect(onBlur).toHaveBeenCalled();
154
- expect(onBlur).toHaveBeenCalledWith({ value: "1", error: null });
155
- });
156
- test("Controlled - Optional constraint", () => {
157
- window.HTMLElement.prototype.scrollIntoView = () => {};
158
- window.HTMLElement.prototype.scrollTo = () => {};
159
- const onChange = jest.fn();
160
- const onBlur = jest.fn();
161
- const { getByRole } = render(
162
- <DxcSelect label="test-select-label" options={single_options} onChange={onChange} onBlur={onBlur} optional />
163
- );
164
- const select = getByRole("combobox");
165
-
166
- expect(select.getAttribute("aria-required")).toBe("false");
167
- fireEvent.focus(select);
168
- fireEvent.blur(select);
169
- expect(onBlur).toHaveBeenCalled();
170
- expect(onBlur).toHaveBeenCalledWith({ value: "", error: null });
171
- expect(select.getAttribute("aria-invalid")).toBe("false");
172
- });
173
- test("Non-Grouped Options - Opens listbox or closes it with a click on select", () => {
174
- window.HTMLElement.prototype.scrollIntoView = () => {};
175
- window.HTMLElement.prototype.scrollTo = () => {};
176
- const { getByText, getByRole, queryByRole } = render(
177
- <DxcSelect label="test-select-label" options={single_options} />
178
- );
179
- const select = getByRole("combobox");
180
-
181
- userEvent.click(select);
182
- expect(getByRole("listbox")).toBeTruthy();
183
- expect(select.getAttribute("aria-expanded")).toBe("true");
184
- expect(getByText("Option 01")).toBeTruthy();
185
- expect(getByText("Option 02")).toBeTruthy();
186
- expect(getByText("Option 08")).toBeTruthy();
187
- expect(getByText("Option 09")).toBeTruthy();
188
- userEvent.click(select);
189
- expect(queryByRole("listbox")).toBeFalsy();
190
- expect(select.getAttribute("aria-expanded")).toBe("false");
191
- });
192
- test("Non-Grouped Options - If an empty list of options is passed, the select is rendered but doestn't open the listbox", () => {
193
- window.HTMLElement.prototype.scrollIntoView = () => {};
194
- window.HTMLElement.prototype.scrollTo = () => {};
195
- const { getByRole, queryByRole } = render(<DxcSelect label="test-select-label" options={[]} />);
196
- const select = getByRole("combobox");
197
-
198
- userEvent.click(select);
199
- expect(queryByRole("listbox")).toBeFalsy();
200
- expect(select.getAttribute("aria-expanded")).toBe("false");
201
- });
202
- test("Non-Grouped Options - Click in an option selects it and closes the listbox", () => {
203
- window.HTMLElement.prototype.scrollIntoView = () => {};
204
- window.HTMLElement.prototype.scrollTo = () => {};
205
- const onChange = jest.fn();
206
- const { getByText, getByRole, getAllByRole, queryByRole } = render(
207
- <DxcSelect label="test-select-label" options={single_options} onChange={onChange} />
208
- );
209
- const select = getByRole("combobox");
210
-
211
- userEvent.click(select);
212
- userEvent.click(getAllByRole("option")[2]);
213
- expect(onChange).toHaveBeenCalledWith({ value: "3", error: null });
214
- expect(queryByRole("listbox")).toBeFalsy();
215
- expect(getByText("Option 03")).toBeTruthy();
216
- userEvent.click(select);
217
- expect(getAllByRole("option")[2].getAttribute("aria-selected")).toBe("true");
218
- });
219
- test("Non-Grouped Options - Optional renders an empty first option with the placeholder as its label", () => {
220
- window.HTMLElement.prototype.scrollIntoView = () => {};
221
- window.HTMLElement.prototype.scrollTo = () => {};
222
- const onChange = jest.fn();
223
- const { getByRole, getAllByRole, getAllByText } = render(
224
- <DxcSelect
225
- label="test-select-label"
226
- placeholder="Choose an option"
227
- options={single_options}
228
- onChange={onChange}
229
- optional
230
- />
231
- );
232
- const select = getByRole("combobox");
233
-
234
- userEvent.click(select);
235
- expect(getAllByText("Choose an option").length).toBe(2);
236
- expect(getAllByRole("option")[0].getAttribute("aria-selected")).toBe("true");
237
- userEvent.click(getAllByRole("option")[0]);
238
- expect(onChange).toHaveBeenCalledWith({ value: "", error: null });
239
- expect(getAllByText("Choose an option").length).toBe(1);
240
- });
241
- test("Non-Grouped Options: Arrow up key - Opens the listbox and visually focus the last option", () => {
242
- window.HTMLElement.prototype.scrollIntoView = () => {};
243
- window.HTMLElement.prototype.scrollTo = () => {};
244
- const { getByRole, queryByRole } = render(
245
- <DxcSelect label="test-select-label" options={single_options} />
246
- );
247
- const select = getByRole("combobox");
248
-
249
- fireEvent.keyDown(select, { key: "ArrowUp", code: "ArrowUp", keyCode: 38, charCode: 38 });
250
- expect(queryByRole("listbox")).toBeTruthy();
251
- expect(select.getAttribute("aria-activedescendant")).toBe("option-19");
252
- });
253
- test("Non-Grouped Options: Arrow up key - Puts the focus in last option when the first one is visually focused", () => {
254
- window.HTMLElement.prototype.scrollIntoView = () => {};
255
- window.HTMLElement.prototype.scrollTo = () => {};
256
- const { getByRole, queryByRole } = render(
257
- <DxcSelect label="test-select-label" options={single_options} />
258
- );
259
- const select = getByRole("combobox");
260
-
261
- fireEvent.keyDown(select, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
262
- fireEvent.keyDown(select, { key: "ArrowUp", code: "ArrowUp", keyCode: 38, charCode: 38 });
263
- expect(queryByRole("listbox")).toBeTruthy();
264
- expect(select.getAttribute("aria-activedescendant")).toBe("option-19");
265
- });
266
- test("Non-Grouped Options: Arrow down key - Opens the listbox and visually focus the first option", () => {
267
- window.HTMLElement.prototype.scrollIntoView = () => {};
268
- window.HTMLElement.prototype.scrollTo = () => {};
269
- const { getByRole, queryByRole } = render(
270
- <DxcSelect label="test-select-label" options={single_options} />
271
- );
272
- const select = getByRole("combobox");
273
-
274
- fireEvent.keyDown(select, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
275
- expect(queryByRole("listbox")).toBeTruthy();
276
- expect(select.getAttribute("aria-activedescendant")).toBe("option-0");
277
- });
278
- test("Non-Grouped Options: Arrow down key - Puts the focus in the first option when the last one is visually focused", () => {
279
- window.HTMLElement.prototype.scrollIntoView = () => {};
280
- window.HTMLElement.prototype.scrollTo = () => {};
281
- const { getByRole, queryByRole } = render(
282
- <DxcSelect label="test-select-label" options={single_options} />
283
- );
284
- const select = getByRole("combobox");
285
-
286
- fireEvent.keyDown(select, { key: "ArrowUp", code: "ArrowUp", keyCode: 38, charCode: 38 });
287
- fireEvent.keyDown(select, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
288
- expect(queryByRole("listbox")).toBeTruthy();
289
- expect(select.getAttribute("aria-activedescendant")).toBe("option-0");
290
- });
291
- test("Non-Grouped Options: Enter key - Selects the visually focused option and closes the listbox", () => {
292
- window.HTMLElement.prototype.scrollIntoView = () => {};
293
- window.HTMLElement.prototype.scrollTo = () => {};
294
- const onChange = jest.fn();
295
- const { getByText, getByRole, getAllByRole, queryByRole } = render(
296
- <DxcSelect label="test-select-label" options={single_options} onChange={onChange} />
297
- );
298
- const select = getByRole("combobox");
299
-
300
- fireEvent.keyDown(select, { key: "ArrowUp", code: "ArrowUp", keyCode: 38, charCode: 38 });
301
- fireEvent.keyDown(select, { key: "ArrowUp", code: "ArrowUp", keyCode: 38, charCode: 38 });
302
- fireEvent.keyDown(select, { key: "ArrowUp", code: "ArrowUp", keyCode: 38, charCode: 38 });
303
- fireEvent.keyDown(select, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
304
- fireEvent.keyDown(select, { key: "Enter", code: "Enter", keyCode: 13, charCode: 13 });
305
- expect(onChange).toHaveBeenCalledWith({ value: "19", error: null });
306
- expect(queryByRole("listbox")).toBeFalsy();
307
- expect(getByText("Option 19")).toBeTruthy();
308
- userEvent.click(select);
309
- expect(getAllByRole("option")[18].getAttribute("aria-selected")).toBe("true");
310
- });
311
- test("Non-Grouped Options: Searchable - Displays an input for filtering the list of options", () => {
312
- window.HTMLElement.prototype.scrollIntoView = () => {};
313
- window.HTMLElement.prototype.scrollTo = () => {};
314
- const onChange = jest.fn();
315
- const { container, getByText, getByRole, getAllByRole, queryByRole } = render(
316
- <DxcSelect label="test-select-label" options={single_options} onChange={onChange} searchable />
317
- );
318
- const select = getByRole("combobox");
319
- const searchInput = container.querySelectorAll("input")[1];
320
-
321
- userEvent.click(select);
322
- expect(getByRole("listbox")).toBeTruthy();
323
- userEvent.type(searchInput, "08");
324
- userEvent.click(getByRole("option"));
325
- expect(onChange).toHaveBeenCalledWith({ value: "8", error: null });
326
- expect(queryByRole("listbox")).toBeFalsy();
327
- expect(getByText("Option 08")).toBeTruthy();
328
- expect(searchInput.value).toBe("");
329
- userEvent.click(select);
330
- expect(getAllByRole("option")[7].getAttribute("aria-selected")).toBe("true");
331
- });
332
- test("Non-Grouped Options: Searchable - Displays 'No matches found' when there are no filtering results", () => {
333
- window.HTMLElement.prototype.scrollIntoView = () => {};
334
- window.HTMLElement.prototype.scrollTo = () => {};
335
- const onChange = jest.fn();
336
- const { container, getByText, getByRole } = render(
337
- <DxcSelect label="test-select-label" options={single_options} onChange={onChange} searchable />
338
- );
339
- const select = getByRole("combobox");
340
- const searchInput = container.querySelectorAll("input")[1];
341
-
342
- userEvent.click(select);
343
- expect(getByRole("listbox")).toBeTruthy();
344
- userEvent.type(searchInput, "abc");
345
- expect(getByText("No matches found")).toBeTruthy();
346
- });
347
- test("Non-Grouped Options: Searchable - Clicking the select, when the list is open, clears the search value", () => {
348
- window.HTMLElement.prototype.scrollIntoView = () => {};
349
- window.HTMLElement.prototype.scrollTo = () => {};
350
- const onChange = jest.fn();
351
- const { container, getByText, getByRole, getAllByRole } = render(
352
- <DxcSelect label="test-select-label" options={single_options} onChange={onChange} searchable />
353
- );
354
- const select = getByRole("combobox");
355
- const searchInput = container.querySelectorAll("input")[1];
356
-
357
- userEvent.click(select);
358
- expect(getByRole("listbox")).toBeTruthy();
359
- userEvent.type(searchInput, "2");
360
- expect(getByText("Option 02")).toBeTruthy();
361
- expect(getByText("Option 12")).toBeTruthy();
362
- expect(getByText("Option 20")).toBeTruthy();
363
- expect(getAllByRole("option").length).toBe(3);
364
- userEvent.click(select);
365
- expect(searchInput.value).toBe("");
366
- });
367
- test("Non-Grouped Options: Searchable - Writing displays the listbox, if was not open", () => {
368
- window.HTMLElement.prototype.scrollIntoView = () => {};
369
- window.HTMLElement.prototype.scrollTo = () => {};
370
- const onChange = jest.fn();
371
- const { container, getByRole, queryByRole } = render(
372
- <DxcSelect label="test-select-label" options={single_options} onChange={onChange} searchable />
373
- );
374
- const select = getByRole("combobox");
375
- const searchInput = container.querySelectorAll("input")[1];
376
-
377
- userEvent.click(select);
378
- userEvent.click(select);
379
- expect(queryByRole("listbox")).toBeFalsy();
380
- userEvent.type(searchInput, "2");
381
- expect(getByRole("listbox")).toBeTruthy();
382
- });
383
- test("Non-Grouped Options: Searchable - Key Esc cleans the search value and closes the options", () => {
384
- window.HTMLElement.prototype.scrollIntoView = () => {};
385
- window.HTMLElement.prototype.scrollTo = () => {};
386
- const onChange = jest.fn();
387
- const { container, getByRole, queryByRole } = render(
388
- <DxcSelect label="test-select-label" options={single_options} onChange={onChange} searchable />
389
- );
390
- const select = getByRole("combobox");
391
- const searchInput = container.querySelectorAll("input")[1];
392
-
393
- userEvent.type(searchInput, "Option 02");
394
- fireEvent.keyDown(select, { key: "Esc", code: "Esc", keyCode: 27, charCode: 27 });
395
- expect(searchInput.value).toBe("");
396
- expect(queryByRole("listbox")).toBeFalsy();
397
- });
398
- test("Non-Grouped Options: Searchable - While user types, a clear action is displayed for cleaning the search value", () => {
399
- window.HTMLElement.prototype.scrollIntoView = () => {};
400
- window.HTMLElement.prototype.scrollTo = () => {};
401
- const onChange = jest.fn();
402
- const { container, getByRole, getAllByRole } = render(
403
- <DxcSelect label="test-select-label" options={single_options} onChange={onChange} searchable />
404
- );
405
- const searchInput = container.querySelectorAll("input")[1];
406
-
407
- userEvent.type(searchInput, "Option 02");
408
- expect(getAllByRole("option").length).toBe(1);
409
- const clearAction = getByRole("button");
410
- expect(clearAction).toBeTruthy();
411
- userEvent.click(clearAction);
412
- expect(getByRole("listbox")).toBeTruthy();
413
- expect(getAllByRole("option").length).toBe(20);
414
- });
415
- });
@@ -1,45 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent } from "@testing-library/react";
3
- import DxcSidenav from "../src/sidenav/Sidenav";
4
-
5
- const navContent = <p>nav-content-test</p>;
6
-
7
- describe("Sidenav component tests", () => {
8
- test("Sidenav renders nav content", () => {
9
- const { getByText } = render(<DxcSidenav>{navContent}</DxcSidenav>);
10
- expect(getByText("nav-content-test")).toBeTruthy();
11
- });
12
-
13
- test("Sidenav renders nav and page content in mobile version", () => {
14
- //425 is mobile width
15
- Object.defineProperty(HTMLElement.prototype, "offsetWidth", { configurable: true, value: 425 });
16
- const { getByText } = render(<DxcSidenav>{navContent}</DxcSidenav>);
17
- expect(getByText("nav-content-test")).toBeTruthy();
18
- });
19
-
20
- test("Sidenav renders compound components", () => {
21
- const { getByText } = render(
22
- <DxcSidenav>
23
- <DxcSidenav.Title>test-title</DxcSidenav.Title>
24
- <DxcSidenav.Subtitle>test-subtitle</DxcSidenav.Subtitle>
25
- <DxcSidenav.Link href="#">test-link</DxcSidenav.Link>
26
- </DxcSidenav>
27
- );
28
- expect(getByText("test-title")).toBeTruthy();
29
- expect(getByText("test-subtitle")).toBeTruthy();
30
- expect(getByText("test-link")).toBeTruthy();
31
- });
32
-
33
- test("Sidenav link onClick", () => {
34
- const onClick = jest.fn();
35
- const { getByText } = render(
36
- <DxcSidenav>
37
- <DxcSidenav.Link onClick={onClick}>test-link</DxcSidenav.Link>
38
- </DxcSidenav>
39
- );
40
-
41
- const link = getByText("test-link");
42
- fireEvent.click(link);
43
- expect(onClick).toHaveBeenCalled();
44
- });
45
- });
@@ -1,74 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent, act } from "@testing-library/react";
3
- import DxcSlider from "../src/slider/Slider";
4
-
5
- describe("Slider component tests", () => {
6
- test("Slider renders with correct text", () => {
7
- const { getByText } = render(<DxcSlider minValue={0} maxValue={100} showLimitsValues />);
8
- expect(getByText("0")).toBeTruthy();
9
- expect(getByText("100")).toBeTruthy();
10
- });
11
-
12
- test("Calls correct function onChange in controlled slider", () => {
13
- const onChange = jest.fn();
14
- const { getByRole } = render(
15
- <DxcSlider minValue={0} maxValue={100} onChange={onChange} showLimitsValues value={13} showInput />
16
- );
17
- act(() => {
18
- fireEvent.change(getByRole("textbox"), { target: { value: 25 } });
19
- });
20
- expect(onChange).toHaveBeenCalledWith(25);
21
- });
22
-
23
- test("Calls correct function onChange in uncontrolled slider", () => {
24
- const onChange = jest.fn();
25
- const { getByRole } = render(
26
- <DxcSlider minValue={0} maxValue={100} onChange={onChange} showLimitsValues showInput />
27
- );
28
- act(() => {
29
- fireEvent.change(getByRole("textbox"), { target: { value: 25 } });
30
- });
31
- expect(onChange).toHaveBeenCalledWith(25);
32
- });
33
-
34
- test("Disabled slider have disabled input", () => {
35
- const onChange = jest.fn();
36
- const { getByRole } = render(
37
- <DxcSlider minValue={0} maxValue={100} onChange={onChange} showLimitsValues disabled showInput value={13} />
38
- );
39
- act(() => {
40
- fireEvent.change(getByRole("textbox"), { target: { value: 25 } });
41
- });
42
- expect(getByRole("textbox").hasAttribute("disabled")).toBeTruthy();
43
- expect(getByRole("textbox").value).toBe("13");
44
- });
45
-
46
- test("Calls correct function onDragEnd", () => {
47
- const onDragEnd = jest.fn();
48
- const { getByRole } = render(
49
- <DxcSlider minValue={0} maxValue={100} showLimitsValues showInput onDragEnd={onDragEnd} value={25} />
50
- );
51
- act(() => {
52
- fireEvent.mouseDown(getByRole("slider"));
53
- fireEvent.mouseUp(getByRole("slider"));
54
- });
55
- expect(onDragEnd).toHaveBeenCalled();
56
- });
57
-
58
- test("Calls correct function labelFormatCallback", () => {
59
- const labelFormatCallback = jest.fn((x) => `${x}$`);
60
- const { getByText } = render(
61
- <DxcSlider
62
- minValue={0}
63
- maxValue={100}
64
- showLimitsValues
65
- showInput
66
- value={25}
67
- labelFormatCallback={labelFormatCallback}
68
- />
69
- );
70
- expect(getByText("0$")).toBeTruthy();
71
- expect(getByText("100$")).toBeTruthy();
72
- expect(labelFormatCallback).toHaveBeenCalledTimes(2);
73
- });
74
- });
@@ -1,32 +0,0 @@
1
- import React from "react";
2
- import { render } from "@testing-library/react";
3
- import DxcSpinner from "../src/spinner/Spinner";
4
-
5
- describe("Spinner component tests", () => {
6
- test("Spinner renders with correct label", () => {
7
- const { getByText } = render(<DxcSpinner label="test-loading"></DxcSpinner>);
8
- expect(getByText("test-loading")).toBeTruthy();
9
- });
10
-
11
- test("Spinner shows value correctly", () => {
12
- const { getByText } = render(<DxcSpinner label="test-loading" value={75} showValue></DxcSpinner>);
13
- expect(getByText("75%")).toBeTruthy();
14
- });
15
-
16
- test("Small spinner hides value and label correctly", () => {
17
- const { queryByText } = render(<DxcSpinner mode="small" label="test-loading" value={75} showValue></DxcSpinner>);
18
- expect(queryByText("test-loading")).toBeFalsy();
19
- expect(queryByText("75%")).toBeFalsy();
20
- });
21
-
22
- test("Overlay spinner shows value and label correctly", () => {
23
- const { getByText } = render(<DxcSpinner mode="overlay" label="test-loading" value={75} showValue></DxcSpinner>);
24
- expect(getByText("test-loading")).toBeTruthy();
25
- expect(getByText("75%")).toBeTruthy();
26
- });
27
-
28
- test("Get spinner by role", () => {
29
- const { getByRole } = render(<DxcSpinner label="test-loading" value={75} showValue></DxcSpinner>);
30
- expect(getByRole("progressbar")).toBeTruthy();
31
- });
32
- });
@@ -1,45 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent } from "@testing-library/react";
3
- import DxcSwitch from "../src/switch/Switch";
4
-
5
- describe("Switch component tests", () => {
6
- test("Switch renders with correct text", () => {
7
- const onChange = jest.fn((returnedValue) => {
8
- expect(returnedValue).toBe(true);
9
- });
10
-
11
- const { getByText } = render(<DxcSwitch label={"SwitchComponent"} checked={false} onChange={onChange} />);
12
- expect(getByText("SwitchComponent")).toBeTruthy();
13
- });
14
-
15
- test("Calls correct function on click", () => {
16
- const onChange = jest.fn();
17
- const { getByText } = render(<DxcSwitch label={"SwitchComponent"} checked={false} onChange={onChange} />);
18
-
19
- fireEvent.click(getByText("SwitchComponent"));
20
- expect(onChange).toHaveBeenCalled();
21
- });
22
-
23
- test("Everytime the user clicks the component the onchange function is called with the correct value CONTROLLED COMPONENT", () => {
24
- const onChange = jest.fn();
25
-
26
- const { getByText } = render(<DxcSwitch label={"SwitchComponent"} checked={false} onChange={onChange} />);
27
-
28
- fireEvent.click(getByText("SwitchComponent"));
29
- fireEvent.click(getByText("SwitchComponent"));
30
- expect(onChange.mock.calls[0][0]).toBe(true);
31
- expect(onChange.mock.calls[1][0]).toBe(true);
32
- });
33
-
34
-
35
- test("Everytime the user clicks the component the onchange function is called with the correct value UNCONTROLLED COMPONENT", () => {
36
- const onChange = jest.fn();
37
-
38
- const { getByText } = render(<DxcSwitch label={"SwitchComponent"} onChange={onChange} />);
39
-
40
- fireEvent.click(getByText("SwitchComponent"));
41
- fireEvent.click(getByText("SwitchComponent"));
42
- expect(onChange.mock.calls[0][0]).toBe(true);
43
- expect(onChange.mock.calls[1][0]).toBe(false);
44
- });
45
- });
@@ -1,36 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent } from "@testing-library/react";
3
- import DxcTable from "../src/table/Table";
4
-
5
- describe("Table component tests", () => {
6
- test("Table renders with correct content", () => {
7
- const { getByText } = render(
8
- <DxcTable>
9
- <tr>
10
- <th>header-1</th>
11
- <th>header-2</th>
12
- <th>header-3</th>
13
- </tr>
14
- <tr>
15
- <td>cell-1</td>
16
- <td>cell-2</td>
17
- <td>cell-3</td>
18
- </tr>
19
- <tr>
20
- <td>cell-4</td>
21
- <td>cell-5</td>
22
- <td>cell-6</td>
23
- </tr>
24
- </DxcTable>
25
- );
26
- expect(getByText("header-1")).toBeTruthy();
27
- expect(getByText("header-2")).toBeTruthy();
28
- expect(getByText("header-3")).toBeTruthy();
29
- expect(getByText("cell-1")).toBeTruthy();
30
- expect(getByText("cell-2")).toBeTruthy();
31
- expect(getByText("cell-3")).toBeTruthy();
32
- expect(getByText("cell-4")).toBeTruthy();
33
- expect(getByText("cell-5")).toBeTruthy();
34
- expect(getByText("cell-6")).toBeTruthy();
35
- });
36
- });