@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,67 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+
4
+ import { Text } from "../Text/Text";
5
+
6
+ import { ListTablePropsConfigurationField } from "./ListTable";
7
+
8
+ function isEmpty(str: string) {
9
+ return str === null || str === undefined || (isString(str) && str.trim() === "");
10
+ }
11
+
12
+ function isString(obj?: string | any): obj is string {
13
+ return Object.prototype.toString.call(obj) === "[object String]";
14
+ }
15
+
16
+ export interface ListTableCellProps<ItemType, CellType> {
17
+ isHeader?: boolean;
18
+ value: string | CellType;
19
+ configuration: ListTablePropsConfigurationField<ItemType, CellType>;
20
+ emptyValue?: string;
21
+ }
22
+
23
+ export function ListTableCell<ItemType, CellType>({
24
+ isHeader = false,
25
+ value,
26
+ configuration,
27
+ emptyValue,
28
+ }: ListTableCellProps<ItemType, CellType>): JSX.Element {
29
+ const { name, className, textProps } = configuration;
30
+
31
+ const textClassName = classNames("text-left", textProps?.className);
32
+ const cellClassName = classNames("cweb-list-table-content-cell", "py-0 px-3", className);
33
+
34
+ const returnChildren = () => {
35
+ return (
36
+ <>
37
+ {isEmpty(value) && isString(emptyValue) && (
38
+ <Text text={emptyValue} {...textProps} className={textClassName} color={"gray-500"} />
39
+ )}
40
+ {!isEmpty(value) && isString(value) && (
41
+ <Text
42
+ text={value}
43
+ {...textProps}
44
+ className={classNames(textClassName, {
45
+ truncate: !isHeader,
46
+ capitalize: isHeader,
47
+ "w-40": !isHeader,
48
+ })}
49
+ />
50
+ )}
51
+ {!isEmpty(value) && !isString(value) && value}
52
+ </>
53
+ );
54
+ };
55
+
56
+ return isHeader ? (
57
+ <th className={cellClassName} key={name}>
58
+ {returnChildren()}
59
+ </th>
60
+ ) : (
61
+ <td className={classNames(cellClassName, "max-w-40")} key={name}>
62
+ {returnChildren()}
63
+ </td>
64
+ );
65
+ }
66
+
67
+ export default ListTableCell;
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+
4
+ import { ListTableItem, ListTablePropsConfigurationField } from "./ListTable";
5
+ import ListTableCell from "./ListTableCell";
6
+
7
+ export interface ListTableHeaderProps<ItemType extends ListTableItem, CellType> {
8
+ className?: string;
9
+ configurationFields: ListTablePropsConfigurationField<ItemType, CellType>[];
10
+ }
11
+
12
+ export function ListTableHeader<ItemType extends ListTableItem, CellType>({
13
+ className,
14
+ configurationFields,
15
+ }: ListTableHeaderProps<ItemType, CellType>): JSX.Element {
16
+ return (
17
+ <thead className={classNames("cweb-list-table-header-section", className)}>
18
+ <tr className="border-b h-13 border-slate-100">
19
+ {configurationFields.map((field) => (
20
+ <ListTableCell
21
+ isHeader={true}
22
+ key={field.name}
23
+ value={field.title}
24
+ configuration={{
25
+ ...field,
26
+ textProps: { ...field.textProps, type: "strong", className: "py-4 leading-none" },
27
+ }}
28
+ />
29
+ ))}
30
+ </tr>
31
+ </thead>
32
+ );
33
+ }
@@ -0,0 +1,46 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+
4
+ import { ListTableItem, ListTablePropsConfiguration } from "./ListTable";
5
+ import ListTableCell from "./ListTableCell";
6
+
7
+ export interface ListTableRowProps<ItemType extends ListTableItem, CellType> {
8
+ item: ItemType;
9
+ onClick?: (arg: ItemType) => void;
10
+ configuration: ListTablePropsConfiguration<ItemType, CellType>;
11
+ }
12
+
13
+ export function ListTableRow<ItemType extends ListTableItem, CellType>({
14
+ item,
15
+ onClick,
16
+ configuration,
17
+ }: ListTableRowProps<ItemType, CellType>): JSX.Element {
18
+ function handleRowClick(event: React.MouseEvent) {
19
+ event.stopPropagation();
20
+ if (onClick) {
21
+ onClick(item);
22
+ }
23
+ }
24
+
25
+ return (
26
+ <tr
27
+ className={classNames("cweb-list-table-content-section", "h-13", {
28
+ "hover:bg-slate-100 transition-colors ease-in-out duration-300 cursor-pointer": onClick,
29
+ "hover:bg-white cursor-default": !onClick,
30
+ })}
31
+ onClick={handleRowClick}
32
+ key={item[configuration.idField]}
33
+ >
34
+ {configuration.fields.map((field) => (
35
+ <ListTableCell
36
+ key={field.name}
37
+ value={field.field(item)}
38
+ configuration={{ ...field, className: `${field.className ?? ""} border-b border-slate-100` }}
39
+ emptyValue={configuration.emptyValue}
40
+ />
41
+ ))}
42
+ </tr>
43
+ );
44
+ }
45
+
46
+ export default ListTableRow;
@@ -0,0 +1,50 @@
1
+ @import "../../styles/colors";
2
+
3
+ .cweb-loading {
4
+ display: flex;
5
+ justify-content: center;
6
+ align-items: center;
7
+
8
+ .cweb-loading-text {
9
+ margin-bottom: 24px;
10
+ }
11
+
12
+ &.as-modal {
13
+ $border-radius: 4px;
14
+
15
+ position: fixed;
16
+ left: 0;
17
+ right: 0;
18
+ top: 0;
19
+ bottom: 0;
20
+ z-index: 9999;
21
+ background-color: rgba($color-white, 0.6);
22
+
23
+ .cweb-loading-panel {
24
+ position: relative;
25
+ width: 320px;
26
+ min-height: 120px;
27
+ border-radius: $border-radius;
28
+ padding: 16px;
29
+ box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.36);
30
+ background-color: #ffffff;
31
+ display: flex;
32
+ flex-direction: column;
33
+ justify-content: flex-start;
34
+ align-items: center;
35
+
36
+ &:before {
37
+ position: absolute;
38
+ content: "";
39
+ top: 0;
40
+ left: 0;
41
+ right: 0;
42
+ z-index: 1;
43
+ height: 3px;
44
+ background-color: $color-branding-support-1;
45
+ border-top-left-radius: $border-radius;
46
+ border-top-right-radius: $border-radius;
47
+ }
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,44 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+
4
+ import loadingImage from "../../assets/loading.svg";
5
+ import spinner from "../../assets/spinner.svg";
6
+ import graySpinner from "../../assets/spinner-gray.svg";
7
+ import { RestPropped } from "../../types/general.types";
8
+
9
+ import "./LoadingIndicator.scss";
10
+
11
+ export interface LoadingIndicatorProps extends RestPropped {
12
+ asModal?: boolean;
13
+ asSpinner?: boolean;
14
+ className?: string;
15
+ spinnerColor?: "blue" | "gray";
16
+ }
17
+
18
+ export function LoadingIndicator({
19
+ asModal = false,
20
+ asSpinner = false,
21
+ className = "",
22
+ spinnerColor = "blue",
23
+ ...restProps
24
+ }: LoadingIndicatorProps): JSX.Element {
25
+ const spinnerToRender = spinnerColor === "blue" ? spinner : graySpinner;
26
+
27
+ const containerClassName = classNames("cweb-loading", className, {
28
+ "as-modal": asModal,
29
+ });
30
+
31
+ return (
32
+ <div {...restProps} className={containerClassName}>
33
+ <img
34
+ src={asSpinner ? spinnerToRender : loadingImage}
35
+ className={classNames("text-gray-600 fill-current stroke-current", {
36
+ "h-4 w-4": asSpinner,
37
+ "h-8 w-8": !asSpinner,
38
+ })}
39
+ />
40
+ </div>
41
+ );
42
+ }
43
+
44
+ export default LoadingIndicator;
@@ -0,0 +1,74 @@
1
+ import React, { PureComponent } from "react";
2
+ import PropTypes from "prop-types";
3
+ import classNames from "classnames";
4
+
5
+ import Button from "../Button/Button";
6
+
7
+ import "./Menu.scss";
8
+
9
+ class Menu extends PureComponent {
10
+ static propTypes = {
11
+ children: PropTypes.node.isRequired,
12
+ };
13
+
14
+ constructor(props) {
15
+ super(props);
16
+
17
+ this.state = {
18
+ isOpen: false,
19
+ };
20
+ }
21
+
22
+ componentDidMount() {
23
+ document.addEventListener("mousedown", this.handleClickOutside);
24
+ }
25
+
26
+ componentWillUnmount() {
27
+ document.removeEventListener("mousedown", this.handleClickOutside);
28
+ }
29
+
30
+ handleClickOutside = (event) => {
31
+ if (this.rootRef && !this.rootRef.contains(event.target)) {
32
+ this.closeMenu();
33
+ }
34
+ };
35
+
36
+ handleIconClick = (event) => {
37
+ event.preventDefault();
38
+ event.stopPropagation();
39
+ this.openMenu();
40
+ };
41
+
42
+ openMenu = () => {
43
+ this.setState({
44
+ isOpen: true,
45
+ });
46
+ };
47
+
48
+ closeMenu = () => {
49
+ this.setState({
50
+ isOpen: false,
51
+ });
52
+ };
53
+
54
+ render() {
55
+ const { children, className } = this.props;
56
+ const { isOpen } = this.state;
57
+
58
+ const containerClassName = classNames("cweb-menu", className, {
59
+ "is-open": isOpen,
60
+ });
61
+
62
+ return (
63
+ <div className={containerClassName} ref={(element) => (this.rootRef = element)}>
64
+ {isOpen ? (
65
+ <div className="p-6 border shadow-md cweb-menu-content border-slate-300">{children}</div>
66
+ ) : (
67
+ <Button role="tertiary" onClick={this.handleIconClick} className="chart-button" />
68
+ )}
69
+ </div>
70
+ );
71
+ }
72
+ }
73
+
74
+ export default Menu;
@@ -0,0 +1,27 @@
1
+ @import "../../styles/colors";
2
+ @import "../../styles/layout";
3
+
4
+ .cweb-menu {
5
+ > .cweb-menu-content {
6
+ min-width: 300px;
7
+ border-radius: 4px;
8
+ background-color: $color-white;
9
+ }
10
+
11
+ > .cweb-menu-button {
12
+ @include flexbox-layout();
13
+
14
+ width: 44px;
15
+ height: 44px;
16
+ background: url("../../assets/big-menu-icon.svg") no-repeat center;
17
+ transition: 0.2s ease;
18
+ background-size: contain;
19
+ }
20
+
21
+ > .cweb-menu-button:hover {
22
+ width: 44px;
23
+ height: 44px;
24
+ background: url("../../assets/big-menu-icon-hover.svg") no-repeat center;
25
+ transition: 0.2s ease;
26
+ }
27
+ }
@@ -0,0 +1,117 @@
1
+ @import "../../styles/colors";
2
+ @import "../../styles/layout";
3
+ @import "../../styles/utils";
4
+ @import "../../styles/shadows";
5
+
6
+ .cweb-modal-overlay {
7
+ $modal-horizontal-distance: 8px;
8
+ $modal-vertical-distance: 60px;
9
+
10
+ position: fixed;
11
+ left: 0;
12
+ top: 0;
13
+ bottom: 0;
14
+ right: 0;
15
+ overflow-x: hidden;
16
+ overflow-y: auto;
17
+ padding: $modal-vertical-distance $modal-horizontal-distance;
18
+ background-color: rgba(0, 0, 0, 0.25);
19
+ z-index: 20;
20
+
21
+ &.no-title-bar {
22
+ background-color: rgba(0, 0, 0, 0.75);
23
+ }
24
+
25
+ > .cweb-modal {
26
+ @include box-shadow-2dp();
27
+ position: relative;
28
+ margin: 0 auto;
29
+ background: white;
30
+ outline: none;
31
+ border-radius: 8px;
32
+
33
+ &.type-default {
34
+ max-width: 580px;
35
+ }
36
+
37
+ &.type-extra-small {
38
+ max-width: 444px;
39
+ }
40
+
41
+ &.type-wide {
42
+ max-width: 748px;
43
+ }
44
+
45
+ &.type-wider {
46
+ max-width: 868px;
47
+ }
48
+
49
+ &.has-padded-body {
50
+ .cweb-modal-content {
51
+ padding: 1.5rem;
52
+ }
53
+ }
54
+
55
+ .cweb-modal-no-title-section {
56
+ height: 0;
57
+ width: 100%;
58
+ position: relative;
59
+
60
+ > .cweb-modal-close-button {
61
+ position: absolute;
62
+ top: 16px;
63
+ right: 24px;
64
+
65
+ width: 44px;
66
+ height: 44px;
67
+ background: url("../../assets/modal-close-icon.svg") no-repeat center;
68
+ background-size: contain;
69
+
70
+ &:hover,
71
+ &:active,
72
+ &:focus {
73
+ background: url("../../assets/modal-close-icon-active.svg") no-repeat center;
74
+ background-size: contain;
75
+ }
76
+ }
77
+ }
78
+
79
+ .cweb-modal-title-section {
80
+ display: flex;
81
+ flex-direction: row;
82
+ align-items: center;
83
+ border-bottom: 1px solid $color-chrome;
84
+ padding: 24px;
85
+
86
+ > .cweb-modal-title {
87
+ width: 100%;
88
+
89
+ justify-content: flex-start;
90
+ color: $color-secondary;
91
+ font-weight: normal;
92
+ }
93
+
94
+ > .cweb-modal-close-button {
95
+ transition: opacity 0.3s ease-in-out;
96
+ outline: none;
97
+ width: 2rem;
98
+ height: 2rem;
99
+ background: url("../../assets/cross-dark.svg") no-repeat center;
100
+ background-size: contain;
101
+
102
+ opacity: 0.75;
103
+
104
+ &:hover,
105
+ &:active,
106
+ &:focus {
107
+ opacity: 1;
108
+ }
109
+ }
110
+
111
+ > .cweb-modal-content {
112
+ margin: 24px;
113
+ overflow-y: auto;
114
+ }
115
+ }
116
+ }
117
+ }
@@ -0,0 +1,104 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+ import ReactModal from "react-modal";
4
+
5
+ import "./Modal.scss";
6
+ import { Title } from "../Title/Title";
7
+
8
+ export const MODAL_SIZES = {
9
+ DEFAULT: "default",
10
+ WIDE: "wide",
11
+ WIDER: "wider",
12
+ EXTRA_SMALL: "extra-small",
13
+ } as const;
14
+
15
+ type MODAL_SIZES_NAMES = keyof typeof MODAL_SIZES;
16
+ export type MODAL_SIZES_VALUES = typeof MODAL_SIZES[MODAL_SIZES_NAMES];
17
+
18
+ export interface ModalProps {
19
+ children: React.ReactNode;
20
+ type?: MODAL_SIZES_VALUES;
21
+ isOpen?: boolean;
22
+ shouldCloseOnOverlayClick?: boolean;
23
+ showTitleBar?: boolean;
24
+ title?: string;
25
+ onCloseClick?: (event: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element>) => void;
26
+ backAltText?: string;
27
+ closeAltText?: string;
28
+ className?: string;
29
+ closeButtonId?: string;
30
+ withPadding?: boolean;
31
+ showHeader?: boolean;
32
+ }
33
+
34
+ /**
35
+ * Don't use this modal directly if you need to add buttons to it.
36
+ * There's a component called <ModalWithButtons /> you can use instead.
37
+ */
38
+ function Modal({
39
+ children,
40
+ type = MODAL_SIZES.DEFAULT,
41
+ isOpen = false,
42
+ shouldCloseOnOverlayClick = true,
43
+ showTitleBar = true,
44
+ title,
45
+ onCloseClick,
46
+ closeAltText = "Close",
47
+ className,
48
+ closeButtonId,
49
+ withPadding = false,
50
+ showHeader = true,
51
+ }: ModalProps): JSX.Element {
52
+ const containerClassName = classNames("cweb-modal", className, {
53
+ "type-default": type === MODAL_SIZES.DEFAULT,
54
+ "type-wide": type === MODAL_SIZES.WIDE,
55
+ "type-wider": type === MODAL_SIZES.WIDER,
56
+ "type-extra-small": type === MODAL_SIZES.EXTRA_SMALL,
57
+ });
58
+
59
+ const overlayClassName = classNames("cweb-modal-overlay", {
60
+ "no-title-bar": !showTitleBar,
61
+ });
62
+
63
+ ReactModal.setAppElement("body");
64
+
65
+ return (
66
+ <ReactModal
67
+ isOpen={isOpen}
68
+ contentLabel={title}
69
+ portalClassName="cweb-modal-portal"
70
+ overlayClassName={overlayClassName}
71
+ bodyOpenClassName="cweb-modal-body-open"
72
+ htmlOpenClassName="cweb-modal-html-open"
73
+ onRequestClose={onCloseClick}
74
+ shouldFocusAfterRender={false}
75
+ shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
76
+ className={containerClassName}
77
+ >
78
+ {showHeader && (
79
+ <div
80
+ className={classNames({
81
+ "cweb-modal-title-section": showTitleBar,
82
+ "cweb-modal-no-title-section": !showTitleBar,
83
+ })}
84
+ >
85
+ {showTitleBar && title && <Title text={title} type="sm" className="cweb-modal-title" />}
86
+ <button
87
+ data-test-id="close-modal-button"
88
+ role="icon"
89
+ title={closeAltText}
90
+ id={closeButtonId}
91
+ className="cweb-modal-close-button"
92
+ onClick={onCloseClick}
93
+ />
94
+ </div>
95
+ )}
96
+
97
+ {children ? (
98
+ <div className={classNames("cweb-modal-content", { "px-6 py-4": withPadding })}>{children}</div>
99
+ ) : null}
100
+ </ReactModal>
101
+ );
102
+ }
103
+
104
+ export default Modal;
@@ -0,0 +1,34 @@
1
+ import classNames from "classnames";
2
+ import React from "react";
3
+
4
+ import Modal, { ModalProps } from "./Modal";
5
+
6
+ export type ButtonsAlignment = "justify-end" | "justify-between";
7
+
8
+ type ModalWithButtonProps = ModalProps & {
9
+ buttons: [JSX.Element, JSX.Element?];
10
+ buttonsAlignment: ButtonsAlignment;
11
+ };
12
+
13
+ export const ModalWithButtons = (props: ModalWithButtonProps): JSX.Element => {
14
+ const { buttons, buttonsAlignment = "justify-between", children, ...rest } = props;
15
+ return (
16
+ <Modal {...rest} withPadding={false}>
17
+ <div className={classNames("cweb-modal-content", { "px-6 py-4": props.withPadding })}>{children}</div>
18
+ <div
19
+ className={classNames(
20
+ "flex items-center",
21
+ {
22
+ "justify-end": buttonsAlignment === "justify-end" || buttons.length === 1,
23
+ "justify-between": buttonsAlignment === "justify-between" && buttons.length >= 2,
24
+ },
25
+ "px-6 py-4",
26
+ "border-t border-solid rounded-b-lg border-chrome",
27
+ "bg-slate-50"
28
+ )}
29
+ >
30
+ {buttons}
31
+ </div>
32
+ </Modal>
33
+ );
34
+ };