@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,91 @@
1
+ import classNames from "classnames";
2
+ import React from "react";
3
+
4
+ import { Spinner } from "../Spinner/Spinner";
5
+ import { IconProps } from "../Icons/types/IconProps.type";
6
+
7
+ export type ButtonV2Type = "button" | "submit";
8
+
9
+ export interface ButtonV2Props {
10
+ onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
11
+ type?: ButtonV2Type;
12
+ text?: string;
13
+ icon?: React.FunctionComponent<IconProps>;
14
+ isDisabled?: boolean;
15
+ isPending?: boolean;
16
+ className?: string;
17
+ }
18
+
19
+ export const ButtonV2 = (props: ButtonV2Props): JSX.Element => {
20
+ if (!props.text && !props.icon) {
21
+ console.error(
22
+ "A text or an icon is required to use this component, please make sure to pass at least one of them as a prop."
23
+ );
24
+ return <span>Invalid props passed to this component.</span>;
25
+ }
26
+
27
+ const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
28
+ if (props.type === "submit") {
29
+ event.preventDefault();
30
+ }
31
+ props.onClick(event);
32
+ };
33
+
34
+ const buttonClassName = classNames(
35
+ [
36
+ "h-11",
37
+ "relative flex flex-row justify-center items-center",
38
+ "transition-outline transition-colors duration-300 ease-in-out",
39
+ "rounded-full",
40
+ "leading-none",
41
+ "shadow-sm",
42
+ "cursor-pointer",
43
+ "focus:outline-none",
44
+ ],
45
+ {
46
+ "w-11": !props.text && props.icon,
47
+ "px-4": props.text,
48
+ "py-2": props.text && props.icon,
49
+ "py-3": props.text && !props.icon,
50
+ },
51
+ props.className
52
+ );
53
+
54
+ return (
55
+ <button
56
+ className={buttonClassName}
57
+ type={props.type}
58
+ onClick={handleClick}
59
+ disabled={props.isDisabled}
60
+ aria-disabled={props.isDisabled}
61
+ >
62
+ {props.icon && React.createElement(props.icon, { className: "w-5 h-5" })}
63
+
64
+ {props.isPending && (
65
+ <span
66
+ className="opacity-100"
67
+ // IE11 center translate fix
68
+ style={{
69
+ position: "absolute",
70
+ left: "50%",
71
+ top: "50%",
72
+ transform: "translate(-50%, -50%)",
73
+ }}
74
+ >
75
+ <Spinner className="text-white" />
76
+ </span>
77
+ )}
78
+
79
+ {props.text && (
80
+ <span
81
+ className={classNames("text-sm font-medium", {
82
+ invisible: props.isPending,
83
+ "ml-1": props.icon,
84
+ })}
85
+ >
86
+ {props.text}
87
+ </span>
88
+ )}
89
+ </button>
90
+ );
91
+ };
@@ -0,0 +1,43 @@
1
+ import classNames from "classnames";
2
+ import React from "react";
3
+
4
+ import { IconProps } from "../Icons/types/IconProps.type";
5
+
6
+ import { ButtonV2, ButtonV2Type } from "./ButtonV2";
7
+
8
+ export interface PrimaryButtonProps {
9
+ onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
10
+ type?: ButtonV2Type;
11
+ text?: string;
12
+ icon?: React.FunctionComponent<IconProps>;
13
+ isDisabled?: boolean;
14
+ isPending?: boolean;
15
+ }
16
+
17
+ export const PrimaryButton = (props: PrimaryButtonProps): JSX.Element => {
18
+ return (
19
+ <ButtonV2
20
+ className={classNames(
21
+ [
22
+ "text-white",
23
+ "bg-primary",
24
+ "border",
25
+ "border-solid",
26
+ "border-primary-transparent",
27
+ "hover:bg-primary-dark",
28
+ "focus:outline-primary",
29
+ ],
30
+ {
31
+ "opacity-50": props.isDisabled,
32
+ "pointer-events-none": props.isDisabled || props.isPending,
33
+ }
34
+ )}
35
+ onClick={props.onClick}
36
+ type={props.type}
37
+ text={props.text}
38
+ icon={props.icon}
39
+ isDisabled={props.isDisabled}
40
+ isPending={props.isPending}
41
+ />
42
+ );
43
+ };
@@ -0,0 +1,31 @@
1
+ import classNames from "classnames";
2
+ import React from "react";
3
+
4
+ import { IconProps } from "../Icons/types/IconProps.type";
5
+
6
+ import { ButtonV2 } from "./ButtonV2";
7
+
8
+ export interface SecondaryButtonProps {
9
+ onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
10
+ text?: string;
11
+ icon?: React.FunctionComponent<IconProps>;
12
+ }
13
+
14
+ export const SecondaryButton = (props: SecondaryButtonProps): JSX.Element => {
15
+ return (
16
+ <ButtonV2
17
+ className={classNames([
18
+ "text-primary",
19
+ "bg-white",
20
+ "border",
21
+ "border-slate-300",
22
+ "hover:text-primary-dark",
23
+ "hover:border-slate-400",
24
+ "focus:outline-primary",
25
+ ])}
26
+ onClick={props.onClick}
27
+ text={props.text}
28
+ icon={props.icon}
29
+ />
30
+ );
31
+ };
@@ -0,0 +1,31 @@
1
+ import classNames from "classnames";
2
+ import React from "react";
3
+
4
+ import { IconProps } from "../Icons/types/IconProps.type";
5
+
6
+ import { ButtonV2 } from "./ButtonV2";
7
+
8
+ export interface TertiaryButtonProps {
9
+ onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
10
+ text?: string;
11
+ icon?: React.FunctionComponent<IconProps>;
12
+ }
13
+
14
+ export const TertiaryButton = (props: TertiaryButtonProps): JSX.Element => {
15
+ return (
16
+ <ButtonV2
17
+ className={classNames([
18
+ "text-primary",
19
+ "bg-transparent",
20
+ "border",
21
+ "border-transparent",
22
+ "shadow-none",
23
+ "hover:text-primary-dark",
24
+ "focus:outline-primary",
25
+ ])}
26
+ onClick={props.onClick}
27
+ text={props.text}
28
+ icon={props.icon}
29
+ />
30
+ );
31
+ };
@@ -0,0 +1,52 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import classNames from "classnames";
3
+ import Glider from "react-glider";
4
+
5
+ import { GliderContainer } from "./GliderContainer";
6
+
7
+ interface CarouselProps {
8
+ id: string;
9
+ slides: React.ReactNode[];
10
+ className?: string;
11
+ }
12
+
13
+ const Carousel = ({ slides, className, id }: CarouselProps): JSX.Element => {
14
+ const [isVisible, setIsVisible] = useState(false);
15
+ useEffect(() => setIsVisible(false), [id]);
16
+ useEffect(() => {
17
+ // hack to force Glider to re mount when id changes
18
+ if (!isVisible) {
19
+ setIsVisible(true);
20
+ }
21
+ }, [isVisible]);
22
+
23
+ return (
24
+ isVisible ? (
25
+ <Glider
26
+ hasDots
27
+ hasArrows
28
+ skipTrack
29
+ // draggable
30
+ scrollLock
31
+ rewind
32
+ arrows={{
33
+ prev: ".entity-preview-left",
34
+ next: ".entity-preview-right",
35
+ }}
36
+ id={id} // this should force Glider to rebuild, but it does not
37
+ dots={".entity-preview-dots"}
38
+ className={classNames("h-full", className)}
39
+ containerElement={GliderContainer}
40
+ >
41
+ <div className="glider-track h-full">
42
+ {slides?.map((slide, index) => (
43
+ <div key={index} className={"overflow-hidden"}>
44
+ {slide}
45
+ </div>
46
+ ))}
47
+ </div>
48
+ </Glider>
49
+ ) : <></>);
50
+ };
51
+
52
+ export default Carousel;
@@ -0,0 +1,13 @@
1
+ .entity-preview-dots.glider-dots {
2
+ @apply pt-4;
3
+ .glider-dot {
4
+ @apply h-2 w-2 m-1 bg-blue-50;
5
+ &:focus {
6
+ @apply outline-primary;
7
+ }
8
+ &.active,
9
+ &:focus {
10
+ @apply bg-blue-800;
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+
3
+ import Button, { BUTTON_ROLES } from "../Button/Button";
4
+
5
+ import "./GliderContainer.scss";
6
+
7
+ interface GliderContainerProps {
8
+ children: React.ReactNode;
9
+ }
10
+
11
+ export const GliderContainer = (props: GliderContainerProps): JSX.Element => (
12
+ <div className={"relative h-full pb-6 glider-contain px-17 pb-6"}>
13
+ {props.children}
14
+ <div className={"entity-preview-left absolute top-1/2 left-0"}>
15
+ <Button iconName={"chevron-left-blue"} role={BUTTON_ROLES.QUATERNARY} />
16
+ </div>
17
+ <div className={"entity-preview-right absolute top-1/2 right-0"}>
18
+ <Button iconName={"chevron-right-blue"} role={BUTTON_ROLES.QUATERNARY} />
19
+ </div>
20
+ <div className="entity-preview-dots" />
21
+ </div>
22
+ );
@@ -0,0 +1,50 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import classNames from "classnames";
4
+
5
+ import Button, { BUTTON_ROLES } from "../Button/Button";
6
+ import Text from "../Text/Text";
7
+ import { Title } from "../Title/Title";
8
+
9
+ CenteredHero.propTypes = {
10
+ title: PropTypes.string,
11
+ text: PropTypes.string,
12
+ image: PropTypes.string,
13
+ buttons: PropTypes.arrayOf(
14
+ PropTypes.shape({
15
+ title: PropTypes.string.isRequired,
16
+ handleOnClick: PropTypes.func.isRequired,
17
+ type: PropTypes.oneOf([BUTTON_ROLES.PRIMARY, BUTTON_ROLES.SECONDARY]).isRequired,
18
+ })
19
+ ),
20
+ className: PropTypes.string,
21
+ };
22
+
23
+ function CenteredHero({ title, text, image, buttons, className }) {
24
+ return (
25
+ <div className={classNames(className, "p-6 my-6 flex flex-col items-center w-200 ml-auto mr-auto")}>
26
+ {image && <img src={image} />}
27
+ {title && <Title className="mt-8 mb-2" text={title} type={"base"} />}
28
+ {text && <Text text={text} />}
29
+
30
+ {buttons?.length > 0 && (
31
+ <div className="flex flex-row mt-8">
32
+ {buttons
33
+ .filter((button) => button.title && button.handleOnClick && button.type)
34
+ .map((button) => (
35
+ <Button
36
+ className="mr-4 last:mr-0"
37
+ key={button.title}
38
+ role={button.type}
39
+ title={button.title}
40
+ text={button.title}
41
+ onClick={button.handleOnClick}
42
+ />
43
+ ))}
44
+ </div>
45
+ )}
46
+ </div>
47
+ );
48
+ }
49
+
50
+ export default CenteredHero;
@@ -0,0 +1,115 @@
1
+ @import "../../styles/colors";
2
+ @import "../../styles/layout";
3
+
4
+ .cweb-checkbox {
5
+ outline: none;
6
+ transition: all 0.3s ease;
7
+
8
+ .cweb-checkbox-input {
9
+ position: absolute;
10
+ -webkit-appearance: none;
11
+ height: 1px;
12
+ opacity: 0;
13
+ width: 1px;
14
+ }
15
+
16
+ &.type-regular {
17
+ .cweb-checkbox-label {
18
+ display: flex;
19
+ align-items: center;
20
+ margin-bottom: 0;
21
+ }
22
+
23
+ .cweb-checkbox-icon-container {
24
+ width: 16px;
25
+ height: 16px;
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ flex: 0 0 auto;
30
+ border: 1px solid $color-border;
31
+ border-radius: $default-border-radius;
32
+ }
33
+
34
+ &.hasError {
35
+ .cweb-checkbox-icon-container {
36
+ border: 1px solid $color-negative;
37
+ }
38
+ }
39
+
40
+ .cweb-checkbox-icon {
41
+ display: block;
42
+ }
43
+
44
+ &.is-focused {
45
+ .cweb-checkbox-icon-container {
46
+ border-color: $color-primary;
47
+ }
48
+ }
49
+
50
+ &.is-checked {
51
+ .cweb-checkbox-icon {
52
+ width: 0.5rem;
53
+ height: 0.5rem;
54
+ padding: 4px;
55
+ background: url("../../assets/check-icon.svg") no-repeat center;
56
+ background-size: contain;
57
+ }
58
+ }
59
+
60
+ &.is-disabled.show-cross-when-disabled {
61
+ .cweb-checkbox-icon {
62
+ width: 10px;
63
+ height: 10px;
64
+ background: url("../../assets/check-cross-icon.svg") no-repeat center;
65
+ background-size: contain;
66
+ opacity: 0.6;
67
+ }
68
+ }
69
+ }
70
+
71
+ &.type-switch {
72
+ .cweb-checkbox-label {
73
+ display: flex;
74
+ align-items: center;
75
+ margin-bottom: 0;
76
+ width: 56px;
77
+ height: 28px;
78
+ position: relative;
79
+ }
80
+
81
+ .cweb-checkbox-icon-container {
82
+ position: absolute;
83
+ cursor: pointer;
84
+ top: 0;
85
+ left: 0;
86
+ right: 0;
87
+ bottom: 0;
88
+ background-color: $input-background;
89
+ border-radius: 16px;
90
+
91
+ &:after {
92
+ position: relative;
93
+ display: block;
94
+ content: "";
95
+ height: 20px;
96
+ width: 20px;
97
+ top: 4px;
98
+ left: 4px;
99
+ background-color: white;
100
+ border-radius: 50%;
101
+ transition: all 0.2s ease;
102
+ }
103
+ }
104
+
105
+ &.is-checked {
106
+ .cweb-checkbox-icon-container {
107
+ background-color: $color-toggle-switch-background;
108
+
109
+ &:after {
110
+ left: 32px;
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
@@ -0,0 +1,114 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import classNames from "classnames";
3
+
4
+ import { Text } from "../Text/Text";
5
+
6
+ import "./Checkbox.scss";
7
+
8
+ export interface CheckboxProps {
9
+ id?: string;
10
+ // The label that will be presented as a Text
11
+ text?: string;
12
+ // The explanation that will be presented below it
13
+ explanation?: string;
14
+ type?: "regular" | "switch";
15
+ // Set the initial value
16
+ isChecked?: boolean;
17
+ // Allow the user to change the input
18
+ isDisabled?: boolean;
19
+ name?: string;
20
+ // This can be used to retrieve the value it is referring to through onChange
21
+ value?: string;
22
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
23
+ className?: string;
24
+ error?: boolean;
25
+ }
26
+
27
+ export const Checkbox = ({
28
+ id,
29
+ text,
30
+ explanation,
31
+ type = "regular",
32
+ isChecked = false,
33
+ isDisabled,
34
+ name,
35
+ value,
36
+ onChange,
37
+ className,
38
+ error,
39
+ }: CheckboxProps): JSX.Element => {
40
+ const [checked, setChecked] = useState(false);
41
+ const [isFocused, setIsFocused] = useState(false);
42
+
43
+ const containerClassName = classNames("cweb-checkbox", className, {
44
+ "is-focused": isFocused,
45
+ "is-checked": checked,
46
+ "opacity-50 cursor-not-allowed is-disabled": isDisabled,
47
+ "type-regular": type === "regular",
48
+ "type-switch": type === "switch",
49
+ hasError: error,
50
+ });
51
+
52
+ useEffect(() => {
53
+ setChecked(isChecked);
54
+ }, [isChecked]);
55
+
56
+ const handleChange = (event) => {
57
+ setChecked(!checked);
58
+ if (onChange) {
59
+ onChange(event);
60
+ }
61
+ };
62
+
63
+ const handleFocus = () => setIsFocused(true);
64
+
65
+ const handleBlur = () => setIsFocused(false);
66
+
67
+ return (
68
+ <div className={containerClassName} data-test-id="checkbox">
69
+ <label className="cweb-checkbox-label" data-test-id="checkbox-label" onClick={(e) => e.stopPropagation()}>
70
+ <input
71
+ id={id}
72
+ data-test-id={`checkbox-${name}`}
73
+ className="cweb-checkbox-input"
74
+ name={name}
75
+ type="checkbox"
76
+ checked={checked}
77
+ disabled={isDisabled}
78
+ value={value}
79
+ onBlur={handleBlur}
80
+ onFocus={handleFocus}
81
+ onChange={handleChange}
82
+ />
83
+
84
+ <span
85
+ className={classNames("cweb-checkbox-icon-container", "transition-colors duration-300", {
86
+ "bg-primary": checked,
87
+ "bg-white": !checked,
88
+ "hover:bg-primary-dark": checked,
89
+ "outline-primary": isFocused,
90
+ "cursor-not-allowed": isDisabled,
91
+ "cursor-pointer": !isDisabled,
92
+ })}
93
+ data-test-id="checkbox-span"
94
+ >
95
+ <span className="cweb-checkbox-icon" />
96
+ </span>
97
+
98
+ <div className="flex flex-col">
99
+ {text && <Text className="ml-2 select-none text-left" text={text} data-test-id="checkbox-text" />}
100
+ {explanation && (
101
+ <Text
102
+ className="ml-2 select-none text-left"
103
+ text={explanation}
104
+ color={"gray-500"}
105
+ data-test-id="checkbox-explanation"
106
+ />
107
+ )}
108
+ </div>
109
+ </label>
110
+ </div>
111
+ );
112
+ };
113
+
114
+ export default Checkbox;
@@ -0,0 +1,15 @@
1
+ @import "../../styles/layout";
2
+
3
+ .vitals-confirmation-dialog {
4
+ margin-top: 4rem !important;
5
+
6
+ .vitals-confirmation-dialog-content {
7
+ padding: 24px;
8
+
9
+ .vitals-confirmation-dialog-action-container {
10
+ @include flexbox-horizontal(center, space-between);
11
+ width: 100%;
12
+ margin-top: 16px;
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,84 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+
4
+ import Button, { BUTTON_ROLES } from "../Button/Button";
5
+ import "./ConfirmationDialog.scss";
6
+ import { ModalWithButtons } from "../Modal/ModalWithButtons";
7
+ import { MODAL_SIZES, MODAL_SIZES_VALUES } from "../Modal/Modal";
8
+ import Text from "../Text/Text";
9
+ import { BUTTON_TYPE } from "../Button/Button.types";
10
+
11
+ interface ConfirmationDialogTexts {
12
+ message: string;
13
+ confirmLabel: string;
14
+ cancelLabel: string;
15
+ title?: string;
16
+ }
17
+
18
+ interface ConfirmationDialogProps {
19
+ texts: ConfirmationDialogTexts;
20
+ isOpen: boolean;
21
+ onCancel: () => void;
22
+ onConfirm: () => void;
23
+ isProcessing: boolean;
24
+ cancelButtonRole: BUTTON_TYPE;
25
+ confirmButtonRole: BUTTON_TYPE;
26
+ size: MODAL_SIZES_VALUES;
27
+ showHeader: boolean;
28
+ className?: string;
29
+ }
30
+
31
+ export const ConfirmationDialog = (props: ConfirmationDialogProps): JSX.Element => {
32
+ const calculatedClassNames = classNames("vitals-confirmation-dialog", props.className);
33
+
34
+ const handleOnCloseClick = () => {
35
+ if (!props.isProcessing) {
36
+ props.onCancel();
37
+ }
38
+ };
39
+
40
+ const modalButtons: [JSX.Element, JSX.Element?] = [
41
+ <Button
42
+ key="confirmation-dialog-button-cancel"
43
+ data-test-id="button-cancel"
44
+ text={props.texts.cancelLabel}
45
+ onClick={props.onCancel}
46
+ isDisabled={props.isProcessing}
47
+ role={props.cancelButtonRole}
48
+ />,
49
+ <Button
50
+ key="confirmation-dialog-button-confirm"
51
+ className="ml-2.5"
52
+ data-test-id="button-confirm"
53
+ text={props.texts.confirmLabel}
54
+ onClick={props.onConfirm}
55
+ isPending={props.isProcessing}
56
+ />,
57
+ ];
58
+
59
+ return (
60
+ <ModalWithButtons
61
+ type={props.size}
62
+ className={calculatedClassNames}
63
+ isOpen={props.isOpen}
64
+ title={props.texts.title}
65
+ onCloseClick={handleOnCloseClick}
66
+ shouldCloseOnOverlayClick={!props.isProcessing}
67
+ showHeader={props.showHeader}
68
+ buttons={modalButtons}
69
+ buttonsAlignment="justify-end"
70
+ >
71
+ <div className="vitals-confirmation-dialog-content">
72
+ <Text text={props.texts.message} containsDangerousHtml={true} />
73
+ </div>
74
+ </ModalWithButtons>
75
+ );
76
+ };
77
+
78
+ ConfirmationDialog.defaultProps = {
79
+ isProcessing: false,
80
+ cancelButtonRole: BUTTON_ROLES.SECONDARY,
81
+ confirmButtonRole: BUTTON_ROLES.PRIMARY,
82
+ size: MODAL_SIZES.DEFAULT,
83
+ showHeader: true,
84
+ };