@onewelcome/react-lib-components 2.3.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (602) hide show
  1. package/dist/cjs/Button/BaseButton.module.cjs.js +1 -1
  2. package/dist/cjs/Button/Button.module.cjs.js +1 -1
  3. package/dist/cjs/Button/IconButton.module.cjs.js +1 -1
  4. package/dist/cjs/DataGrid/DataGridBody/DataGridCell.module.cjs.js +1 -1
  5. package/dist/cjs/Form/Fieldset/Fieldset.module.cjs.js +1 -1
  6. package/dist/cjs/Form/FormGroup/FormGroup.cjs.js +1 -1
  7. package/dist/cjs/Form/FormGroup/FormGroup.module.cjs.js +1 -1
  8. package/dist/cjs/Form/FormHelperText/FormHelperText.cjs.js +1 -1
  9. package/dist/cjs/Form/FormHelperText/FormHelperText.module.cjs.js +1 -1
  10. package/dist/cjs/Form/Input/Input.module.cjs.js +1 -1
  11. package/dist/cjs/Form/Select/Option.cjs.js +1 -1
  12. package/dist/cjs/Form/Select/Select.cjs.js +1 -1
  13. package/dist/cjs/Form/Select/Select.module.cjs.js +1 -1
  14. package/dist/cjs/Form/Select/SelectService.cjs.js +1 -1
  15. package/dist/cjs/Form/Textarea/Textarea.module.cjs.js +1 -1
  16. package/dist/cjs/Form/Toggle/Toggle.cjs.js +1 -1
  17. package/dist/cjs/Form/Toggle/Toggle.module.cjs.js +1 -1
  18. package/dist/cjs/Form/Wrapper/InputWrapper/InputWrapper.module.cjs.js +1 -1
  19. package/dist/cjs/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.cjs.js +1 -1
  20. package/dist/cjs/Form/Wrapper/Wrapper/Wrapper.cjs.js +1 -1
  21. package/dist/cjs/Form/Wrapper/Wrapper/Wrapper.module.cjs.js +1 -1
  22. package/dist/cjs/Icon/Icon.cjs.js +1 -1
  23. package/dist/cjs/Icon/Icon.module.cjs.js +1 -1
  24. package/dist/cjs/Link/Link.module.cjs.js +1 -1
  25. package/dist/cjs/Notifications/BaseModal/BaseModal.cjs.js +1 -1
  26. package/dist/cjs/Notifications/BaseModal/BaseModal.module.cjs.js +1 -1
  27. package/dist/cjs/Notifications/BaseModal/BaseModalActions/BaseModalActions.cjs.js +1 -1
  28. package/dist/cjs/Notifications/BaseModal/BaseModalActions/BaseModalActions.module.cjs.js +1 -1
  29. package/dist/cjs/Notifications/BaseModal/BaseModalContent/BaseModalContent.module.cjs.js +1 -1
  30. package/dist/cjs/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.cjs.js +1 -1
  31. package/dist/cjs/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.module.cjs.js +1 -1
  32. package/dist/cjs/Notifications/Dialog/Dialog.cjs.js +1 -1
  33. package/dist/cjs/Notifications/Dialog/Dialog.module.cjs.js +1 -1
  34. package/dist/cjs/Notifications/Dialog/DialogActions/DialogActions.cjs.js +1 -1
  35. package/dist/cjs/Notifications/Dialog/DialogActions/DialogActions.module.cjs.js +1 -1
  36. package/dist/cjs/Notifications/Dialog/DialogTitle/DialogTitle.cjs.js +1 -1
  37. package/dist/cjs/Notifications/Dialog/DialogTitle/DialogTitle.module.cjs.js +1 -1
  38. package/dist/cjs/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.cjs.js +1 -1
  39. package/dist/cjs/Notifications/NotificationProvider/NotificationContext.cjs.js +2 -0
  40. package/dist/cjs/Notifications/NotificationProvider/NotificationContext.cjs.js.map +1 -0
  41. package/dist/cjs/Notifications/NotificationProvider/NotificationService.cjs.js +2 -0
  42. package/dist/cjs/Notifications/NotificationProvider/NotificationService.cjs.js.map +1 -0
  43. package/dist/cjs/Notifications/SlideInModal/SlideInModal.module.cjs.js +1 -1
  44. package/dist/cjs/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.module.cjs.js +1 -1
  45. package/dist/cjs/Notifications/Snackbar/SnackbarItem/SnackbarItem.cjs.js +1 -1
  46. package/dist/cjs/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.cjs.js +1 -1
  47. package/dist/cjs/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.cjs.js +1 -1
  48. package/dist/cjs/Notifications/Snackbar/SnackbarProvider/SnackbarStateProvider.cjs.js +1 -1
  49. package/dist/cjs/Notifications/Snackbar/useSnackbar.cjs.js +1 -1
  50. package/dist/cjs/Pagination/Pagination.cjs.js +1 -1
  51. package/dist/cjs/Pagination/Pagination.module.cjs.js +1 -1
  52. package/dist/cjs/Popover/Popover.cjs.js +1 -1
  53. package/dist/cjs/Popover/Popover.module.cjs.js +1 -1
  54. package/dist/cjs/ProgressBar/ProgressBar.cjs.js +1 -1
  55. package/dist/cjs/ProgressBar/ProgressBar.module.cjs.js +1 -1
  56. package/dist/cjs/Skeleton/Skeleton.module.cjs.js +1 -1
  57. package/dist/cjs/Tabs/Tabs.module.cjs.js +1 -1
  58. package/dist/cjs/Tiles/Tile.module.cjs.js +1 -1
  59. package/dist/cjs/Tooltip/Tooltip.cjs.js +1 -1
  60. package/dist/cjs/Tooltip/Tooltip.module.cjs.js +1 -1
  61. package/dist/cjs/Wizard/WizardActions/WizardActions.cjs.js +1 -1
  62. package/dist/cjs/_BaseStyling_/BaseStyling.cjs.js +1 -1
  63. package/dist/{esm → cjs/src}/components/Form/FormHelperText/FormHelperText.d.ts +1 -0
  64. package/dist/cjs/{components → src/components}/Form/Select/Option.d.ts +2 -2
  65. package/dist/{esm → cjs/src}/components/Form/Select/Select.d.ts +1 -0
  66. package/dist/{esm → cjs/src}/components/Form/Select/Select.interfaces.d.ts +3 -3
  67. package/dist/{esm → cjs/src}/components/Form/Select/SelectService.d.ts +1 -1
  68. package/dist/cjs/{components → src/components}/Form/Toggle/Toggle.d.ts +5 -0
  69. package/dist/cjs/{components → src/components}/Icon/Icon.d.ts +1 -0
  70. package/dist/cjs/{components → src/components}/Notifications/BaseModal/BaseModalActions/BaseModalActions.d.ts +6 -0
  71. package/dist/cjs/{components → src/components}/Notifications/Dialog/Dialog.d.ts +4 -1
  72. package/dist/cjs/{components → src/components}/Notifications/Dialog/DialogActions/DialogActions.d.ts +2 -2
  73. package/dist/cjs/{components → src/components}/Notifications/Dialog/DialogTitle/DialogTitle.d.ts +2 -0
  74. package/dist/cjs/{components → src/components}/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.d.ts +2 -0
  75. package/dist/cjs/src/components/Notifications/NotificationProvider/NotificationContext.d.ts +35 -0
  76. package/dist/cjs/src/components/Notifications/NotificationProvider/NotificationService.d.ts +2 -0
  77. package/dist/cjs/src/components/Notifications/NotificationProvider/notification.interfaces.d.ts +46 -0
  78. package/dist/{esm → cjs/src}/components/Notifications/Snackbar/SnackbarItem/SnackbarItem.d.ts +3 -2
  79. package/dist/{esm → cjs/src}/components/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.d.ts +2 -1
  80. package/dist/cjs/{components → src/components}/Notifications/Snackbar/SnackbarProvider/SnackbarStateProvider.d.ts +4 -3
  81. package/dist/{esm → cjs/src}/components/Notifications/Snackbar/interfaces.d.ts +2 -1
  82. package/dist/cjs/src/components/Notifications/Snackbar/useSnackbar.d.ts +6 -0
  83. package/dist/{esm → cjs/src}/components/Pagination/Pagination.d.ts +1 -1
  84. package/dist/cjs/{components → src/components}/ProgressBar/ProgressBar.d.ts +4 -1
  85. package/dist/cjs/src/components/Tag/Tag.d.ts +10 -0
  86. package/dist/{esm → cjs/src}/components/Tooltip/Tooltip.d.ts +5 -5
  87. package/dist/cjs/src/components/Wizard/WizardActions/WizardActions.d.ts +28 -0
  88. package/dist/cjs/{components → src/components}/_BaseStyling_/BaseStyling.d.ts +7 -2
  89. package/dist/cjs/src/hooks/useDetermineStatusIcon.cjs.js +1 -1
  90. package/dist/cjs/src/hooks/usePosition.cjs.js +1 -1
  91. package/dist/cjs/{hooks → src/hooks}/usePosition.d.ts +1 -0
  92. package/dist/cjs/src/index.cjs.js +1 -1
  93. package/dist/cjs/{index.d.ts → src/index.d.ts} +3 -0
  94. package/dist/cjs/{interfaces.d.ts → src/interfaces.d.ts} +3 -0
  95. package/dist/cjs/src/util/helper.cjs.js +1 -1
  96. package/dist/{esm → cjs/src}/util/helper.d.ts +5 -0
  97. package/dist/cjs/stories/utils/helpers.d.ts +3 -0
  98. package/dist/esm/Button/BaseButton.module.esm.js +1 -1
  99. package/dist/esm/Button/Button.module.esm.js +1 -1
  100. package/dist/esm/Button/IconButton.module.esm.js +1 -1
  101. package/dist/esm/DataGrid/DataGridBody/DataGridCell.module.esm.js +1 -1
  102. package/dist/esm/Form/Fieldset/Fieldset.module.esm.js +1 -1
  103. package/dist/esm/Form/FormGroup/FormGroup.esm.js +1 -1
  104. package/dist/esm/Form/FormGroup/FormGroup.module.esm.js +1 -1
  105. package/dist/esm/Form/FormHelperText/FormHelperText.esm.js +1 -1
  106. package/dist/esm/Form/FormHelperText/FormHelperText.module.esm.js +1 -1
  107. package/dist/esm/Form/Input/Input.module.esm.js +1 -1
  108. package/dist/esm/Form/Select/Option.esm.js +1 -1
  109. package/dist/esm/Form/Select/Select.esm.js +1 -1
  110. package/dist/esm/Form/Select/Select.module.esm.js +1 -1
  111. package/dist/esm/Form/Select/SelectService.esm.js +1 -1
  112. package/dist/esm/Form/Textarea/Textarea.module.esm.js +1 -1
  113. package/dist/esm/Form/Toggle/Toggle.esm.js +1 -1
  114. package/dist/esm/Form/Toggle/Toggle.module.esm.js +1 -1
  115. package/dist/esm/Form/Wrapper/InputWrapper/InputWrapper.module.esm.js +1 -1
  116. package/dist/esm/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.esm.js +1 -1
  117. package/dist/esm/Form/Wrapper/Wrapper/Wrapper.esm.js +1 -1
  118. package/dist/esm/Form/Wrapper/Wrapper/Wrapper.module.esm.js +1 -1
  119. package/dist/esm/Icon/Icon.esm.js +1 -1
  120. package/dist/esm/Icon/Icon.module.esm.js +1 -1
  121. package/dist/esm/Link/Link.module.esm.js +1 -1
  122. package/dist/esm/Notifications/BaseModal/BaseModal.esm.js +1 -1
  123. package/dist/esm/Notifications/BaseModal/BaseModal.module.esm.js +1 -1
  124. package/dist/esm/Notifications/BaseModal/BaseModalActions/BaseModalActions.esm.js +1 -1
  125. package/dist/esm/Notifications/BaseModal/BaseModalActions/BaseModalActions.module.esm.js +1 -1
  126. package/dist/esm/Notifications/BaseModal/BaseModalContent/BaseModalContent.module.esm.js +1 -1
  127. package/dist/esm/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.esm.js +1 -1
  128. package/dist/esm/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.module.esm.js +1 -1
  129. package/dist/esm/Notifications/Dialog/Dialog.esm.js +1 -1
  130. package/dist/esm/Notifications/Dialog/Dialog.module.esm.js +1 -1
  131. package/dist/esm/Notifications/Dialog/DialogActions/DialogActions.esm.js +1 -1
  132. package/dist/esm/Notifications/Dialog/DialogActions/DialogActions.module.esm.js +1 -1
  133. package/dist/esm/Notifications/Dialog/DialogTitle/DialogTitle.esm.js +1 -1
  134. package/dist/esm/Notifications/Dialog/DialogTitle/DialogTitle.module.esm.js +1 -1
  135. package/dist/esm/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.esm.js +1 -1
  136. package/dist/esm/Notifications/NotificationProvider/NotificationContext.esm.js +2 -0
  137. package/dist/esm/Notifications/NotificationProvider/NotificationContext.esm.js.map +1 -0
  138. package/dist/esm/Notifications/NotificationProvider/NotificationService.esm.js +2 -0
  139. package/dist/esm/Notifications/NotificationProvider/NotificationService.esm.js.map +1 -0
  140. package/dist/esm/Notifications/SlideInModal/SlideInModal.module.esm.js +1 -1
  141. package/dist/esm/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.module.esm.js +1 -1
  142. package/dist/esm/Notifications/Snackbar/SnackbarItem/SnackbarItem.esm.js +1 -1
  143. package/dist/esm/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.esm.js +1 -1
  144. package/dist/esm/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.esm.js +1 -1
  145. package/dist/esm/Notifications/Snackbar/SnackbarProvider/SnackbarStateProvider.esm.js +1 -1
  146. package/dist/esm/Notifications/Snackbar/useSnackbar.esm.js +1 -1
  147. package/dist/esm/Pagination/Pagination.esm.js +1 -1
  148. package/dist/esm/Pagination/Pagination.module.esm.js +1 -1
  149. package/dist/esm/Popover/Popover.esm.js +1 -1
  150. package/dist/esm/Popover/Popover.module.esm.js +1 -1
  151. package/dist/esm/ProgressBar/ProgressBar.esm.js +1 -1
  152. package/dist/esm/ProgressBar/ProgressBar.module.esm.js +1 -1
  153. package/dist/esm/Skeleton/Skeleton.module.esm.js +1 -1
  154. package/dist/esm/Tabs/Tabs.module.esm.js +1 -1
  155. package/dist/esm/Tiles/Tile.module.esm.js +1 -1
  156. package/dist/esm/Tooltip/Tooltip.esm.js +1 -1
  157. package/dist/esm/Tooltip/Tooltip.module.esm.js +1 -1
  158. package/dist/esm/Wizard/WizardActions/WizardActions.esm.js +1 -1
  159. package/dist/esm/_BaseStyling_/BaseStyling.esm.js +1 -1
  160. package/dist/{cjs → esm/src}/components/Form/FormHelperText/FormHelperText.d.ts +1 -0
  161. package/dist/esm/{components → src/components}/Form/Select/Option.d.ts +2 -2
  162. package/dist/{cjs → esm/src}/components/Form/Select/Select.d.ts +1 -0
  163. package/dist/{cjs → esm/src}/components/Form/Select/Select.interfaces.d.ts +3 -3
  164. package/dist/{cjs → esm/src}/components/Form/Select/SelectService.d.ts +1 -1
  165. package/dist/esm/{components → src/components}/Form/Toggle/Toggle.d.ts +5 -0
  166. package/dist/esm/{components → src/components}/Icon/Icon.d.ts +1 -0
  167. package/dist/esm/{components → src/components}/Notifications/BaseModal/BaseModalActions/BaseModalActions.d.ts +6 -0
  168. package/dist/esm/{components → src/components}/Notifications/Dialog/Dialog.d.ts +4 -1
  169. package/dist/esm/{components → src/components}/Notifications/Dialog/DialogActions/DialogActions.d.ts +2 -2
  170. package/dist/esm/{components → src/components}/Notifications/Dialog/DialogTitle/DialogTitle.d.ts +2 -0
  171. package/dist/esm/{components → src/components}/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.d.ts +2 -0
  172. package/dist/esm/src/components/Notifications/NotificationProvider/NotificationContext.d.ts +35 -0
  173. package/dist/esm/src/components/Notifications/NotificationProvider/NotificationService.d.ts +2 -0
  174. package/dist/esm/src/components/Notifications/NotificationProvider/notification.interfaces.d.ts +46 -0
  175. package/dist/{cjs → esm/src}/components/Notifications/Snackbar/SnackbarItem/SnackbarItem.d.ts +3 -2
  176. package/dist/{cjs → esm/src}/components/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.d.ts +2 -1
  177. package/dist/esm/{components → src/components}/Notifications/Snackbar/SnackbarProvider/SnackbarStateProvider.d.ts +4 -3
  178. package/dist/{cjs → esm/src}/components/Notifications/Snackbar/interfaces.d.ts +2 -1
  179. package/dist/esm/src/components/Notifications/Snackbar/useSnackbar.d.ts +6 -0
  180. package/dist/{cjs → esm/src}/components/Pagination/Pagination.d.ts +1 -1
  181. package/dist/esm/{components → src/components}/ProgressBar/ProgressBar.d.ts +4 -1
  182. package/dist/esm/src/components/Tag/Tag.d.ts +10 -0
  183. package/dist/{cjs → esm/src}/components/Tooltip/Tooltip.d.ts +5 -5
  184. package/dist/esm/src/components/Wizard/WizardActions/WizardActions.d.ts +28 -0
  185. package/dist/esm/{components → src/components}/_BaseStyling_/BaseStyling.d.ts +7 -2
  186. package/dist/esm/src/hooks/useDetermineStatusIcon.esm.js +1 -1
  187. package/dist/esm/{hooks → src/hooks}/usePosition.d.ts +1 -0
  188. package/dist/esm/src/hooks/usePosition.esm.js +1 -1
  189. package/dist/esm/src/hooks/useSpacing.test.d.ts +1 -0
  190. package/dist/esm/src/hooks/useUploadFile.test.d.ts +1 -0
  191. package/dist/esm/src/hooks/useWrapper.test.d.ts +1 -0
  192. package/dist/esm/{index.d.ts → src/index.d.ts} +3 -0
  193. package/dist/esm/src/index.esm.js +1 -1
  194. package/dist/esm/{interfaces.d.ts → src/interfaces.d.ts} +3 -0
  195. package/dist/{cjs → esm/src}/util/helper.d.ts +5 -0
  196. package/dist/esm/src/util/helper.esm.js +1 -1
  197. package/dist/esm/src/util/helper.test.d.ts +1 -0
  198. package/dist/esm/stories/utils/helpers.d.ts +3 -0
  199. package/package.json +51 -51
  200. package/src/components/Form/Fieldset/Fieldset.module.scss +2 -2
  201. package/src/components/Form/FileUpload/FileItem/FileItem.tsx +1 -5
  202. package/src/components/Form/FormGroup/FormGroup.module.scss +2 -4
  203. package/src/components/Form/FormGroup/FormGroup.tsx +11 -7
  204. package/src/components/Form/FormHelperText/FormHelperText.module.scss +7 -3
  205. package/src/components/Form/FormHelperText/FormHelperText.tsx +8 -8
  206. package/src/components/Form/Input/Input.module.scss +8 -3
  207. package/src/components/Form/Input/Input.test.tsx +1 -1
  208. package/src/components/Form/Select/Option.tsx +4 -5
  209. package/src/components/Form/Select/Select.interfaces.ts +3 -3
  210. package/src/components/Form/Select/Select.module.scss +36 -31
  211. package/src/components/Form/Select/Select.test.tsx +106 -7
  212. package/src/components/Form/Select/Select.tsx +55 -21
  213. package/src/components/Form/Select/SelectService.ts +38 -10
  214. package/src/components/Form/Textarea/Textarea.module.scss +19 -5
  215. package/src/components/Form/Textarea/Textarea.test.tsx +1 -1
  216. package/src/components/Form/Toggle/Toggle.module.scss +127 -1
  217. package/src/components/Form/Toggle/Toggle.test.tsx +102 -1
  218. package/src/components/Form/Toggle/Toggle.tsx +25 -1
  219. package/src/components/Form/Wrapper/InputWrapper/InputWrapper.module.scss +4 -2
  220. package/src/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss +0 -2
  221. package/src/components/Form/Wrapper/Wrapper/Wrapper.tsx +1 -0
  222. package/src/components/Icon/Icon.module.scss +14 -11
  223. package/src/components/Icon/Icon.tsx +1 -0
  224. package/src/components/Notifications/BaseModal/BaseModal.module.scss +5 -5
  225. package/src/components/Notifications/BaseModal/BaseModal.tsx +2 -0
  226. package/src/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.module.scss +43 -3
  227. package/src/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.test.tsx +33 -2
  228. package/src/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.tsx +35 -4
  229. package/src/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.module.scss +4 -1
  230. package/src/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.module.scss +2 -2
  231. package/src/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.tsx +11 -3
  232. package/src/components/Notifications/Dialog/Dialog.module.scss +2 -2
  233. package/src/components/Notifications/Dialog/Dialog.test.tsx +11 -22
  234. package/src/components/Notifications/Dialog/Dialog.tsx +13 -9
  235. package/src/components/Notifications/Dialog/DialogActions/DialogActions.module.scss +1 -7
  236. package/src/components/Notifications/Dialog/DialogActions/DialogActions.test.tsx +2 -8
  237. package/src/components/Notifications/Dialog/DialogActions/DialogActions.tsx +7 -4
  238. package/src/components/Notifications/Dialog/DialogTitle/DialogTitle.module.scss +11 -0
  239. package/src/components/Notifications/Dialog/DialogTitle/DialogTitle.test.tsx +27 -0
  240. package/src/components/Notifications/Dialog/DialogTitle/DialogTitle.tsx +25 -4
  241. package/src/components/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.tsx +4 -1
  242. package/src/components/Notifications/DiscardChangesModal/DiscardChangesModal.test.tsx +2 -5
  243. package/src/components/Notifications/NotificationProvider/NotificationContext.test.tsx +449 -0
  244. package/src/components/Notifications/NotificationProvider/NotificationContext.tsx +221 -0
  245. package/src/components/Notifications/NotificationProvider/NotificationService.ts +33 -0
  246. package/src/components/Notifications/NotificationProvider/notification.interfaces.ts +68 -0
  247. package/src/components/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.scss +63 -52
  248. package/src/components/Notifications/Snackbar/SnackbarItem/SnackbarItem.test.tsx +1 -1
  249. package/src/components/Notifications/Snackbar/SnackbarItem/SnackbarItem.tsx +31 -18
  250. package/src/components/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.test.tsx +32 -5
  251. package/src/components/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.tsx +16 -4
  252. package/src/components/Notifications/Snackbar/SnackbarProvider/SnackbarStateProvider.tsx +13 -3
  253. package/src/components/Notifications/Snackbar/interfaces.ts +2 -1
  254. package/src/components/Notifications/Snackbar/useSnackbar.ts +1 -0
  255. package/src/components/Pagination/Pagination.module.scss +43 -27
  256. package/src/components/Pagination/Pagination.test.tsx +11 -22
  257. package/src/components/Pagination/Pagination.tsx +62 -105
  258. package/src/components/Popover/Popover.module.scss +1 -1
  259. package/src/components/Popover/Popover.tsx +31 -16
  260. package/src/components/ProgressBar/ProgressBar.module.scss +50 -13
  261. package/src/components/ProgressBar/ProgressBar.test.tsx +15 -3
  262. package/src/components/ProgressBar/ProgressBar.tsx +38 -9
  263. package/src/components/Tag/Tag.module.scss +24 -0
  264. package/src/components/Tag/Tag.test.tsx +89 -0
  265. package/src/components/Tag/Tag.tsx +69 -0
  266. package/src/components/Tiles/Tile.test.tsx +2 -1
  267. package/src/components/Tooltip/Tooltip.module.scss +158 -5
  268. package/src/components/Tooltip/Tooltip.test.tsx +339 -75
  269. package/src/components/Tooltip/Tooltip.tsx +91 -16
  270. package/src/components/Wizard/Wizard.test.tsx +32 -17
  271. package/src/components/Wizard/WizardActions/WizardActions.test.tsx +39 -23
  272. package/src/components/Wizard/WizardActions/WizardActions.tsx +40 -28
  273. package/src/components/_BaseStyling_/BaseStyling.tsx +17 -7
  274. package/src/font/icomoon.eot +0 -0
  275. package/src/font/icomoon.svg +3 -2
  276. package/src/font/icomoon.ttf +0 -0
  277. package/src/font/icomoon.woff +0 -0
  278. package/src/font/selection.json +1 -1
  279. package/src/hooks/useDetermineStatusIcon.tsx +1 -3
  280. package/src/hooks/usePosition.ts +7 -1
  281. package/src/index.ts +10 -0
  282. package/src/interfaces.ts +8 -0
  283. package/src/mixins.module.scss +4 -18
  284. package/src/util/helper.test.tsx +39 -1
  285. package/src/util/helper.tsx +25 -0
  286. package/src/variables.scss +4 -2
  287. package/dist/cjs/components/Notifications/Snackbar/useSnackbar.d.ts +0 -5
  288. package/dist/cjs/components/Wizard/WizardActions/WizardActions.d.ts +0 -12
  289. package/dist/esm/components/Notifications/Snackbar/useSnackbar.d.ts +0 -5
  290. package/dist/esm/components/Wizard/WizardActions/WizardActions.d.ts +0 -12
  291. /package/dist/cjs/{components → src/components}/Breadcrumbs/Breadcrumbs.d.ts +0 -0
  292. /package/dist/cjs/{components → src/components}/Breadcrumbs/Breadcrumbs.test.d.ts +0 -0
  293. /package/dist/cjs/{components → src/components}/Button/BaseButton.d.ts +0 -0
  294. /package/dist/cjs/{components → src/components}/Button/BaseButton.test.d.ts +0 -0
  295. /package/dist/cjs/{components → src/components}/Button/Button.d.ts +0 -0
  296. /package/dist/cjs/{components → src/components}/Button/Button.test.d.ts +0 -0
  297. /package/dist/cjs/{components → src/components}/Button/IconButton.d.ts +0 -0
  298. /package/dist/cjs/{components → src/components}/Button/IconButton.test.d.ts +0 -0
  299. /package/dist/cjs/{components → src/components}/Button/Spinner.d.ts +0 -0
  300. /package/dist/cjs/{components → src/components}/ContextMenu/ContextMenu.d.ts +0 -0
  301. /package/dist/cjs/{components → src/components}/ContextMenu/ContextMenu.test.d.ts +0 -0
  302. /package/dist/cjs/{components → src/components}/ContextMenu/ContextMenuItem.d.ts +0 -0
  303. /package/dist/cjs/{components → src/components}/DataGrid/DataGrid.d.ts +0 -0
  304. /package/dist/cjs/{components → src/components}/DataGrid/DataGrid.test.d.ts +0 -0
  305. /package/dist/cjs/{components → src/components}/DataGrid/DataGridActions/DataGridActions.d.ts +0 -0
  306. /package/dist/cjs/{components → src/components}/DataGrid/DataGridActions/DataGridActions.test.d.ts +0 -0
  307. /package/dist/cjs/{components → src/components}/DataGrid/DataGridActions/DataGridColumnsToggle.d.ts +0 -0
  308. /package/dist/cjs/{components → src/components}/DataGrid/DataGridActions/DataGridColumnsToggle.test.d.ts +0 -0
  309. /package/dist/cjs/{components → src/components}/DataGrid/DataGridBody/DataGridBody.d.ts +0 -0
  310. /package/dist/cjs/{components → src/components}/DataGrid/DataGridBody/DataGridBody.test.d.ts +0 -0
  311. /package/dist/cjs/{components → src/components}/DataGrid/DataGridBody/DataGridCell.d.ts +0 -0
  312. /package/dist/cjs/{components → src/components}/DataGrid/DataGridBody/DataGridCell.test.d.ts +0 -0
  313. /package/dist/cjs/{components → src/components}/DataGrid/DataGridBody/DataGridRow.d.ts +0 -0
  314. /package/dist/cjs/{components → src/components}/DataGrid/DataGridBody/DataGridRow.test.d.ts +0 -0
  315. /package/dist/cjs/{components → src/components}/DataGrid/DataGridHeader/DataGridHeader.d.ts +0 -0
  316. /package/dist/cjs/{components → src/components}/DataGrid/DataGridHeader/DataGridHeader.test.d.ts +0 -0
  317. /package/dist/cjs/{components → src/components}/DataGrid/DataGridHeader/DataGridHeaderCell.d.ts +0 -0
  318. /package/dist/cjs/{components → src/components}/DataGrid/DataGridHeader/DataGridHeaderCell.test.d.ts +0 -0
  319. /package/dist/cjs/{components → src/components}/DataGrid/datagrid.interfaces.d.ts +0 -0
  320. /package/dist/cjs/{components → src/components}/Form/Checkbox/Checkbox.d.ts +0 -0
  321. /package/dist/cjs/{components → src/components}/Form/Checkbox/Checkbox.test.d.ts +0 -0
  322. /package/dist/cjs/{components → src/components}/Form/Fieldset/Fieldset.d.ts +0 -0
  323. /package/dist/cjs/{components → src/components}/Form/Fieldset/Fieldset.test.d.ts +0 -0
  324. /package/dist/cjs/{components → src/components}/Form/FileUpload/FileItem/FileItem.d.ts +0 -0
  325. /package/dist/cjs/{components → src/components}/Form/FileUpload/FileItem/FileItem.test.d.ts +0 -0
  326. /package/dist/cjs/{components → src/components}/Form/FileUpload/FileUpload.d.ts +0 -0
  327. /package/dist/cjs/{components → src/components}/Form/FileUpload/FileUpload.test.d.ts +0 -0
  328. /package/dist/cjs/{components → src/components}/Form/Form.d.ts +0 -0
  329. /package/dist/cjs/{components → src/components}/Form/Form.test.d.ts +0 -0
  330. /package/dist/cjs/{components → src/components}/Form/FormControl/FormControl.d.ts +0 -0
  331. /package/dist/cjs/{components → src/components}/Form/FormControl/FormControl.test.d.ts +0 -0
  332. /package/dist/cjs/{components → src/components}/Form/FormGroup/FormGroup.d.ts +0 -0
  333. /package/dist/cjs/{components → src/components}/Form/FormGroup/FormGroup.test.d.ts +0 -0
  334. /package/dist/cjs/{components → src/components}/Form/FormHelperText/FormHelperText.test.d.ts +0 -0
  335. /package/dist/cjs/{components → src/components}/Form/FormSelectorWrapper/FormSelectorWrapper.d.ts +0 -0
  336. /package/dist/cjs/{components → src/components}/Form/FormSelectorWrapper/FormSelectorWrapper.test.d.ts +0 -0
  337. /package/dist/cjs/{components → src/components}/Form/Input/Input.d.ts +0 -0
  338. /package/dist/cjs/{components → src/components}/Form/Input/Input.test.d.ts +0 -0
  339. /package/dist/cjs/{components → src/components}/Form/Label/Label.d.ts +0 -0
  340. /package/dist/cjs/{components → src/components}/Form/Label/Label.test.d.ts +0 -0
  341. /package/dist/cjs/{components → src/components}/Form/Radio/Radio.d.ts +0 -0
  342. /package/dist/cjs/{components → src/components}/Form/Radio/Radio.test.d.ts +0 -0
  343. /package/dist/cjs/{components → src/components}/Form/Select/Option.test.d.ts +0 -0
  344. /package/dist/cjs/{components → src/components}/Form/Select/Select.test.d.ts +0 -0
  345. /package/dist/cjs/{components → src/components}/Form/Textarea/Textarea.d.ts +0 -0
  346. /package/dist/cjs/{components → src/components}/Form/Textarea/Textarea.test.d.ts +0 -0
  347. /package/dist/cjs/{components → src/components}/Form/Toggle/Toggle.test.d.ts +0 -0
  348. /package/dist/cjs/{components → src/components}/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.d.ts +0 -0
  349. /package/dist/cjs/{components → src/components}/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.test.d.ts +0 -0
  350. /package/dist/cjs/{components → src/components}/Form/Wrapper/InputWrapper/InputWrapper.d.ts +0 -0
  351. /package/dist/cjs/{components → src/components}/Form/Wrapper/InputWrapper/InputWrapper.test.d.ts +0 -0
  352. /package/dist/cjs/{components → src/components}/Form/Wrapper/RadioWrapper/RadioWrapper.d.ts +0 -0
  353. /package/dist/cjs/{components → src/components}/Form/Wrapper/RadioWrapper/RadioWrapper.test.d.ts +0 -0
  354. /package/dist/cjs/{components → src/components}/Form/Wrapper/SelectWrapper/SelectWrapper.d.ts +0 -0
  355. /package/dist/cjs/{components → src/components}/Form/Wrapper/SelectWrapper/SelectWrapper.test.d.ts +0 -0
  356. /package/dist/cjs/{components → src/components}/Form/Wrapper/TextareaWrapper/TextareaWrapper.d.ts +0 -0
  357. /package/dist/cjs/{components → src/components}/Form/Wrapper/TextareaWrapper/TextareaWrapper.test.d.ts +0 -0
  358. /package/dist/cjs/{components → src/components}/Form/Wrapper/Wrapper/Wrapper.d.ts +0 -0
  359. /package/dist/cjs/{components → src/components}/Form/Wrapper/Wrapper/Wrapper.test.d.ts +0 -0
  360. /package/dist/cjs/{components → src/components}/Form/form.interfaces.d.ts +0 -0
  361. /package/dist/cjs/{components → src/components}/Icon/Icon.test.d.ts +0 -0
  362. /package/dist/cjs/{components → src/components}/Link/Link.d.ts +0 -0
  363. /package/dist/cjs/{components → src/components}/Link/Link.test.d.ts +0 -0
  364. /package/dist/cjs/{components → src/components}/Notifications/Banner/Banner.d.ts +0 -0
  365. /package/dist/cjs/{components → src/components}/Notifications/Banner/Banner.test.d.ts +0 -0
  366. /package/dist/cjs/{components → src/components}/Notifications/BaseModal/BaseModal.d.ts +0 -0
  367. /package/dist/cjs/{components → src/components}/Notifications/BaseModal/BaseModal.test.d.ts +0 -0
  368. /package/dist/cjs/{components → src/components}/Notifications/BaseModal/BaseModalActions/BaseModalActions.test.d.ts +0 -0
  369. /package/dist/cjs/{components → src/components}/Notifications/BaseModal/BaseModalContent/BaseModalContent.d.ts +0 -0
  370. /package/dist/cjs/{components → src/components}/Notifications/BaseModal/BaseModalContent/BaseModalContent.test.d.ts +0 -0
  371. /package/dist/cjs/{components → src/components}/Notifications/BaseModal/BaseModalContext.d.ts +0 -0
  372. /package/dist/cjs/{components → src/components}/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.d.ts +0 -0
  373. /package/dist/cjs/{components → src/components}/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.test.d.ts +0 -0
  374. /package/dist/cjs/{components → src/components}/Notifications/Dialog/Dialog.test.d.ts +0 -0
  375. /package/dist/cjs/{components → src/components}/Notifications/Dialog/DialogActions/DialogActions.test.d.ts +0 -0
  376. /package/dist/cjs/{components → src/components}/Notifications/Dialog/DialogTitle/DialogTitle.test.d.ts +0 -0
  377. /package/dist/cjs/{components → src/components}/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.test.d.ts +0 -0
  378. /package/dist/cjs/{components → src/components}/Notifications/DiscardChangesModal/DiscardChangesModal.d.ts +0 -0
  379. /package/dist/cjs/{components → src/components}/Notifications/DiscardChangesModal/DiscardChangesModal.test.d.ts +0 -0
  380. /package/dist/cjs/{components → src/components}/Notifications/Modal/Modal.d.ts +0 -0
  381. /package/dist/cjs/{components → src/components}/Notifications/Modal/Modal.test.d.ts +0 -0
  382. /package/dist/cjs/{components → src/components}/Notifications/Modal/ModalActions/ModalActions.d.ts +0 -0
  383. /package/dist/cjs/{components → src/components}/Notifications/Modal/ModalContent/ModalContent.d.ts +0 -0
  384. /package/dist/cjs/{components → src/components}/Notifications/Modal/ModalHeader/ModalHeader.d.ts +0 -0
  385. /package/dist/cjs/{components/Notifications/SlideInModal/SlideInModal.test.d.ts → src/components/Notifications/NotificationProvider/NotificationContext.test.d.ts} +0 -0
  386. /package/dist/cjs/{components → src/components}/Notifications/SlideInModal/SlideInModal.d.ts +0 -0
  387. /package/dist/{esm → cjs/src}/components/Notifications/SlideInModal/SlideInModal.test.d.ts +0 -0
  388. /package/dist/cjs/{components → src/components}/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.d.ts +0 -0
  389. /package/dist/cjs/{components → src/components}/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.test.d.ts +0 -0
  390. /package/dist/cjs/{components → src/components}/Notifications/Snackbar/SnackbarItem/SnackbarItem.test.d.ts +0 -0
  391. /package/dist/cjs/{components → src/components}/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.test.d.ts +0 -0
  392. /package/dist/cjs/{components → src/components}/Pagination/Pagination.test.d.ts +0 -0
  393. /package/dist/cjs/{components → src/components}/Popover/Popover.d.ts +0 -0
  394. /package/dist/cjs/{components → src/components}/Popover/Popover.test.d.ts +0 -0
  395. /package/dist/cjs/{components → src/components}/ProgressBar/ProgressBar.test.d.ts +0 -0
  396. /package/dist/cjs/{components → src/components}/Skeleton/Skeleton.d.ts +0 -0
  397. /package/dist/cjs/{components → src/components}/Skeleton/Skeleton.test.d.ts +0 -0
  398. /package/dist/cjs/{components → src/components}/StatusIndicator/StatusIndicator.d.ts +0 -0
  399. /package/dist/cjs/{components → src/components}/StatusIndicator/StatusIndicator.test.d.ts +0 -0
  400. /package/dist/cjs/{components → src/components}/Tabs/Tab.d.ts +0 -0
  401. /package/dist/cjs/{components → src/components}/Tabs/Tab.test.d.ts +0 -0
  402. /package/dist/cjs/{components → src/components}/Tabs/TabButton.d.ts +0 -0
  403. /package/dist/cjs/{components → src/components}/Tabs/TabButton.test.d.ts +0 -0
  404. /package/dist/cjs/{components → src/components}/Tabs/Tabs.d.ts +0 -0
  405. /package/dist/cjs/{components → src/components}/Tabs/Tabs.test.d.ts +0 -0
  406. /package/dist/cjs/{components/TextEllipsis/TextEllipsis.test.d.ts → src/components/Tag/Tag.test.d.ts} +0 -0
  407. /package/dist/cjs/{components → src/components}/TextEllipsis/TextEllipsis.d.ts +0 -0
  408. /package/dist/{esm → cjs/src}/components/TextEllipsis/TextEllipsis.test.d.ts +0 -0
  409. /package/dist/cjs/{components → src/components}/Tiles/Tile.d.ts +0 -0
  410. /package/dist/cjs/{components → src/components}/Tiles/Tile.test.d.ts +0 -0
  411. /package/dist/cjs/{components → src/components}/Tiles/Tiles.d.ts +0 -0
  412. /package/dist/cjs/{components → src/components}/Tiles/Tiles.test.d.ts +0 -0
  413. /package/dist/cjs/{components → src/components}/Tooltip/Tooltip.test.d.ts +0 -0
  414. /package/dist/cjs/{components → src/components}/Typography/Typography.d.ts +0 -0
  415. /package/dist/cjs/{components → src/components}/Typography/Typography.test.d.ts +0 -0
  416. /package/dist/cjs/{components → src/components}/Wizard/BaseWizardSteps/BaseWizardSteps.d.ts +0 -0
  417. /package/dist/cjs/{components → src/components}/Wizard/BaseWizardSteps/BaseWizardSteps.test.d.ts +0 -0
  418. /package/dist/cjs/{components → src/components}/Wizard/Wizard.d.ts +0 -0
  419. /package/dist/cjs/{components → src/components}/Wizard/Wizard.test.d.ts +0 -0
  420. /package/dist/cjs/{components → src/components}/Wizard/WizardActions/WizardActions.test.d.ts +0 -0
  421. /package/dist/cjs/{components → src/components}/Wizard/WizardStateProvider.d.ts +0 -0
  422. /package/dist/cjs/{components → src/components}/Wizard/WizardSteps/WizardSteps.d.ts +0 -0
  423. /package/dist/cjs/{components → src/components}/Wizard/WizardSteps/WizardSteps.test.d.ts +0 -0
  424. /package/dist/cjs/{components → src/components}/Wizard/wizardStateReducer.d.ts +0 -0
  425. /package/dist/cjs/{components → src/components}/_BaseStyling_/BaseStyling.test.d.ts +0 -0
  426. /package/dist/cjs/{hooks → src/hooks}/useAnimation.d.ts +0 -0
  427. /package/dist/cjs/{hooks → src/hooks}/useAnimation.test.d.ts +0 -0
  428. /package/dist/cjs/{hooks → src/hooks}/useBodyClick.d.ts +0 -0
  429. /package/dist/cjs/{hooks → src/hooks}/useBodyClick.test.d.ts +0 -0
  430. /package/dist/cjs/{hooks → src/hooks}/useDebouncedCallback.d.ts +0 -0
  431. /package/dist/cjs/{hooks → src/hooks}/useDebouncedCallback.test.d.ts +0 -0
  432. /package/dist/cjs/{hooks → src/hooks}/useDetermineStatusIcon.d.ts +0 -0
  433. /package/dist/cjs/{hooks → src/hooks}/useDetermineStatusIcon.test.d.ts +0 -0
  434. /package/dist/cjs/{hooks → src/hooks}/useFormSelector.d.ts +0 -0
  435. /package/dist/cjs/{hooks → src/hooks}/useFormSelector.test.d.ts +0 -0
  436. /package/dist/cjs/{hooks → src/hooks}/useGetDomRoot.d.ts +0 -0
  437. /package/dist/cjs/{hooks → src/hooks}/usePosition.test.d.ts +0 -0
  438. /package/dist/cjs/{hooks → src/hooks}/useRepeater.d.ts +0 -0
  439. /package/dist/cjs/{hooks → src/hooks}/useRepeater.test.d.ts +0 -0
  440. /package/dist/cjs/{hooks → src/hooks}/useScroll.d.ts +0 -0
  441. /package/dist/cjs/{hooks → src/hooks}/useScroll.test.d.ts +0 -0
  442. /package/dist/cjs/{hooks → src/hooks}/useSpacing.d.ts +0 -0
  443. /package/dist/cjs/{hooks → src/hooks}/useSpacing.test.d.ts +0 -0
  444. /package/dist/cjs/{hooks → src/hooks}/useUploadFile.d.ts +0 -0
  445. /package/dist/cjs/{hooks → src/hooks}/useUploadFile.test.d.ts +0 -0
  446. /package/dist/cjs/{hooks → src/hooks}/useWrapper.d.ts +0 -0
  447. /package/dist/cjs/{hooks → src/hooks}/useWrapper.test.d.ts +0 -0
  448. /package/dist/cjs/{util → src/util}/helper.test.d.ts +0 -0
  449. /package/dist/esm/{components → src/components}/Breadcrumbs/Breadcrumbs.d.ts +0 -0
  450. /package/dist/esm/{components → src/components}/Breadcrumbs/Breadcrumbs.test.d.ts +0 -0
  451. /package/dist/esm/{components → src/components}/Button/BaseButton.d.ts +0 -0
  452. /package/dist/esm/{components → src/components}/Button/BaseButton.test.d.ts +0 -0
  453. /package/dist/esm/{components → src/components}/Button/Button.d.ts +0 -0
  454. /package/dist/esm/{components → src/components}/Button/Button.test.d.ts +0 -0
  455. /package/dist/esm/{components → src/components}/Button/IconButton.d.ts +0 -0
  456. /package/dist/esm/{components → src/components}/Button/IconButton.test.d.ts +0 -0
  457. /package/dist/esm/{components → src/components}/Button/Spinner.d.ts +0 -0
  458. /package/dist/esm/{components → src/components}/ContextMenu/ContextMenu.d.ts +0 -0
  459. /package/dist/esm/{components → src/components}/ContextMenu/ContextMenu.test.d.ts +0 -0
  460. /package/dist/esm/{components → src/components}/ContextMenu/ContextMenuItem.d.ts +0 -0
  461. /package/dist/esm/{components → src/components}/DataGrid/DataGrid.d.ts +0 -0
  462. /package/dist/esm/{components → src/components}/DataGrid/DataGrid.test.d.ts +0 -0
  463. /package/dist/esm/{components → src/components}/DataGrid/DataGridActions/DataGridActions.d.ts +0 -0
  464. /package/dist/esm/{components → src/components}/DataGrid/DataGridActions/DataGridActions.test.d.ts +0 -0
  465. /package/dist/esm/{components → src/components}/DataGrid/DataGridActions/DataGridColumnsToggle.d.ts +0 -0
  466. /package/dist/esm/{components → src/components}/DataGrid/DataGridActions/DataGridColumnsToggle.test.d.ts +0 -0
  467. /package/dist/esm/{components → src/components}/DataGrid/DataGridBody/DataGridBody.d.ts +0 -0
  468. /package/dist/esm/{components → src/components}/DataGrid/DataGridBody/DataGridBody.test.d.ts +0 -0
  469. /package/dist/esm/{components → src/components}/DataGrid/DataGridBody/DataGridCell.d.ts +0 -0
  470. /package/dist/esm/{components → src/components}/DataGrid/DataGridBody/DataGridCell.test.d.ts +0 -0
  471. /package/dist/esm/{components → src/components}/DataGrid/DataGridBody/DataGridRow.d.ts +0 -0
  472. /package/dist/esm/{components → src/components}/DataGrid/DataGridBody/DataGridRow.test.d.ts +0 -0
  473. /package/dist/esm/{components → src/components}/DataGrid/DataGridHeader/DataGridHeader.d.ts +0 -0
  474. /package/dist/esm/{components → src/components}/DataGrid/DataGridHeader/DataGridHeader.test.d.ts +0 -0
  475. /package/dist/esm/{components → src/components}/DataGrid/DataGridHeader/DataGridHeaderCell.d.ts +0 -0
  476. /package/dist/esm/{components → src/components}/DataGrid/DataGridHeader/DataGridHeaderCell.test.d.ts +0 -0
  477. /package/dist/esm/{components → src/components}/DataGrid/datagrid.interfaces.d.ts +0 -0
  478. /package/dist/esm/{components → src/components}/Form/Checkbox/Checkbox.d.ts +0 -0
  479. /package/dist/esm/{components → src/components}/Form/Checkbox/Checkbox.test.d.ts +0 -0
  480. /package/dist/esm/{components → src/components}/Form/Fieldset/Fieldset.d.ts +0 -0
  481. /package/dist/esm/{components → src/components}/Form/Fieldset/Fieldset.test.d.ts +0 -0
  482. /package/dist/esm/{components → src/components}/Form/FileUpload/FileItem/FileItem.d.ts +0 -0
  483. /package/dist/esm/{components → src/components}/Form/FileUpload/FileItem/FileItem.test.d.ts +0 -0
  484. /package/dist/esm/{components → src/components}/Form/FileUpload/FileUpload.d.ts +0 -0
  485. /package/dist/esm/{components → src/components}/Form/FileUpload/FileUpload.test.d.ts +0 -0
  486. /package/dist/esm/{components → src/components}/Form/Form.d.ts +0 -0
  487. /package/dist/esm/{components → src/components}/Form/Form.test.d.ts +0 -0
  488. /package/dist/esm/{components → src/components}/Form/FormControl/FormControl.d.ts +0 -0
  489. /package/dist/esm/{components → src/components}/Form/FormControl/FormControl.test.d.ts +0 -0
  490. /package/dist/esm/{components → src/components}/Form/FormGroup/FormGroup.d.ts +0 -0
  491. /package/dist/esm/{components → src/components}/Form/FormGroup/FormGroup.test.d.ts +0 -0
  492. /package/dist/esm/{components → src/components}/Form/FormHelperText/FormHelperText.test.d.ts +0 -0
  493. /package/dist/esm/{components → src/components}/Form/FormSelectorWrapper/FormSelectorWrapper.d.ts +0 -0
  494. /package/dist/esm/{components → src/components}/Form/FormSelectorWrapper/FormSelectorWrapper.test.d.ts +0 -0
  495. /package/dist/esm/{components → src/components}/Form/Input/Input.d.ts +0 -0
  496. /package/dist/esm/{components → src/components}/Form/Input/Input.test.d.ts +0 -0
  497. /package/dist/esm/{components → src/components}/Form/Label/Label.d.ts +0 -0
  498. /package/dist/esm/{components → src/components}/Form/Label/Label.test.d.ts +0 -0
  499. /package/dist/esm/{components → src/components}/Form/Radio/Radio.d.ts +0 -0
  500. /package/dist/esm/{components → src/components}/Form/Radio/Radio.test.d.ts +0 -0
  501. /package/dist/esm/{components → src/components}/Form/Select/Option.test.d.ts +0 -0
  502. /package/dist/esm/{components → src/components}/Form/Select/Select.test.d.ts +0 -0
  503. /package/dist/esm/{components → src/components}/Form/Textarea/Textarea.d.ts +0 -0
  504. /package/dist/esm/{components → src/components}/Form/Textarea/Textarea.test.d.ts +0 -0
  505. /package/dist/esm/{components → src/components}/Form/Toggle/Toggle.test.d.ts +0 -0
  506. /package/dist/esm/{components → src/components}/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.d.ts +0 -0
  507. /package/dist/esm/{components → src/components}/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.test.d.ts +0 -0
  508. /package/dist/esm/{components → src/components}/Form/Wrapper/InputWrapper/InputWrapper.d.ts +0 -0
  509. /package/dist/esm/{components → src/components}/Form/Wrapper/InputWrapper/InputWrapper.test.d.ts +0 -0
  510. /package/dist/esm/{components → src/components}/Form/Wrapper/RadioWrapper/RadioWrapper.d.ts +0 -0
  511. /package/dist/esm/{components → src/components}/Form/Wrapper/RadioWrapper/RadioWrapper.test.d.ts +0 -0
  512. /package/dist/esm/{components → src/components}/Form/Wrapper/SelectWrapper/SelectWrapper.d.ts +0 -0
  513. /package/dist/esm/{components → src/components}/Form/Wrapper/SelectWrapper/SelectWrapper.test.d.ts +0 -0
  514. /package/dist/esm/{components → src/components}/Form/Wrapper/TextareaWrapper/TextareaWrapper.d.ts +0 -0
  515. /package/dist/esm/{components → src/components}/Form/Wrapper/TextareaWrapper/TextareaWrapper.test.d.ts +0 -0
  516. /package/dist/esm/{components → src/components}/Form/Wrapper/Wrapper/Wrapper.d.ts +0 -0
  517. /package/dist/esm/{components → src/components}/Form/Wrapper/Wrapper/Wrapper.test.d.ts +0 -0
  518. /package/dist/esm/{components → src/components}/Form/form.interfaces.d.ts +0 -0
  519. /package/dist/esm/{components → src/components}/Icon/Icon.test.d.ts +0 -0
  520. /package/dist/esm/{components → src/components}/Link/Link.d.ts +0 -0
  521. /package/dist/esm/{components → src/components}/Link/Link.test.d.ts +0 -0
  522. /package/dist/esm/{components → src/components}/Notifications/Banner/Banner.d.ts +0 -0
  523. /package/dist/esm/{components → src/components}/Notifications/Banner/Banner.test.d.ts +0 -0
  524. /package/dist/esm/{components → src/components}/Notifications/BaseModal/BaseModal.d.ts +0 -0
  525. /package/dist/esm/{components → src/components}/Notifications/BaseModal/BaseModal.test.d.ts +0 -0
  526. /package/dist/esm/{components → src/components}/Notifications/BaseModal/BaseModalActions/BaseModalActions.test.d.ts +0 -0
  527. /package/dist/esm/{components → src/components}/Notifications/BaseModal/BaseModalContent/BaseModalContent.d.ts +0 -0
  528. /package/dist/esm/{components → src/components}/Notifications/BaseModal/BaseModalContent/BaseModalContent.test.d.ts +0 -0
  529. /package/dist/esm/{components → src/components}/Notifications/BaseModal/BaseModalContext.d.ts +0 -0
  530. /package/dist/esm/{components → src/components}/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.d.ts +0 -0
  531. /package/dist/esm/{components → src/components}/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.test.d.ts +0 -0
  532. /package/dist/esm/{components → src/components}/Notifications/Dialog/Dialog.test.d.ts +0 -0
  533. /package/dist/esm/{components → src/components}/Notifications/Dialog/DialogActions/DialogActions.test.d.ts +0 -0
  534. /package/dist/esm/{components → src/components}/Notifications/Dialog/DialogTitle/DialogTitle.test.d.ts +0 -0
  535. /package/dist/esm/{components → src/components}/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.test.d.ts +0 -0
  536. /package/dist/esm/{components → src/components}/Notifications/DiscardChangesModal/DiscardChangesModal.d.ts +0 -0
  537. /package/dist/esm/{components → src/components}/Notifications/DiscardChangesModal/DiscardChangesModal.test.d.ts +0 -0
  538. /package/dist/esm/{components → src/components}/Notifications/Modal/Modal.d.ts +0 -0
  539. /package/dist/esm/{components → src/components}/Notifications/Modal/Modal.test.d.ts +0 -0
  540. /package/dist/esm/{components → src/components}/Notifications/Modal/ModalActions/ModalActions.d.ts +0 -0
  541. /package/dist/esm/{components → src/components}/Notifications/Modal/ModalContent/ModalContent.d.ts +0 -0
  542. /package/dist/esm/{components → src/components}/Notifications/Modal/ModalHeader/ModalHeader.d.ts +0 -0
  543. /package/dist/esm/{components/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.test.d.ts → src/components/Notifications/NotificationProvider/NotificationContext.test.d.ts} +0 -0
  544. /package/dist/esm/{components → src/components}/Notifications/SlideInModal/SlideInModal.d.ts +0 -0
  545. /package/dist/esm/{components/Notifications/Snackbar/SnackbarItem/SnackbarItem.test.d.ts → src/components/Notifications/SlideInModal/SlideInModal.test.d.ts} +0 -0
  546. /package/dist/esm/{components → src/components}/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.d.ts +0 -0
  547. /package/dist/esm/{components/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.test.d.ts → src/components/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.test.d.ts} +0 -0
  548. /package/dist/esm/{components/Pagination/Pagination.test.d.ts → src/components/Notifications/Snackbar/SnackbarItem/SnackbarItem.test.d.ts} +0 -0
  549. /package/dist/esm/{components/Popover/Popover.test.d.ts → src/components/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.test.d.ts} +0 -0
  550. /package/dist/esm/{components/ProgressBar/ProgressBar.test.d.ts → src/components/Pagination/Pagination.test.d.ts} +0 -0
  551. /package/dist/esm/{components → src/components}/Popover/Popover.d.ts +0 -0
  552. /package/dist/esm/{components/Skeleton/Skeleton.test.d.ts → src/components/Popover/Popover.test.d.ts} +0 -0
  553. /package/dist/esm/{components/StatusIndicator/StatusIndicator.test.d.ts → src/components/ProgressBar/ProgressBar.test.d.ts} +0 -0
  554. /package/dist/esm/{components → src/components}/Skeleton/Skeleton.d.ts +0 -0
  555. /package/dist/esm/{components/Tabs/Tab.test.d.ts → src/components/Skeleton/Skeleton.test.d.ts} +0 -0
  556. /package/dist/esm/{components → src/components}/StatusIndicator/StatusIndicator.d.ts +0 -0
  557. /package/dist/esm/{components/Tabs/TabButton.test.d.ts → src/components/StatusIndicator/StatusIndicator.test.d.ts} +0 -0
  558. /package/dist/esm/{components → src/components}/Tabs/Tab.d.ts +0 -0
  559. /package/dist/esm/{components/Tabs/Tabs.test.d.ts → src/components/Tabs/Tab.test.d.ts} +0 -0
  560. /package/dist/esm/{components → src/components}/Tabs/TabButton.d.ts +0 -0
  561. /package/dist/esm/{components/Tiles/Tile.test.d.ts → src/components/Tabs/TabButton.test.d.ts} +0 -0
  562. /package/dist/esm/{components → src/components}/Tabs/Tabs.d.ts +0 -0
  563. /package/dist/esm/{components/Tiles/Tiles.test.d.ts → src/components/Tabs/Tabs.test.d.ts} +0 -0
  564. /package/dist/esm/{components/Tooltip/Tooltip.test.d.ts → src/components/Tag/Tag.test.d.ts} +0 -0
  565. /package/dist/esm/{components → src/components}/TextEllipsis/TextEllipsis.d.ts +0 -0
  566. /package/dist/esm/{components/Typography/Typography.test.d.ts → src/components/TextEllipsis/TextEllipsis.test.d.ts} +0 -0
  567. /package/dist/esm/{components → src/components}/Tiles/Tile.d.ts +0 -0
  568. /package/dist/esm/{components/Wizard/BaseWizardSteps/BaseWizardSteps.test.d.ts → src/components/Tiles/Tile.test.d.ts} +0 -0
  569. /package/dist/esm/{components → src/components}/Tiles/Tiles.d.ts +0 -0
  570. /package/dist/esm/{components/Wizard/Wizard.test.d.ts → src/components/Tiles/Tiles.test.d.ts} +0 -0
  571. /package/dist/esm/{components/Wizard/WizardActions/WizardActions.test.d.ts → src/components/Tooltip/Tooltip.test.d.ts} +0 -0
  572. /package/dist/esm/{components → src/components}/Typography/Typography.d.ts +0 -0
  573. /package/dist/esm/{components/Wizard/WizardSteps/WizardSteps.test.d.ts → src/components/Typography/Typography.test.d.ts} +0 -0
  574. /package/dist/esm/{components → src/components}/Wizard/BaseWizardSteps/BaseWizardSteps.d.ts +0 -0
  575. /package/dist/esm/{components/_BaseStyling_/BaseStyling.test.d.ts → src/components/Wizard/BaseWizardSteps/BaseWizardSteps.test.d.ts} +0 -0
  576. /package/dist/esm/{components → src/components}/Wizard/Wizard.d.ts +0 -0
  577. /package/dist/esm/{hooks/useAnimation.test.d.ts → src/components/Wizard/Wizard.test.d.ts} +0 -0
  578. /package/dist/esm/{hooks/useBodyClick.test.d.ts → src/components/Wizard/WizardActions/WizardActions.test.d.ts} +0 -0
  579. /package/dist/esm/{components → src/components}/Wizard/WizardStateProvider.d.ts +0 -0
  580. /package/dist/esm/{components → src/components}/Wizard/WizardSteps/WizardSteps.d.ts +0 -0
  581. /package/dist/esm/{hooks/useDebouncedCallback.test.d.ts → src/components/Wizard/WizardSteps/WizardSteps.test.d.ts} +0 -0
  582. /package/dist/esm/{components → src/components}/Wizard/wizardStateReducer.d.ts +0 -0
  583. /package/dist/esm/{hooks/useDetermineStatusIcon.test.d.ts → src/components/_BaseStyling_/BaseStyling.test.d.ts} +0 -0
  584. /package/dist/esm/{hooks → src/hooks}/useAnimation.d.ts +0 -0
  585. /package/dist/esm/{hooks/useFormSelector.test.d.ts → src/hooks/useAnimation.test.d.ts} +0 -0
  586. /package/dist/esm/{hooks → src/hooks}/useBodyClick.d.ts +0 -0
  587. /package/dist/esm/{hooks/usePosition.test.d.ts → src/hooks/useBodyClick.test.d.ts} +0 -0
  588. /package/dist/esm/{hooks → src/hooks}/useDebouncedCallback.d.ts +0 -0
  589. /package/dist/esm/{hooks/useScroll.test.d.ts → src/hooks/useDebouncedCallback.test.d.ts} +0 -0
  590. /package/dist/esm/{hooks → src/hooks}/useDetermineStatusIcon.d.ts +0 -0
  591. /package/dist/esm/{hooks/useSpacing.test.d.ts → src/hooks/useDetermineStatusIcon.test.d.ts} +0 -0
  592. /package/dist/esm/{hooks → src/hooks}/useFormSelector.d.ts +0 -0
  593. /package/dist/esm/{hooks/useUploadFile.test.d.ts → src/hooks/useFormSelector.test.d.ts} +0 -0
  594. /package/dist/esm/{hooks → src/hooks}/useGetDomRoot.d.ts +0 -0
  595. /package/dist/esm/{hooks/useWrapper.test.d.ts → src/hooks/usePosition.test.d.ts} +0 -0
  596. /package/dist/esm/{hooks → src/hooks}/useRepeater.d.ts +0 -0
  597. /package/dist/esm/{hooks → src/hooks}/useRepeater.test.d.ts +0 -0
  598. /package/dist/esm/{hooks → src/hooks}/useScroll.d.ts +0 -0
  599. /package/dist/esm/{util/helper.test.d.ts → src/hooks/useScroll.test.d.ts} +0 -0
  600. /package/dist/esm/{hooks → src/hooks}/useSpacing.d.ts +0 -0
  601. /package/dist/esm/{hooks → src/hooks}/useUploadFile.d.ts +0 -0
  602. /package/dist/esm/{hooks → src/hooks}/useWrapper.d.ts +0 -0
@@ -0,0 +1,449 @@
1
+ /*
2
+ * Copyright 2022 OneWelcome B.V.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import React, { useEffect, useState } from "react";
18
+ import { getByTestId, render, renderHook, waitFor } from "@testing-library/react";
19
+ import { NotificationProvider, useNotificationContext } from "./NotificationContext";
20
+ import { Translations } from "./notification.interfaces";
21
+ import { act } from "react-dom/test-utils";
22
+ import { SnackbarProvider } from "../Snackbar/SnackbarProvider/SnackbarProvider";
23
+ import userEvent from "@testing-library/user-event";
24
+ import * as useSnackbarModule from "../Snackbar/useSnackbar";
25
+
26
+ jest.mock("../../../util/helper", () => ({
27
+ generateID: () => "test-id",
28
+ deepMerge: (defaultTranslations: Translations, translations: Translations) => ({
29
+ ...defaultTranslations,
30
+ ...translations
31
+ })
32
+ }));
33
+
34
+ describe("Notification", () => {
35
+ describe("useNotificationContext", () => {
36
+ it("returns the correct context", () => {
37
+ const { result } = renderHook(() => useNotificationContext(), {
38
+ wrapper: NotificationProvider
39
+ });
40
+ expect(result.current).toEqual({
41
+ addNotification: expect.any(Function),
42
+ removeNotification: expect.any(Function),
43
+ resetNotifications: expect.any(Function),
44
+ state: {
45
+ notifications: []
46
+ }
47
+ });
48
+ });
49
+ });
50
+
51
+ describe("Adding and using the notification functions", () => {
52
+ it("Fires the addNotification and removeNotification function", async () => {
53
+ const { result } = renderHook(() => useNotificationContext(), {
54
+ wrapper: NotificationProvider
55
+ });
56
+
57
+ expect(result.current.state.notifications).toEqual([]);
58
+
59
+ await act(() => {
60
+ result.current.addNotification({
61
+ type: "error",
62
+ status: 401,
63
+ message: "Test Error"
64
+ });
65
+ });
66
+
67
+ expect(result.current.state.notifications).toEqual([
68
+ {
69
+ id: "test-id",
70
+ type: "error",
71
+ status: 401,
72
+ message: "Test Error",
73
+ handled: true
74
+ }
75
+ ]);
76
+
77
+ await act(() => {
78
+ result.current.removeNotification("test-id");
79
+ });
80
+
81
+ expect(result.current.state.notifications).toEqual([]);
82
+ });
83
+
84
+ it("Fires the resetNotifications function", async () => {
85
+ const { result } = renderHook(() => useNotificationContext(), {
86
+ wrapper: NotificationProvider
87
+ });
88
+
89
+ expect(result.current.state.notifications).toEqual([]);
90
+
91
+ await act(() => {
92
+ result.current.addNotification({
93
+ type: "error",
94
+ status: 401,
95
+ message: "Test Error"
96
+ });
97
+ });
98
+
99
+ expect(result.current.state.notifications).toEqual([
100
+ {
101
+ id: "test-id",
102
+ type: "error",
103
+ status: 401,
104
+ message: "Test Error",
105
+ handled: true
106
+ }
107
+ ]);
108
+
109
+ await act(() => {
110
+ result.current.resetNotifications();
111
+ });
112
+
113
+ expect(result.current.state.notifications).toEqual([]);
114
+ });
115
+ });
116
+
117
+ describe("Translations", () => {
118
+ it("Translates the status 400, 401 and 403 translations", async () => {
119
+ const enqueueErrorSnackbarMock = jest.fn();
120
+
121
+ jest.spyOn(useSnackbarModule, "useSnackbar").mockImplementation(() => ({
122
+ enqueueWarningSnackbar: jest.fn(),
123
+ enqueueErrorSnackbar: enqueueErrorSnackbarMock,
124
+ enqueueSuccessSnackbar: jest.fn(),
125
+ enqueueSnackbar: jest.fn()
126
+ }));
127
+
128
+ const providedTranslations = {
129
+ general: { error: "TestError" },
130
+ messages: {
131
+ unauthorized: "Test unauthorized",
132
+ badRequest: "Test bad request",
133
+ forbidden: "Test forbidden"
134
+ }
135
+ };
136
+
137
+ const TestComponent = () => {
138
+ const { addNotification, state } = useNotificationContext();
139
+
140
+ useEffect(() => {
141
+ (async () => {
142
+ if (state.notifications.length === 3) {
143
+ await waitFor(() =>
144
+ expect(state.notifications).toEqual([
145
+ {
146
+ id: "test-id",
147
+ type: "error",
148
+ status: 400,
149
+ message: "TestError",
150
+ handled: true
151
+ },
152
+ {
153
+ id: "test-id",
154
+ type: "error",
155
+ status: 401,
156
+ message: "TestError",
157
+ handled: true
158
+ },
159
+ {
160
+ id: "test-id",
161
+ type: "error",
162
+ status: 403,
163
+ message: "TestError",
164
+ handled: true
165
+ }
166
+ ])
167
+ );
168
+ }
169
+ })();
170
+ }, [state.notifications]);
171
+
172
+ useEffect(() => {
173
+ (async () => {
174
+ await act(() => {
175
+ addNotification({ type: "error", status: 400 });
176
+ addNotification({ type: "error", status: 401 });
177
+ addNotification({ type: "error", status: 403 });
178
+ });
179
+ })();
180
+ }, []);
181
+
182
+ return null;
183
+ };
184
+
185
+ render(
186
+ <NotificationProvider translations={providedTranslations}>
187
+ <TestComponent />
188
+ </NotificationProvider>
189
+ );
190
+
191
+ await waitFor(() => {
192
+ expect(enqueueErrorSnackbarMock).toHaveBeenCalledTimes(3);
193
+ expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test bad request", {
194
+ onClose: expect.any(Function)
195
+ });
196
+ expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test unauthorized", {
197
+ onClose: expect.any(Function)
198
+ });
199
+ expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test forbidden", {
200
+ onClose: expect.any(Function)
201
+ });
202
+ });
203
+ });
204
+
205
+ it("Translates the status 404, 500 and 502 translations", async () => {
206
+ const enqueueErrorSnackbarMock = jest.fn();
207
+
208
+ jest.spyOn(useSnackbarModule, "useSnackbar").mockImplementation(() => ({
209
+ enqueueWarningSnackbar: jest.fn(),
210
+ enqueueErrorSnackbar: enqueueErrorSnackbarMock,
211
+ enqueueSuccessSnackbar: jest.fn(),
212
+ enqueueSnackbar: jest.fn()
213
+ }));
214
+
215
+ const providedTranslations = {
216
+ general: { error: "TestError" },
217
+ messages: {
218
+ notFound: "Test not found",
219
+ general: "Test general",
220
+ unavailable: "Test unavailable"
221
+ }
222
+ };
223
+
224
+ const TestComponent = () => {
225
+ const { addNotification, state } = useNotificationContext();
226
+
227
+ useEffect(() => {
228
+ (async () => {
229
+ if (state.notifications.length === 3) {
230
+ await waitFor(() =>
231
+ expect(state.notifications).toEqual([
232
+ {
233
+ id: "test-id",
234
+ type: "error",
235
+ status: 404,
236
+ message: "TestError",
237
+ handled: true
238
+ },
239
+ {
240
+ id: "test-id",
241
+ type: "error",
242
+ status: 500,
243
+ message: "TestError",
244
+ handled: true
245
+ },
246
+ {
247
+ id: "test-id",
248
+ type: "error",
249
+ status: 502,
250
+ message: "TestError",
251
+ handled: true
252
+ }
253
+ ])
254
+ );
255
+ }
256
+ })();
257
+ }, [state.notifications]);
258
+
259
+ useEffect(() => {
260
+ (async () => {
261
+ await act(() => {
262
+ addNotification({ type: "error", status: 404 });
263
+ addNotification({ type: "error", status: 500 });
264
+ addNotification({ type: "error", status: 502 });
265
+ });
266
+ })();
267
+ }, []);
268
+
269
+ return null;
270
+ };
271
+
272
+ render(
273
+ <NotificationProvider translations={providedTranslations}>
274
+ <TestComponent />
275
+ </NotificationProvider>
276
+ );
277
+
278
+ await waitFor(() => {
279
+ expect(enqueueErrorSnackbarMock).toHaveBeenCalledTimes(3);
280
+ expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test not found", {
281
+ onClose: expect.any(Function)
282
+ });
283
+ expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test general", {
284
+ onClose: expect.any(Function)
285
+ });
286
+ expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test unavailable", {
287
+ onClose: expect.any(Function)
288
+ });
289
+ });
290
+ });
291
+
292
+ it("Translates the status 503, 504 and general if the code isn't recognized", async () => {
293
+ const enqueueErrorSnackbarMock = jest.fn();
294
+
295
+ jest.spyOn(useSnackbarModule, "useSnackbar").mockImplementation(() => ({
296
+ enqueueWarningSnackbar: jest.fn(),
297
+ enqueueErrorSnackbar: enqueueErrorSnackbarMock,
298
+ enqueueSuccessSnackbar: jest.fn(),
299
+ enqueueSnackbar: jest.fn()
300
+ }));
301
+
302
+ const providedTranslations = {
303
+ general: { error: "TestError" },
304
+ messages: {
305
+ timeout: "Test timeout",
306
+ general: "Test general",
307
+ unavailable: "Test unavailable"
308
+ }
309
+ };
310
+
311
+ const TestComponent = () => {
312
+ const { addNotification, state } = useNotificationContext();
313
+
314
+ useEffect(() => {
315
+ (async () => {
316
+ if (state.notifications.length === 3) {
317
+ await waitFor(() =>
318
+ expect(state.notifications).toEqual([
319
+ {
320
+ id: "test-id",
321
+ type: "error",
322
+ status: 503,
323
+ message: "TestError",
324
+ handled: true
325
+ },
326
+ {
327
+ id: "test-id",
328
+ type: "error",
329
+ status: 504,
330
+ message: "TestError",
331
+ handled: true
332
+ },
333
+ {
334
+ id: "test-id",
335
+ type: "error",
336
+ status: 999,
337
+ message: "TestError",
338
+ handled: true
339
+ }
340
+ ])
341
+ );
342
+ }
343
+ })();
344
+ }, [state.notifications]);
345
+
346
+ useEffect(() => {
347
+ (async () => {
348
+ await act(() => {
349
+ addNotification({ type: "error", status: 503 });
350
+ addNotification({ type: "error", status: 504 });
351
+ // @ts-ignore-next-line - We want to test the default case
352
+ addNotification({ type: "error", status: 999 });
353
+ });
354
+ })();
355
+ }, []);
356
+
357
+ return null;
358
+ };
359
+
360
+ render(
361
+ <NotificationProvider translations={providedTranslations}>
362
+ <TestComponent />
363
+ </NotificationProvider>
364
+ );
365
+
366
+ await waitFor(() => {
367
+ expect(enqueueErrorSnackbarMock).toHaveBeenCalledTimes(3);
368
+ expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test timeout", {
369
+ onClose: expect.any(Function)
370
+ });
371
+ expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test general", {
372
+ onClose: expect.any(Function)
373
+ });
374
+ expect(enqueueErrorSnackbarMock).toHaveBeenCalledWith("TestError", "Test unavailable", {
375
+ onClose: expect.any(Function)
376
+ });
377
+ });
378
+ });
379
+ });
380
+ });
381
+
382
+ const renderSnackbarProvider = () => {
383
+ const AppComponent = () => {
384
+ const { addNotification } = useNotificationContext();
385
+ const [index, setIndex] = useState(0);
386
+ return (
387
+ <div>
388
+ content
389
+ <button
390
+ data-testid="show-success"
391
+ onClick={() => {
392
+ addNotification({
393
+ status: 200,
394
+ type: "success",
395
+ title: "Test Success",
396
+ message: "Test successful request"
397
+ });
398
+ setIndex(index + 1);
399
+ }}
400
+ >
401
+ Success
402
+ </button>
403
+ <button
404
+ data-testid="show-error"
405
+ onClick={() => {
406
+ addNotification({
407
+ status: 400,
408
+ type: "error",
409
+ title: "TestError",
410
+ message: "Test bad request"
411
+ });
412
+ setIndex(index + 1);
413
+ }}
414
+ >
415
+ Error
416
+ </button>
417
+ </div>
418
+ );
419
+ };
420
+
421
+ const queries = render(
422
+ <SnackbarProvider closeButtonTitle="close">
423
+ <NotificationProvider>
424
+ <AppComponent />
425
+ </NotificationProvider>
426
+ </SnackbarProvider>
427
+ );
428
+
429
+ const showSuccessSnackbarBtn = getByTestId(queries.container, "show-success");
430
+ const showErrorSnackbarBtn = getByTestId(queries.container, "show-error");
431
+
432
+ return {
433
+ ...queries,
434
+ showSuccessSnackbarBtn,
435
+ showErrorSnackbarBtn
436
+ };
437
+ };
438
+
439
+ describe("Actually shows the snackbars showing up", () => {
440
+ it("Shows the snackbars", async () => {
441
+ const { showSuccessSnackbarBtn, showErrorSnackbarBtn, getByText } = renderSnackbarProvider();
442
+
443
+ await userEvent.click(showSuccessSnackbarBtn);
444
+ await userEvent.click(showErrorSnackbarBtn);
445
+
446
+ await waitFor(() => expect(getByText("Test Success")).toBeInTheDocument());
447
+ await waitFor(() => expect(getByText("Test bad request")).toBeInTheDocument());
448
+ });
449
+ });
@@ -0,0 +1,221 @@
1
+ /*
2
+ * Copyright 2022 OneWelcome B.V.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import React, {
18
+ ReactNode,
19
+ createContext,
20
+ useCallback,
21
+ useContext,
22
+ useEffect,
23
+ useReducer
24
+ } from "react";
25
+ import {
26
+ Notification,
27
+ ErrorNotification,
28
+ SuccessNotification,
29
+ Translations,
30
+ AddNotification
31
+ } from "./notification.interfaces";
32
+ import { defaultTranslations } from "./NotificationService";
33
+ import { useSnackbar } from "../Snackbar/useSnackbar";
34
+ import { deepMerge, generateID } from "../../../util/helper";
35
+ import { DeepPartial } from "../../../interfaces";
36
+
37
+ interface NotificationState {
38
+ notifications: Notification<ErrorNotification | SuccessNotification>[];
39
+ }
40
+
41
+ export interface NotificationAction {
42
+ type: "add" | "remove" | "handled" | "reset";
43
+ payload?: Notification<ErrorNotification | SuccessNotification> & {
44
+ id?: string;
45
+ handled?: boolean;
46
+ };
47
+ }
48
+
49
+ const initialState: NotificationState = {
50
+ notifications: []
51
+ };
52
+
53
+ export interface NotificationHandlerProps {
54
+ translations?: DeepPartial<Translations>;
55
+ dispatchFn: React.Dispatch<NotificationAction>;
56
+ }
57
+
58
+ export const NotificationHandler = ({
59
+ translations = {},
60
+ dispatchFn
61
+ }: NotificationHandlerProps) => {
62
+ const { enqueueErrorSnackbar, enqueueSuccessSnackbar } = useSnackbar();
63
+ const {
64
+ state: { notifications }
65
+ } = useNotificationContext();
66
+
67
+ const mergedTranslations = deepMerge<Translations>(defaultTranslations, translations);
68
+
69
+ const determineNotificationMessage = (notification: Notification<ErrorNotification>) => {
70
+ if (notification.message) {
71
+ return notification.message;
72
+ }
73
+
74
+ switch (notification.status) {
75
+ case 500:
76
+ return mergedTranslations.messages.general;
77
+ case 400:
78
+ return mergedTranslations.messages.badRequest;
79
+ case 401:
80
+ return mergedTranslations.messages.unauthorized;
81
+ case 403:
82
+ return mergedTranslations.messages.forbidden;
83
+ case 404:
84
+ return mergedTranslations.messages.notFound;
85
+ case 502:
86
+ case 503:
87
+ return mergedTranslations.messages.unavailable;
88
+ case 504:
89
+ return mergedTranslations.messages.timeout;
90
+ default:
91
+ return mergedTranslations.messages.general;
92
+ }
93
+ };
94
+
95
+ useEffect(() => {
96
+ notifications.forEach(notification => {
97
+ if (
98
+ notification.status &&
99
+ notification.handled &&
100
+ (notification.status === 401 || notification.status === 403)
101
+ ) {
102
+ dispatchFn({ type: "remove", payload: { id: notification.id } });
103
+ } else if (notification.status && !notification.handled && notification.type === "error") {
104
+ enqueueErrorSnackbar(
105
+ notification.title ?? mergedTranslations.general.error,
106
+ determineNotificationMessage(notification as Notification<ErrorNotification>),
107
+ {
108
+ onClose: () => dispatchFn({ type: "remove", payload: { id: notification.id } })
109
+ }
110
+ );
111
+ dispatchFn({ type: "handled", payload: { id: notification.id, handled: true } });
112
+ } else if (notification.title && !notification.handled && notification.type === "success") {
113
+ enqueueSuccessSnackbar(
114
+ notification.title ?? mergedTranslations.general.success,
115
+ notification.message,
116
+ {
117
+ onClose: () => dispatchFn({ type: "remove", payload: { id: notification.id } })
118
+ }
119
+ );
120
+
121
+ dispatchFn({ type: "handled", payload: { id: notification.id, handled: true } });
122
+ }
123
+ });
124
+ }, [notifications.length]);
125
+
126
+ return null;
127
+ };
128
+
129
+ export const NotificationContext = createContext<{
130
+ state: NotificationState;
131
+ dispatch: React.Dispatch<NotificationAction>;
132
+ }>({
133
+ state: initialState,
134
+ dispatch: () => undefined
135
+ });
136
+
137
+ export interface Props {
138
+ children?: ReactNode;
139
+ translations?: DeepPartial<Translations>;
140
+ }
141
+
142
+ export const NotificationProvider = ({ children, translations }: Props) => {
143
+ const [state, dispatch] = useReducer(notificationReducer, initialState);
144
+
145
+ return (
146
+ <NotificationContext.Provider value={{ state, dispatch }}>
147
+ {children}
148
+ <NotificationHandler translations={translations} dispatchFn={dispatch} />
149
+ </NotificationContext.Provider>
150
+ );
151
+ };
152
+
153
+ export const useNotificationContext = () => {
154
+ const ctx = useContext(NotificationContext);
155
+
156
+ const addNotification = useCallback(
157
+ (notification: AddNotification) => {
158
+ ctx.dispatch({ type: "add", payload: notification });
159
+ },
160
+ [ctx]
161
+ );
162
+
163
+ const removeNotification = useCallback(
164
+ (id: string) => {
165
+ ctx.dispatch({ type: "remove", payload: { id } });
166
+ },
167
+ [ctx]
168
+ );
169
+
170
+ const resetNotifications = useCallback(() => {
171
+ ctx.dispatch({ type: "reset" });
172
+ }, [ctx]);
173
+
174
+ return {
175
+ state: ctx.state,
176
+ addNotification,
177
+ removeNotification,
178
+ resetNotifications
179
+ };
180
+ };
181
+
182
+ export const notificationReducer = (
183
+ state: NotificationState,
184
+ action: NotificationAction
185
+ ): NotificationState => {
186
+ switch (action.type) {
187
+ case "add":
188
+ return {
189
+ ...state,
190
+ notifications: [
191
+ ...state.notifications,
192
+ {
193
+ ...action.payload,
194
+ id: generateID(),
195
+ handled: false
196
+ }
197
+ ]
198
+ };
199
+ case "remove":
200
+ return {
201
+ ...state,
202
+ notifications: state.notifications.filter(
203
+ notification => notification.id !== action.payload?.id
204
+ )
205
+ };
206
+ case "handled":
207
+ return {
208
+ ...state,
209
+ notifications: state.notifications.map(notification =>
210
+ notification.id === action.payload?.id ? { ...notification, handled: true } : notification
211
+ )
212
+ };
213
+ case "reset":
214
+ return {
215
+ ...state,
216
+ notifications: []
217
+ };
218
+ default:
219
+ return state;
220
+ }
221
+ };
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright 2022 OneWelcome B.V.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { Translations } from "./notification.interfaces";
18
+
19
+ export const defaultTranslations: Translations = {
20
+ general: {
21
+ error: "Error",
22
+ success: "Success"
23
+ },
24
+ messages: {
25
+ general: "Something went wrong. Please try again later.",
26
+ badRequest: "Bad request",
27
+ unauthorized: "You are not authorized to perform this action.",
28
+ forbidden: "You are not allowed to perform this action.",
29
+ notFound: "The requested resource could not be found.",
30
+ timeout: "The request timed out.",
31
+ unavailable: "The server is currently unavailable. Please try again later."
32
+ }
33
+ };