@luscii-healthtech/web-ui 0.1.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 (311) hide show
  1. package/README.md +181 -0
  2. package/dist/components/Acknowledgement/Acknowledgement.d.ts +22 -0
  3. package/dist/components/Avatar/Avatar.d.ts +29 -0
  4. package/dist/components/Badge/Badge.d.ts +7 -0
  5. package/dist/components/Button/Button.d.ts +5 -0
  6. package/dist/components/Button/Button.types.d.ts +32 -0
  7. package/dist/components/Button/ButtonIcon.d.ts +7 -0
  8. package/dist/components/ButtonV2/ButtonV2.d.ts +13 -0
  9. package/dist/components/ButtonV2/PrimaryButton.d.ts +12 -0
  10. package/dist/components/ButtonV2/SecondaryButton.d.ts +8 -0
  11. package/dist/components/ButtonV2/TertiaryButton.d.ts +8 -0
  12. package/dist/components/Carousel/Carousel.d.ts +8 -0
  13. package/dist/components/Carousel/GliderContainer.d.ts +7 -0
  14. package/dist/components/CenteredHero/CenteredHero.d.ts +22 -0
  15. package/dist/components/Checkbox/Checkbox.d.ts +17 -0
  16. package/dist/components/ConfirmationDialog/ConfirmationDialog.d.ts +33 -0
  17. package/dist/components/Datepicker/Datepicker.d.ts +24 -0
  18. package/dist/components/Dropdown/Dropdown.d.ts +47 -0
  19. package/dist/components/EmptyListMessage/EmptyListMessage.d.ts +14 -0
  20. package/dist/components/ErrorBlock/ErrorBlock.d.ts +13 -0
  21. package/dist/components/Icons/AddIcon.d.ts +3 -0
  22. package/dist/components/Icons/AlertsIcon.d.ts +6 -0
  23. package/dist/components/Icons/BellIcon.d.ts +6 -0
  24. package/dist/components/Icons/ChartIcon.d.ts +3 -0
  25. package/dist/components/Icons/ChatBox.d.ts +5 -0
  26. package/dist/components/Icons/CheckIcon.d.ts +2 -0
  27. package/dist/components/Icons/ChevronIcon.d.ts +8 -0
  28. package/dist/components/Icons/CrossIcon.d.ts +7 -0
  29. package/dist/components/Icons/DeleteIcon.d.ts +6 -0
  30. package/dist/components/Icons/DownArrowIcon.d.ts +6 -0
  31. package/dist/components/Icons/DragIcon.d.ts +3 -0
  32. package/dist/components/Icons/EditIcon.d.ts +6 -0
  33. package/dist/components/Icons/EmptyStateDashboardIcon.d.ts +2 -0
  34. package/dist/components/Icons/ExclamationMarkIcon.d.ts +6 -0
  35. package/dist/components/Icons/EyeIcon.d.ts +3 -0
  36. package/dist/components/Icons/GearIcon.d.ts +3 -0
  37. package/dist/components/Icons/GroupIcon.d.ts +3 -0
  38. package/dist/components/Icons/HeartIcon.d.ts +6 -0
  39. package/dist/components/Icons/LeftArrowIcon.d.ts +6 -0
  40. package/dist/components/Icons/LightBulbIcon.d.ts +6 -0
  41. package/dist/components/Icons/LockIcon.d.ts +6 -0
  42. package/dist/components/Icons/MessagesIcon.d.ts +6 -0
  43. package/dist/components/Icons/NotesIcon.d.ts +6 -0
  44. package/dist/components/Icons/PinIcon.d.ts +6 -0
  45. package/dist/components/Icons/PrintIcon.d.ts +3 -0
  46. package/dist/components/Icons/RightArrowIcon.d.ts +6 -0
  47. package/dist/components/Icons/SmallCircleIcon.d.ts +6 -0
  48. package/dist/components/Icons/SmallDiamondIcon.d.ts +6 -0
  49. package/dist/components/Icons/SmallSquareIcon.d.ts +6 -0
  50. package/dist/components/Icons/SpaceRocketIcon.d.ts +6 -0
  51. package/dist/components/Icons/types/IconProps.type.d.ts +3 -0
  52. package/dist/components/InfoBlock/InfoBlock.d.ts +14 -0
  53. package/dist/components/InfoField/InfoField.d.ts +18 -0
  54. package/dist/components/Input/Input.d.ts +44 -0
  55. package/dist/components/Line/Line.d.ts +14 -0
  56. package/dist/components/ListItem/ListItem.d.ts +9 -0
  57. package/dist/components/ListTable/ListTable.d.ts +35 -0
  58. package/dist/components/ListTable/ListTableCell.d.ts +10 -0
  59. package/dist/components/ListTable/ListTableHeader.d.ts +7 -0
  60. package/dist/components/ListTable/ListTableRow.d.ts +9 -0
  61. package/dist/components/LoadingIndicator/LoadingIndicator.d.ts +11 -0
  62. package/dist/components/Menu/Menu.d.ts +14 -0
  63. package/dist/components/Modal/Modal.d.ts +31 -0
  64. package/dist/components/Modal/ModalWithButtons.d.ts +9 -0
  65. package/dist/components/MultiSelect/MultiSelect.d.ts +25 -0
  66. package/dist/components/MultiSelect/MultiSelectUtils.d.ts +1 -0
  67. package/dist/components/NavMenu/NavLayout.d.ts +20 -0
  68. package/dist/components/NavMenu/NavMenu.d.ts +1 -0
  69. package/dist/components/NavMenu/NavMenuContent.d.ts +7 -0
  70. package/dist/components/NavMenu/NavMenuItem.d.ts +15 -0
  71. package/dist/components/NotificationBanner/NotificationBanner.d.ts +22 -0
  72. package/dist/components/Page/CRUDPage.d.ts +43 -0
  73. package/dist/components/Page/Page.d.ts +58 -0
  74. package/dist/components/PaginationMenu/PaginationMenu.d.ts +20 -0
  75. package/dist/components/PaginationMenu/PaginationMenuLarge.d.ts +13 -0
  76. package/dist/components/PaginationMenu/PaginationMenuSmall.d.ts +8 -0
  77. package/dist/components/PreviewPhone/PreviewPhone.d.ts +7 -0
  78. package/dist/components/PreviewPhone/useWindowDimensions.d.ts +4 -0
  79. package/dist/components/Radio/Radio.d.ts +18 -0
  80. package/dist/components/RadioGroup/RadioGroup.d.ts +31 -0
  81. package/dist/components/Section/Section.d.ts +15 -0
  82. package/dist/components/Select/LegacySelect.d.ts +32 -0
  83. package/dist/components/Select/Select.d.ts +6 -0
  84. package/dist/components/Select/options.transformer.d.ts +14 -0
  85. package/dist/components/Select/select.utils.d.ts +7 -0
  86. package/dist/components/SettingsMenuButton/SettingsMenuButton.d.ts +16 -0
  87. package/dist/components/Spinner/Spinner.d.ts +6 -0
  88. package/dist/components/Steps/Step.d.ts +10 -0
  89. package/dist/components/Steps/Steps.d.ts +11 -0
  90. package/dist/components/Switcher/Switcher.d.ts +26 -0
  91. package/dist/components/Switcher/SwitcherItem.d.ts +24 -0
  92. package/dist/components/TabLinks/TabLinks.d.ts +14 -0
  93. package/dist/components/Tabbar/Tabbar.d.ts +10 -0
  94. package/dist/components/Tabbar/TabbarItem.d.ts +15 -0
  95. package/dist/components/Tag/Tag.d.ts +17 -0
  96. package/dist/components/Tag/TagGroup.d.ts +13 -0
  97. package/dist/components/Text/LegacyText.d.ts +37 -0
  98. package/dist/components/Text/Text.d.ts +27 -0
  99. package/dist/components/TextEditor/TextEditor.d.ts +14 -0
  100. package/dist/components/TextEditorV2/TextEditorV2.d.ts +6 -0
  101. package/dist/components/TextLink/TextLink.d.ts +11 -0
  102. package/dist/components/TextListItem/TextListItem.d.ts +12 -0
  103. package/dist/components/Textarea/Textarea.d.ts +22 -0
  104. package/dist/components/Title/LegacyTitle.d.ts +22 -0
  105. package/dist/components/Title/Title.d.ts +14 -0
  106. package/dist/components/ViewItem/ViewItem.d.ts +16 -0
  107. package/dist/index.d.ts +8 -0
  108. package/dist/index.js +8 -0
  109. package/dist/types/general.types.d.ts +7 -0
  110. package/dist/utils/useOutsideClick.d.ts +2 -0
  111. package/dist/web-ui.cjs.development.js +23 -0
  112. package/dist/web-ui.cjs.development.js.map +1 -0
  113. package/dist/web-ui.cjs.production.min.js +2 -0
  114. package/dist/web-ui.cjs.production.min.js.map +1 -0
  115. package/dist/web-ui.esm.js +17 -0
  116. package/dist/web-ui.esm.js.map +1 -0
  117. package/package.json +122 -0
  118. package/src/assets/add.svg +5 -0
  119. package/src/assets/add_hover.svg +4 -0
  120. package/src/assets/big-menu-icon-hover.svg +6 -0
  121. package/src/assets/big-menu-icon.svg +6 -0
  122. package/src/assets/check-cross-icon.svg +7 -0
  123. package/src/assets/check-icon-primary.svg +5 -0
  124. package/src/assets/check-icon.svg +3 -0
  125. package/src/assets/chevron-double.svg +3 -0
  126. package/src/assets/close.svg +3 -0
  127. package/src/assets/color-variant-cross.svg +3 -0
  128. package/src/assets/cross-dark.svg +3 -0
  129. package/src/assets/delete.svg +4 -0
  130. package/src/assets/delete_hover.svg +4 -0
  131. package/src/assets/edit.svg +6 -0
  132. package/src/assets/edit_hover.svg +6 -0
  133. package/src/assets/error-icon.svg +7 -0
  134. package/src/assets/grid-view-icon-active.svg +6 -0
  135. package/src/assets/grid-view-icon.svg +6 -0
  136. package/src/assets/groups.svg +3 -0
  137. package/src/assets/hamburger.svg +5 -0
  138. package/src/assets/happy-star.svg +9 -0
  139. package/src/assets/hcps.svg +3 -0
  140. package/src/assets/info-icon.svg +6 -0
  141. package/src/assets/left-arrow-blue.svg +3 -0
  142. package/src/assets/left-arrow-grey.svg +3 -0
  143. package/src/assets/list-view-icon-active.svg +3 -0
  144. package/src/assets/list-view-icon.svg +3 -0
  145. package/src/assets/loading.svg +16 -0
  146. package/src/assets/modal-close-icon-active.svg +9 -0
  147. package/src/assets/modal-close-icon.svg +9 -0
  148. package/src/assets/no-open-alerts.svg +19 -0
  149. package/src/assets/patients.svg +3 -0
  150. package/src/assets/phone-mockup.svg +9 -0
  151. package/src/assets/programs.svg +3 -0
  152. package/src/assets/right-arrow-blue.svg +3 -0
  153. package/src/assets/right-arrow-grey.svg +3 -0
  154. package/src/assets/search-cancel.svg +3 -0
  155. package/src/assets/search-not-found.svg +70 -0
  156. package/src/assets/search.svg +3 -0
  157. package/src/assets/spinner-gray.svg +6 -0
  158. package/src/assets/spinner.svg +6 -0
  159. package/src/assets/starIcon.svg +3 -0
  160. package/src/assets/success-icon.svg +7 -0
  161. package/src/components/Acknowledgement/Acknowledgement.js +61 -0
  162. package/src/components/Acknowledgement/Acknowledgement.scss +49 -0
  163. package/src/components/Avatar/Avatar.js +81 -0
  164. package/src/components/Avatar/Avatar.scss +153 -0
  165. package/src/components/Badge/Badge.tsx +23 -0
  166. package/src/components/Button/Button.examples.md +46 -0
  167. package/src/components/Button/Button.tsx +200 -0
  168. package/src/components/Button/Button.types.ts +41 -0
  169. package/src/components/Button/ButtonIcon.tsx +42 -0
  170. package/src/components/ButtonV2/ButtonV2.tsx +91 -0
  171. package/src/components/ButtonV2/PrimaryButton.tsx +43 -0
  172. package/src/components/ButtonV2/SecondaryButton.tsx +31 -0
  173. package/src/components/ButtonV2/TertiaryButton.tsx +31 -0
  174. package/src/components/Carousel/Carousel.tsx +52 -0
  175. package/src/components/Carousel/GliderContainer.scss +13 -0
  176. package/src/components/Carousel/GliderContainer.tsx +22 -0
  177. package/src/components/CenteredHero/CenteredHero.js +50 -0
  178. package/src/components/Checkbox/Checkbox.scss +115 -0
  179. package/src/components/Checkbox/Checkbox.tsx +114 -0
  180. package/src/components/ConfirmationDialog/ConfirmationDialog.scss +15 -0
  181. package/src/components/ConfirmationDialog/ConfirmationDialog.tsx +84 -0
  182. package/src/components/Datepicker/Datepicker.js +96 -0
  183. package/src/components/Datepicker/Datepicker.scss +331 -0
  184. package/src/components/Dropdown/Dropdown.js +364 -0
  185. package/src/components/Dropdown/Dropdown.scss +83 -0
  186. package/src/components/EmptyListMessage/EmptyListMessage.tsx +34 -0
  187. package/src/components/ErrorBlock/ErrorBlock.js +24 -0
  188. package/src/components/ErrorBlock/ErrorBlock.scss +20 -0
  189. package/src/components/Icons/AddIcon.tsx +27 -0
  190. package/src/components/Icons/AlertsIcon.tsx +26 -0
  191. package/src/components/Icons/BellIcon.tsx +26 -0
  192. package/src/components/Icons/ChartIcon.tsx +20 -0
  193. package/src/components/Icons/ChatBox.tsx +23 -0
  194. package/src/components/Icons/CheckIcon.tsx +23 -0
  195. package/src/components/Icons/ChevronIcon.tsx +30 -0
  196. package/src/components/Icons/CrossIcon.tsx +26 -0
  197. package/src/components/Icons/DeleteIcon.tsx +23 -0
  198. package/src/components/Icons/DownArrowIcon.tsx +17 -0
  199. package/src/components/Icons/DragIcon.tsx +23 -0
  200. package/src/components/Icons/EditIcon.tsx +23 -0
  201. package/src/components/Icons/EmptyStateDashboardIcon.tsx +130 -0
  202. package/src/components/Icons/ExclamationMarkIcon.tsx +23 -0
  203. package/src/components/Icons/EyeIcon.tsx +21 -0
  204. package/src/components/Icons/GearIcon.tsx +21 -0
  205. package/src/components/Icons/GroupIcon.tsx +21 -0
  206. package/src/components/Icons/HeartIcon.tsx +23 -0
  207. package/src/components/Icons/LeftArrowIcon.tsx +23 -0
  208. package/src/components/Icons/LightBulbIcon.tsx +28 -0
  209. package/src/components/Icons/LockIcon.tsx +23 -0
  210. package/src/components/Icons/MessagesIcon.tsx +23 -0
  211. package/src/components/Icons/NotesIcon.tsx +23 -0
  212. package/src/components/Icons/PinIcon.tsx +23 -0
  213. package/src/components/Icons/PrintIcon.tsx +15 -0
  214. package/src/components/Icons/RightArrowIcon.tsx +23 -0
  215. package/src/components/Icons/SmallCircleIcon.tsx +21 -0
  216. package/src/components/Icons/SmallDiamondIcon.tsx +31 -0
  217. package/src/components/Icons/SmallSquareIcon.tsx +21 -0
  218. package/src/components/Icons/SpaceRocketIcon.tsx +23 -0
  219. package/src/components/Icons/types/IconProps.type.ts +3 -0
  220. package/src/components/InfoBlock/InfoBlock.js +24 -0
  221. package/src/components/InfoBlock/InfoBlock.scss +20 -0
  222. package/src/components/InfoField/InfoField.tsx +86 -0
  223. package/src/components/Input/Input.examples.md +94 -0
  224. package/src/components/Input/Input.js +141 -0
  225. package/src/components/Line/Line.js +38 -0
  226. package/src/components/ListItem/ListItem.scss +20 -0
  227. package/src/components/ListItem/ListItem.tsx +26 -0
  228. package/src/components/ListTable/ListTable.tsx +157 -0
  229. package/src/components/ListTable/ListTableCell.tsx +67 -0
  230. package/src/components/ListTable/ListTableHeader.tsx +33 -0
  231. package/src/components/ListTable/ListTableRow.tsx +46 -0
  232. package/src/components/LoadingIndicator/LoadingIndicator.scss +50 -0
  233. package/src/components/LoadingIndicator/LoadingIndicator.tsx +44 -0
  234. package/src/components/Menu/Menu.js +74 -0
  235. package/src/components/Menu/Menu.scss +27 -0
  236. package/src/components/Modal/Modal.scss +117 -0
  237. package/src/components/Modal/Modal.tsx +104 -0
  238. package/src/components/Modal/ModalWithButtons.tsx +34 -0
  239. package/src/components/MultiSelect/MultiSelect.js +117 -0
  240. package/src/components/MultiSelect/MultiSelect.scss +29 -0
  241. package/src/components/MultiSelect/MultiSelectUtils.js +23 -0
  242. package/src/components/NavMenu/NavLayout.tsx +40 -0
  243. package/src/components/NavMenu/NavMenu.js +35 -0
  244. package/src/components/NavMenu/NavMenuContent.tsx +23 -0
  245. package/src/components/NavMenu/NavMenuItem.tsx +96 -0
  246. package/src/components/NotificationBanner/NotificationBanner.tsx +57 -0
  247. package/src/components/Page/CRUDPage.js +123 -0
  248. package/src/components/Page/CRUDPage.scss +32 -0
  249. package/src/components/Page/Page.js +102 -0
  250. package/src/components/Page/Page.scss +59 -0
  251. package/src/components/PaginationMenu/PaginationMenu.js +31 -0
  252. package/src/components/PaginationMenu/PaginationMenuLarge.tsx +94 -0
  253. package/src/components/PaginationMenu/PaginationMenuSmall.tsx +40 -0
  254. package/src/components/PreviewPhone/PreviewPhone.tsx +53 -0
  255. package/src/components/PreviewPhone/useWindowDimensions.js +26 -0
  256. package/src/components/Radio/Radio.js +99 -0
  257. package/src/components/Radio/Radio.scss +58 -0
  258. package/src/components/RadioGroup/RadioGroup.js +63 -0
  259. package/src/components/RadioGroup/RadioGroup.scss +37 -0
  260. package/src/components/Section/Section.scss +74 -0
  261. package/src/components/Section/Section.tsx +67 -0
  262. package/src/components/Select/LegacySelect.js +114 -0
  263. package/src/components/Select/Select.examples.md +161 -0
  264. package/src/components/Select/Select.tsx +136 -0
  265. package/src/components/Select/options.transformer.ts +36 -0
  266. package/src/components/Select/select.utils.spec.ts +63 -0
  267. package/src/components/Select/select.utils.ts +45 -0
  268. package/src/components/SettingsMenuButton/SettingsMenuButton.tsx +111 -0
  269. package/src/components/Spinner/Spinner.tsx +23 -0
  270. package/src/components/Steps/Step.tsx +22 -0
  271. package/src/components/Steps/Steps.tsx +24 -0
  272. package/src/components/Switcher/Switcher.js +58 -0
  273. package/src/components/Switcher/SwitcherItem.js +61 -0
  274. package/src/components/Switcher/SwitcherItem.scss +67 -0
  275. package/src/components/TabLinks/TabLinks.tsx +63 -0
  276. package/src/components/Tabbar/Tabbar.tsx +29 -0
  277. package/src/components/Tabbar/TabbarItem.tsx +53 -0
  278. package/src/components/Tag/Tag.tsx +39 -0
  279. package/src/components/Tag/TagGroup.tsx +25 -0
  280. package/src/components/Text/LegacyText.js +78 -0
  281. package/src/components/Text/Text.scss +67 -0
  282. package/src/components/Text/Text.tsx +81 -0
  283. package/src/components/TextEditor/TextEditor.js +61 -0
  284. package/src/components/TextEditor/TextEditor.scss +14 -0
  285. package/src/components/TextEditorV2/TextEditorV2.js +58 -0
  286. package/src/components/TextEditorV2/TextEditorV2.scss +110 -0
  287. package/src/components/TextLink/TextLink.tsx +42 -0
  288. package/src/components/TextListItem/TextListItem.js +31 -0
  289. package/src/components/TextListItem/TextListItem.scss +10 -0
  290. package/src/components/Textarea/Textarea.js +108 -0
  291. package/src/components/Textarea/Textarea.scss +56 -0
  292. package/src/components/Title/LegacyTitle.js +64 -0
  293. package/src/components/Title/Title.scss +65 -0
  294. package/src/components/Title/Title.tsx +57 -0
  295. package/src/components/ViewItem/ViewItem.tsx +73 -0
  296. package/src/index.tsx +14 -0
  297. package/src/styles/_colors.scss +59 -0
  298. package/src/styles/_layout.scss +64 -0
  299. package/src/styles/_shadows.scss +19 -0
  300. package/src/styles/_typography.scss +8 -0
  301. package/src/styles/_utils.scss +45 -0
  302. package/src/styles/fonts/avenir/3A0AF8_0_0.eot +0 -0
  303. package/src/styles/fonts/avenir/3A0AF8_0_0.ttf +0 -0
  304. package/src/styles/fonts/avenir/3A0AF8_0_0.woff +0 -0
  305. package/src/styles/fonts/avenir/3A0AF8_0_0.woff2 +0 -0
  306. package/src/styles/fonts/avenir/3A0AF8_1_0.eot +0 -0
  307. package/src/styles/fonts/avenir/3A0AF8_1_0.ttf +0 -0
  308. package/src/styles/fonts/avenir/3A0AF8_1_0.woff +0 -0
  309. package/src/styles/fonts/avenir/3A0AF8_1_0.woff2 +0 -0
  310. package/src/types/general.types.ts +11 -0
  311. package/src/utils/useOutsideClick.js +19 -0
@@ -0,0 +1,61 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import classNames from "classnames";
4
+
5
+ import { Text } from "../Text/Text";
6
+ import successIcon from "../../assets/success-icon.svg";
7
+ import failureIcon from "../../assets/error-icon.svg";
8
+
9
+ import "./Acknowledgement.scss";
10
+
11
+ export const ACKNOWLEDGEMENT_TYPE_OPTIONS = {
12
+ SUCCESS: "success",
13
+ FAILURE: "failure",
14
+ };
15
+
16
+ Acknowledgement.propTypes = {
17
+ message: PropTypes.string,
18
+ type: PropTypes.oneOf([ACKNOWLEDGEMENT_TYPE_OPTIONS.SUCCESS, ACKNOWLEDGEMENT_TYPE_OPTIONS.FAILURE]),
19
+ hasIcon: PropTypes.bool,
20
+ isVisible: PropTypes.bool,
21
+ className: PropTypes.string,
22
+ };
23
+
24
+ function Acknowledgement({
25
+ message = "",
26
+ type = ACKNOWLEDGEMENT_TYPE_OPTIONS.SUCCESS,
27
+ isVisible = false,
28
+ hasIcon = false,
29
+ className = "",
30
+ }) {
31
+ const containerClassName = classNames("cweb-acknowledgement", className, {
32
+ "type-success": type === ACKNOWLEDGEMENT_TYPE_OPTIONS.SUCCESS,
33
+ "type-failure": type === ACKNOWLEDGEMENT_TYPE_OPTIONS.FAILURE,
34
+ "is-visible": isVisible,
35
+ });
36
+
37
+ const iconContainerClasses = classNames("acknowledgement-icon-container", {
38
+ hidden: !hasIcon,
39
+ });
40
+
41
+ const successIconClasses = classNames("icon success-icon acknowledgement-icon", {
42
+ hidden: type !== ACKNOWLEDGEMENT_TYPE_OPTIONS.SUCCESS,
43
+ });
44
+
45
+ const failureIconClasses = classNames("icon failure-icon acknowledgement-icon", {
46
+ hidden: type !== ACKNOWLEDGEMENT_TYPE_OPTIONS.FAILURE,
47
+ });
48
+
49
+ return (
50
+ <div id="application-acknowledgement" data-test-id={`acknowledgement-panel-${type}`} className={containerClassName}>
51
+ <div className={iconContainerClasses}>
52
+ <img src={successIcon} className={successIconClasses} alt="Success icon" />
53
+ <img src={failureIcon} className={failureIconClasses} alt="Failure icon" />
54
+ </div>
55
+
56
+ <Text data-test-id="acknowledgement-message" text={message} />
57
+ </div>
58
+ );
59
+ }
60
+
61
+ export default Acknowledgement;
@@ -0,0 +1,49 @@
1
+ @import "../../styles/layout";
2
+ @import "../../styles/colors";
3
+
4
+ .cweb-acknowledgement {
5
+ @include horizontal-static-position(fixed, 10000);
6
+ @include flexbox-vertical(center, center);
7
+
8
+ $horizontal-margin: 6px;
9
+ $max-width: 360px - $horizontal-margin;
10
+
11
+ top: 0;
12
+ margin: 0 auto;
13
+ opacity: 0;
14
+ width: $max-width;
15
+ max-width: calc(100% - #{$horizontal-margin});
16
+ box-shadow: 0 0 20px 0 rgba(106, 191, 165, 0.2);
17
+ padding: 16px;
18
+ border-radius: 8px;
19
+
20
+ transform: translateY(-100%);
21
+ transition: transform ease-out 400ms, opacity 1ms linear 500ms;
22
+
23
+ > .acknowledgement-icon-container {
24
+ width: 48px;
25
+ height: 48px;
26
+
27
+ margin-bottom: 12px;
28
+
29
+ > .acknowledgement-icon {
30
+ width: 100%;
31
+ height: 100%;
32
+ }
33
+ }
34
+
35
+ &.type-success {
36
+ background: $color-positive-support;
37
+ }
38
+
39
+ &.type-failure {
40
+ background: $color-negative-support;
41
+ }
42
+
43
+ &.is-visible {
44
+ opacity: 1;
45
+ transform: translateY(32px);
46
+ transition: transform ease-in 150ms;
47
+ }
48
+ }
49
+
@@ -0,0 +1,81 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import PropTypes from "prop-types";
3
+ import classNames from "classnames";
4
+
5
+ import "./Avatar.scss";
6
+
7
+ function checkImageValidity(src) {
8
+ return new Promise((resolve) => {
9
+ const image = new Image();
10
+ image.onload = () => {
11
+ resolve(true);
12
+ };
13
+ image.onerror = () => {
14
+ resolve(false);
15
+ };
16
+ image.src = src;
17
+ });
18
+ }
19
+
20
+ const AVATAR_SIZE_OPTIONS = {
21
+ LARGE: "large",
22
+ MEDIUM: "medium",
23
+ SMALL: "small",
24
+ };
25
+
26
+ export const Avatar = ({ size, src, defaultImage, initials, className }) => {
27
+ const [hasValidImage, setHasValidImage] = useState(false);
28
+
29
+ useEffect(() => {
30
+ let mounted = true;
31
+ if (!defaultImage && src) {
32
+ checkImageValidity(src).then((res) => {
33
+ if (mounted) {
34
+ setHasValidImage(res);
35
+ }
36
+ });
37
+ }
38
+ return () => {
39
+ mounted = false;
40
+ };
41
+ }, [defaultImage, src]);
42
+
43
+ const containerClassName = classNames("cweb-avatar type-readonly", className, {
44
+ "size-large": size === AVATAR_SIZE_OPTIONS.LARGE,
45
+ "size-medium": size === AVATAR_SIZE_OPTIONS.MEDIUM,
46
+ "size-small": size === AVATAR_SIZE_OPTIONS.SMALL,
47
+ "display-image": hasValidImage,
48
+ "display-initials": !hasValidImage,
49
+ });
50
+
51
+ const renderAvatar = () => {
52
+ if (defaultImage) {
53
+ return <img className="avatar-image" src={defaultImage} alt="User avatar image" />;
54
+ } else if (hasValidImage) {
55
+ return <img className="avatar-image" src={src} alt="User avatar image" />;
56
+ } else {
57
+ return <span className="avatar-initials-text">{initials}</span>;
58
+ }
59
+ };
60
+
61
+ return (
62
+ <div className={containerClassName}>
63
+ <div className="avatar-content-container">{renderAvatar()}</div>
64
+ </div>
65
+ );
66
+ };
67
+
68
+ Avatar.propTypes = {
69
+ src: PropTypes.string,
70
+ initials: PropTypes.string.isRequired,
71
+ size: PropTypes.oneOf([AVATAR_SIZE_OPTIONS.LARGE, AVATAR_SIZE_OPTIONS.MEDIUM, AVATAR_SIZE_OPTIONS.SMALL]),
72
+ defaultImage: PropTypes.string,
73
+ className: PropTypes.string,
74
+ };
75
+
76
+ Avatar.defaultProps = {
77
+ size: AVATAR_SIZE_OPTIONS.MEDIUM,
78
+ defaultImage: null,
79
+ };
80
+
81
+ export default Avatar;
@@ -0,0 +1,153 @@
1
+ @import "../../styles/layout";
2
+ @import "../../styles/colors";
3
+ @import "../../styles/typography";
4
+
5
+ .cweb-avatar {
6
+ $readonly-color-text: #64748b; //slate-500
7
+ $readonly-color-background: #f1f5f9; //slate-100
8
+ $readonly-color-border: $color-border;
9
+
10
+ $editable-color-text: $color-primary;
11
+ $editable-color-background: $color-white;
12
+ $editable-color-background-hover: rgba($editable-color-text, 0.1);
13
+ $editable-color-border: $color-primary;
14
+
15
+ $size-large: 128px;
16
+ $size-medium: 64px;
17
+ $size-small: 36px;
18
+
19
+ $initials-size-large: 48px;
20
+ $initials-size-medium: 24px;
21
+ $initials-size-small: 14px;
22
+
23
+ $border-width-large: 1px;
24
+ $border-width-medium: $border-width-large / 2;
25
+
26
+ @include flexbox-vertical(center);
27
+ width: $size-medium;
28
+ box-sizing: border-box;
29
+
30
+ > .avatar-content-container {
31
+ @include flexbox-horizontal(center, center);
32
+ width: $size-medium;
33
+ height: $size-medium;
34
+ border-radius: 50%;
35
+ box-sizing: border-box;
36
+
37
+ > .avatar-image {
38
+ width: 100%;
39
+ height: 100%;
40
+ border-radius: 50%;
41
+ }
42
+
43
+ > .avatar-initials-text {
44
+ @include text($initials-size-medium, 1, $color-text-lighter, 300);
45
+ pointer-events: none;
46
+ }
47
+ }
48
+
49
+ &.size-large {
50
+ width: $size-large;
51
+
52
+ > .avatar-content-container {
53
+ width: $size-large;
54
+ height: $size-large;
55
+
56
+ > .avatar-initials-text {
57
+ font-size: $initials-size-large;
58
+ }
59
+ }
60
+ }
61
+
62
+ &.size-medium {
63
+ width: $size-medium;
64
+
65
+ > .avatar-content-container {
66
+ width: $size-medium;
67
+ height: $size-medium;
68
+
69
+ > .avatar-initials-text {
70
+ font-size: $initials-size-medium;
71
+ }
72
+ }
73
+ }
74
+
75
+ &.size-small {
76
+ width: $size-small;
77
+
78
+ > .avatar-content-container {
79
+ width: $size-small;
80
+ height: $size-small;
81
+
82
+ > .avatar-initials-text {
83
+ font-size: $initials-size-small;
84
+ }
85
+ }
86
+ }
87
+
88
+ &.type-editable {
89
+ cursor: pointer;
90
+
91
+ > .avatar-content-container {
92
+ position: relative;
93
+ border-color: $editable-color-border;
94
+ background-color: $editable-color-background;
95
+
96
+ &:after {
97
+ content: "";
98
+ position: absolute;
99
+ top: 0;
100
+ left: 0;
101
+ right: 0;
102
+ bottom: 0;
103
+ z-index: 1;
104
+ border-radius: 50%;
105
+ transition: 0.4s ease background-color;
106
+ }
107
+
108
+ &:hover:after {
109
+ background-color: $editable-color-background-hover;
110
+ }
111
+
112
+ > .avatar-initials-text {
113
+ color: $editable-color-text;
114
+ }
115
+ }
116
+ }
117
+
118
+ &.type-readonly {
119
+ > .avatar-content-container {
120
+ border-color: $readonly-color-border;
121
+ background-color: $readonly-color-background;
122
+
123
+ > .avatar-initials-text {
124
+ color: $readonly-color-text;
125
+ }
126
+ }
127
+ }
128
+
129
+ @media (max-width: $max-small-screen-width) {
130
+ $size-large-mobile: $size-large / 2;
131
+ $initials-size-large-mobile: $initials-size-large / 2;
132
+ $border-width-large-mobile: $border-width-large / 2;
133
+
134
+ &.size-large {
135
+ width: $size-large-mobile;
136
+
137
+ > .avatar-content-container {
138
+ width: $size-large-mobile;
139
+ height: $size-large-mobile;
140
+
141
+ > .avatar-initials-text {
142
+ font-size: $initials-size-large-mobile;
143
+ }
144
+ }
145
+
146
+ &.display-initials {
147
+ > .avatar-content-container {
148
+ border-width: $border-width-large-mobile;
149
+ }
150
+ }
151
+ }
152
+ }
153
+ }
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+
4
+ interface BadgeProps {
5
+ badgeCount: number;
6
+ className?: string;
7
+ }
8
+
9
+ const Badge = (props: BadgeProps): JSX.Element => {
10
+ const containerClasses = classNames(
11
+ ["inline-flex", "items-center", "justify-center", "rounded-full", "h-6", "min-w-24", "px-2", "bg-color-negative"],
12
+ props.className
13
+ );
14
+ const textClasses = classNames(["text-xs", "text-white", "leading-none"]);
15
+
16
+ return (
17
+ <div className={containerClasses}>
18
+ <span className={textClasses}>{props.badgeCount}</span>
19
+ </div>
20
+ );
21
+ };
22
+
23
+ export default Badge;
@@ -0,0 +1,46 @@
1
+ ```js
2
+ <div className="items-center mb-10 space-y-5">
3
+ <div className="flex flex-row space-x-4">
4
+ <Button text="Primary" onClick={() => console.log("primary")} />
5
+ <Button text="Primary" isPending onClick={() => console.log("primary")} />
6
+ <Button text="Primary" isDisabled onClick={() => console.log("primary")} />
7
+ </div>
8
+
9
+ <div className="flex flex-row space-x-4">
10
+ <Button text="Secondary" role="secondary" onClick={() => console.log("primary")} />
11
+ <Button text="Secondary" isPending role="secondary" onClick={() => console.log("primary")} />
12
+ <Button text="Secondary" isDisabled role="secondary" onClick={() => console.log("primary")} />
13
+ </div>
14
+
15
+ <div className="flex flex-row space-x-4">
16
+ <Button text="Tertiary" role="tertiary" onClick={() => console.log("tertiary")} />
17
+ <Button text="Tertiary" isPending role="tertiary" onClick={() => console.log("tertiary")} />
18
+ <Button text="Tertiary" isDisabled role="tertiary" onClick={() => console.log("tertiary")} />
19
+ </div>
20
+
21
+ <div className="flex flex-row space-x-4">
22
+ <Button text="Destructive" role="negative" onClick={() => console.log("negative")} />
23
+ <Button text="Destructive" isPending role="negative" onClick={() => console.log("negative")} />
24
+ <Button text="Destructive" isDisabled role="negative" onClick={() => console.log("negative")} />
25
+ </div>
26
+
27
+ <div className="flex flex-row space-x-4">
28
+ <Button text="Icon button" className="add-button" onClick={() => console.log("negative")} />
29
+ <Button text="Icon button" className="edit-button" onClick={() => console.log("negative")} />
30
+ <Button text="Icon button" className="delete-button" onClick={() => console.log("negative")} />
31
+ </div>
32
+
33
+ <div className="flex flex-row space-x-4">
34
+ <Button className="add-button" onClick={() => console.log("negative")} />
35
+ <Button role={BUTTON_ROLES.SECONDARY} className="add-button" onClick={() => console.log("negative")} />
36
+ <Button className="edit-button" onClick={() => console.log("negative")} />
37
+ <Button role={BUTTON_ROLES.SECONDARY} className="edit-button" onClick={() => console.log("negative")} />
38
+ <Button
39
+ role={BUTTON_ROLES.NEGATIVE}
40
+ className="delete-button"
41
+ onClick={() => console.log("negative")}
42
+ link={generateLocationWithPath("healthcare/pages/groups/add")}
43
+ />
44
+ </div>
45
+ </div>
46
+ ```
@@ -0,0 +1,200 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import classNames from "classnames";
3
+ import { navigate } from "@reach/router";
4
+
5
+ import { Spinner } from "../Spinner/Spinner";
6
+ import { AddIcon } from "../Icons/AddIcon";
7
+ import { DeleteIcon } from "../Icons/DeleteIcon";
8
+ import { EditIcon } from "../Icons/EditIcon";
9
+ import { LeftArrowIcon } from "../Icons/LeftArrowIcon";
10
+ import { RightArrowIcon } from "../Icons/RightArrowIcon";
11
+ import { ChartIcon } from "../Icons/ChartIcon";
12
+ import { PrintIcon } from "../Icons/PrintIcon";
13
+
14
+ import { ButtonIcon } from "./ButtonIcon";
15
+ import { BUTTON_ROLES, ButtonProps } from "./Button.types";
16
+
17
+ // TODO: use the Types from Button.types.ts instead of PropTypes
18
+ function Button(props: ButtonProps): JSX.Element {
19
+ const {
20
+ text = "",
21
+ role: propsRole = BUTTON_ROLES.PRIMARY,
22
+ type = "button",
23
+ title = "",
24
+ link = "",
25
+ isPending = false,
26
+ isDisabled = false,
27
+ onClick,
28
+ className = "",
29
+ iconName = "",
30
+ hasIcon: hasIconProps = false,
31
+ dynamicIcon,
32
+ ...otherAttributes
33
+ } = props;
34
+
35
+ const hasAddIcon = className.includes("add-button");
36
+ const hasEditIcon = className.includes("edit-button");
37
+ const hasDeleteIcon = className.includes("delete-button");
38
+ const hasPrevIcon = className.includes("prev-button");
39
+ const hasNextIcon = className.includes("next-button");
40
+ const hasChartIcon = className.includes("chart-button");
41
+ const hasPrintIcon = className.includes("print-button");
42
+ const hasIcon =
43
+ hasIconProps ||
44
+ iconName ||
45
+ hasAddIcon ||
46
+ hasEditIcon ||
47
+ hasDeleteIcon ||
48
+ hasPrevIcon ||
49
+ hasNextIcon ||
50
+ hasChartIcon ||
51
+ hasPrintIcon ||
52
+ dynamicIcon;
53
+
54
+ const isIconOnly = hasIcon && !text;
55
+
56
+ const [role, setRole] = useState(propsRole);
57
+
58
+ // Fix to support the all the buttons in the application
59
+ // Ideally we want to make a better implementation of them overall, but that's beyond the
60
+ // scope of this task.
61
+
62
+ useEffect(() => {
63
+ if ((hasAddIcon || hasEditIcon) && !text) {
64
+ setRole(BUTTON_ROLES.SECONDARY);
65
+ } else if (propsRole === BUTTON_ROLES.TEXT || propsRole === BUTTON_ROLES.LINK) {
66
+ setRole(BUTTON_ROLES.TERTIARY);
67
+ } else if (hasDeleteIcon) {
68
+ setRole(BUTTON_ROLES.NEGATIVE);
69
+ }
70
+ }, []);
71
+
72
+ const isButtonDisabled = (role !== BUTTON_ROLES.LINK && isDisabled) || isPending;
73
+ const isNonPrimaryNonNegative =
74
+ role === BUTTON_ROLES.SECONDARY || role === BUTTON_ROLES.TERTIARY || role === BUTTON_ROLES.QUATERNARY;
75
+
76
+ function handleClick(event: any) {
77
+ if (link) {
78
+ navigate(link);
79
+ return;
80
+ }
81
+
82
+ if (isButtonDisabled || !onClick) {
83
+ // without this, form will be submitted, if button has type submit.
84
+ event.preventDefault();
85
+ return;
86
+ }
87
+
88
+ onClick(event);
89
+ }
90
+
91
+ const buttonRolesStyling = {
92
+ primary: [
93
+ "bg-primary",
94
+ "hover:bg-primary-dark",
95
+ "text-white",
96
+ "focus:outline-primary",
97
+ "border",
98
+ "border-solid",
99
+ "border-primary-transparent",
100
+ ],
101
+ secondary: ["bg-slate-200"],
102
+ secondaryDark: ["bg-slate-700", "hover:bg-slate-600"],
103
+ tertiary: ["bg-transparent", "shadow-none", "hover:bg-slate-100"],
104
+ quaternary: ["bg-white", "shadow-none", "border", "border-solid", "border-quaternary", "hover:border-slate-200"],
105
+ negative: [
106
+ "bg-negative",
107
+ "text-negative-dark",
108
+ "hover:text-negative-darker",
109
+ "hover:border-negative-border",
110
+ "focus:outline-negative",
111
+ "border",
112
+ "border-transparent",
113
+ ],
114
+ link: [],
115
+ text: [],
116
+ icon: [],
117
+ };
118
+
119
+ const containerClassName = classNames(
120
+ // default button classes
121
+ [
122
+ "h-11",
123
+ "focus:outline-none",
124
+ "relative flex flex-row justify-center items-center",
125
+ "shadow-sm",
126
+ "transition-outline transition-colors duration-300 ease-in-out",
127
+ "cursor-pointer",
128
+ "rounded-full",
129
+ "leading-none",
130
+ ],
131
+ // ensuring the buttons are 44px high including content
132
+ {
133
+ "py-2 px-2 w-11": isIconOnly,
134
+ "px-4 py-3": !isIconOnly,
135
+ },
136
+ className,
137
+ {
138
+ "opacity-50 pointer-events-none": isButtonDisabled,
139
+ "hover:text-primary-dark text-primary": isNonPrimaryNonNegative,
140
+ "border border-transparent": isNonPrimaryNonNegative,
141
+ "hover:border-slate-200 focus:outline-primary": isNonPrimaryNonNegative,
142
+ "text-secondary-dark opacity-75": isButtonDisabled && isNonPrimaryNonNegative,
143
+ },
144
+ buttonRolesStyling[role]
145
+ );
146
+
147
+ const spinnerClassNames = classNames({
148
+ hidden: !isPending,
149
+ "text-white": role === BUTTON_ROLES.PRIMARY,
150
+ "text-dark-gray": isNonPrimaryNonNegative,
151
+ "text-negative-dark": role === BUTTON_ROLES.TERTIARY,
152
+ });
153
+
154
+ const buttonTextClasses = classNames(["text-sm", "font-medium"], {
155
+ invisible: isPending,
156
+ hidden: !text,
157
+ "ml-3": hasIcon,
158
+ });
159
+
160
+ return (
161
+ <button
162
+ {...otherAttributes}
163
+ aria-disabled={isButtonDisabled}
164
+ disabled={isButtonDisabled}
165
+ className={containerClassName}
166
+ onClick={handleClick}
167
+ type={type}
168
+ title={title}
169
+ data-role={role}
170
+ >
171
+ {hasAddIcon && <AddIcon className="w-5 h-5" />}
172
+ {hasEditIcon && <EditIcon className="w-5 h-5" />}
173
+ {hasDeleteIcon && <DeleteIcon className="w-5 h-5" />}
174
+ {hasPrevIcon && <LeftArrowIcon className="w-5 h-5" />}
175
+ {hasNextIcon && <RightArrowIcon className="w-5 h-5" />}
176
+ {hasChartIcon && <ChartIcon className="w-5 h-5" />}
177
+ {hasPrintIcon && <PrintIcon className="w-5 h-5" />}
178
+ {iconName && <ButtonIcon name={iconName} />}
179
+ {dynamicIcon && React.createElement(dynamicIcon, { className: "w-5 h-5" })}
180
+
181
+ <span
182
+ className="opacity-100"
183
+ // IE11 center translate fix
184
+ style={{
185
+ position: "absolute",
186
+ left: "50%",
187
+ top: "50%",
188
+ transform: "translate(-50%, -50%)",
189
+ }}
190
+ >
191
+ <Spinner className={spinnerClassNames} />
192
+ </span>
193
+ <span className={buttonTextClasses}>{text}</span>
194
+ </button>
195
+ );
196
+ }
197
+
198
+ export default Button;
199
+
200
+ export { BUTTON_ROLES };
@@ -0,0 +1,41 @@
1
+ // These types were added because they are used in ViewItem that is completely refactored to TS
2
+ // Ideally they should also be used in the Button TS component, but this was outside of the scope of this task
3
+ import React from "react";
4
+
5
+ import { RestPropped } from "../../types/general.types";
6
+ import { IconProps } from "../Icons/types/IconProps.type";
7
+
8
+ export const BUTTON_ROLES = {
9
+ PRIMARY: "primary",
10
+ SECONDARY: "secondary",
11
+ SECONDARY_DARK: "secondaryDark",
12
+ TERTIARY: "tertiary",
13
+ QUATERNARY: "quaternary",
14
+ NEGATIVE: "negative",
15
+ TEXT: "text",
16
+ LINK: "link",
17
+ ICON: "icon",
18
+ } as const;
19
+
20
+ type BUTTON_KEYS = keyof typeof BUTTON_ROLES;
21
+ export type BUTTON_TYPE = typeof BUTTON_ROLES[BUTTON_KEYS];
22
+
23
+ export type ButtonType = "button" | "submit";
24
+
25
+ export interface ButtonProps extends RestPropped {
26
+ text?: string;
27
+ role?: BUTTON_TYPE;
28
+ type?: ButtonType;
29
+ title?: string;
30
+ link?: string;
31
+ isPending?: boolean;
32
+ isDisabled?: boolean;
33
+ // TODO: add specific type of ButtonEvent
34
+ onClick?: (arg: any) => void;
35
+ className?: string;
36
+ // name mapping to the right svg in ButtonIcon
37
+ iconName?: string;
38
+ // legacy - can be removed?
39
+ hasIcon?: boolean;
40
+ dynamicIcon?: React.FunctionComponent<IconProps>;
41
+ }
@@ -0,0 +1,42 @@
1
+ import * as React from "react";
2
+
3
+ import CloseIcon from "../../assets/close.svg";
4
+ import HamburgerIcon from "../../assets/hamburger.svg";
5
+ import ChevronRightBlueIcon from "../../assets/right-arrow-blue.svg";
6
+ import ChevronRightGreyIcon from "../../assets/right-arrow-grey.svg";
7
+ import ChevronLeftBlueIcon from "../../assets/left-arrow-blue.svg";
8
+ import ChevronLeftGreyIcon from "../../assets/left-arrow-grey.svg";
9
+ import SearchIcon from "../../assets/search.svg";
10
+ import SearchCancelIcon from "../../assets/search-cancel.svg";
11
+ import StarIcon from "../../assets/starIcon.svg";
12
+ import CheckIcon from "../../assets/check-icon-primary.svg";
13
+
14
+ interface ButtonIconProps {
15
+ name: string;
16
+ className?: string;
17
+ }
18
+
19
+ type IconNames = {
20
+ [key: string]: string;
21
+ };
22
+
23
+ const iconSrc: IconNames = {
24
+ // These need to be converted to svg files instead of components and added in
25
+ // "add": AddIcon,
26
+ // "delete": DeleteIcon,
27
+ // "edit": EditIcon,
28
+ close: CloseIcon,
29
+ hamburger: HamburgerIcon,
30
+ "chevron-right-blue": ChevronRightBlueIcon,
31
+ "chevron-left-blue": ChevronLeftBlueIcon,
32
+ "chevron-right-grey": ChevronRightGreyIcon,
33
+ "chevron-left-grey": ChevronLeftGreyIcon,
34
+ search: SearchIcon,
35
+ star: StarIcon,
36
+ check: CheckIcon,
37
+ "search-cancel": SearchCancelIcon,
38
+ };
39
+
40
+ export const ButtonIcon = (props: ButtonIconProps): JSX.Element => {
41
+ return <img src={iconSrc[props.name]} className={props.className} />;
42
+ };