@luscii-healthtech/web-ui 2.9.0 → 2.10.2

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 (287) hide show
  1. package/dist/components/Avatar/Avatar.d.ts +11 -11
  2. package/dist/components/CenteredHero/CenteredHero.d.ts +1 -1
  3. package/dist/components/Container/types/FlexContainerProps.type.d.ts +3 -2
  4. package/dist/components/Datepicker/Datepicker.d.ts +12 -11
  5. package/dist/components/Dropdown/Dropdown.d.ts +17 -7
  6. package/dist/components/ErrorBlock/ErrorBlock.d.ts +3 -3
  7. package/dist/components/Form/form.transformer.d.ts +3 -20
  8. package/dist/components/Form/form.types.d.ts +5 -5
  9. package/dist/components/InfoBlock/InfoBlock.d.ts +4 -4
  10. package/dist/components/Input/SearchInput.d.ts +1 -1
  11. package/dist/components/Line/Line.d.ts +4 -4
  12. package/dist/components/Menu/Menu.d.ts +6 -0
  13. package/dist/components/MultiSelect/MultiSelect.d.ts +7 -7
  14. package/dist/components/Page/CRUDPage.d.ts +13 -13
  15. package/dist/components/Page/Page.d.ts +13 -13
  16. package/dist/components/PaginationMenu/PaginationMenu.utils.d.ts +1 -1
  17. package/dist/components/Radio/Radio.d.ts +5 -1
  18. package/dist/components/RadioGroup/RadioGroup.d.ts +9 -10
  19. package/dist/components/Select/LegacySelect.d.ts +8 -9
  20. package/dist/components/Select/SelectV2.d.ts +1 -1
  21. package/dist/components/Switcher/Switcher.d.ts +6 -6
  22. package/dist/components/Switcher/SwitcherItem.d.ts +7 -7
  23. package/dist/components/Text/LegacyText.d.ts +18 -18
  24. package/dist/components/TextEditor/TextEditor.d.ts +4 -4
  25. package/dist/components/Textarea/Textarea.d.ts +16 -16
  26. package/dist/components/Title/LegacyTitle.d.ts +10 -10
  27. package/dist/web-ui-tailwind.css +8 -0
  28. package/dist/web-ui.cjs.development.js +81 -74
  29. package/dist/web-ui.cjs.development.js.map +1 -1
  30. package/dist/web-ui.cjs.production.min.js +1 -1
  31. package/dist/web-ui.cjs.production.min.js.map +1 -1
  32. package/dist/web-ui.esm.js +81 -74
  33. package/dist/web-ui.esm.js.map +1 -1
  34. package/package.json +7 -3
  35. package/src/assets/add.svg +0 -5
  36. package/src/assets/add_hover.svg +0 -4
  37. package/src/assets/arrow-down-icon.svg +0 -3
  38. package/src/assets/big-menu-icon-hover.svg +0 -6
  39. package/src/assets/big-menu-icon.svg +0 -6
  40. package/src/assets/check-cross-icon.svg +0 -7
  41. package/src/assets/check-icon-primary.svg +0 -5
  42. package/src/assets/check-icon.svg +0 -3
  43. package/src/assets/chevron-double.svg +0 -3
  44. package/src/assets/close.svg +0 -3
  45. package/src/assets/color-variant-cross.svg +0 -3
  46. package/src/assets/cross-dark.svg +0 -3
  47. package/src/assets/delete.svg +0 -4
  48. package/src/assets/delete_hover.svg +0 -4
  49. package/src/assets/edit.svg +0 -6
  50. package/src/assets/edit_hover.svg +0 -6
  51. package/src/assets/error-icon.svg +0 -7
  52. package/src/assets/grid-view-icon-active.svg +0 -6
  53. package/src/assets/grid-view-icon.svg +0 -6
  54. package/src/assets/groups.svg +0 -3
  55. package/src/assets/hamburger.svg +0 -5
  56. package/src/assets/happy-star.svg +0 -9
  57. package/src/assets/hcps.svg +0 -3
  58. package/src/assets/indeterminate-icon.svg +0 -3
  59. package/src/assets/info-icon.svg +0 -6
  60. package/src/assets/left-arrow-blue.svg +0 -3
  61. package/src/assets/left-arrow-grey.svg +0 -3
  62. package/src/assets/list-view-icon-active.svg +0 -3
  63. package/src/assets/list-view-icon.svg +0 -3
  64. package/src/assets/loading.svg +0 -16
  65. package/src/assets/modal-close-icon-active.svg +0 -9
  66. package/src/assets/modal-close-icon.svg +0 -9
  67. package/src/assets/no-open-alerts.svg +0 -19
  68. package/src/assets/patients.svg +0 -3
  69. package/src/assets/phone-mockup.svg +0 -9
  70. package/src/assets/programs.svg +0 -3
  71. package/src/assets/right-arrow-blue.svg +0 -3
  72. package/src/assets/right-arrow-grey.svg +0 -3
  73. package/src/assets/search-cancel.svg +0 -3
  74. package/src/assets/search-not-found.svg +0 -70
  75. package/src/assets/search.svg +0 -3
  76. package/src/assets/spinner-gray.svg +0 -6
  77. package/src/assets/spinner.svg +0 -5
  78. package/src/assets/starIcon.svg +0 -3
  79. package/src/assets/success-icon.svg +0 -6
  80. package/src/components/Accordion/Accordion.tsx +0 -33
  81. package/src/components/Accordion/AccordionItem.tsx +0 -50
  82. package/src/components/Avatar/Avatar.js +0 -81
  83. package/src/components/Avatar/Avatar.scss +0 -153
  84. package/src/components/Badge/Badge.tsx +0 -23
  85. package/src/components/Breadcrumbs/Breadcrumbs.tsx +0 -46
  86. package/src/components/Button/Button.examples.md +0 -46
  87. package/src/components/Button/Button.tsx +0 -200
  88. package/src/components/Button/Button.types.ts +0 -41
  89. package/src/components/Button/ButtonIcon.tsx +0 -42
  90. package/src/components/ButtonV2/ButtonProps.type.ts +0 -44
  91. package/src/components/ButtonV2/ButtonV2.tsx +0 -97
  92. package/src/components/ButtonV2/PrimaryButton.tsx +0 -25
  93. package/src/components/ButtonV2/SecondaryButton.tsx +0 -26
  94. package/src/components/ButtonV2/TertiaryButton.tsx +0 -26
  95. package/src/components/Carousel/Carousel.tsx +0 -52
  96. package/src/components/Carousel/GliderContainer.scss +0 -13
  97. package/src/components/Carousel/GliderContainer.tsx +0 -22
  98. package/src/components/CenteredHero/CenteredHero.tsx +0 -63
  99. package/src/components/CheckBoxListModal/CheckboxListModal.tsx +0 -180
  100. package/src/components/Checkbox/Checkbox.scss +0 -125
  101. package/src/components/Checkbox/Checkbox.tsx +0 -147
  102. package/src/components/CheckboxList/CheckboxGroup.tsx +0 -120
  103. package/src/components/CheckboxList/CheckboxList.tsx +0 -46
  104. package/src/components/CheckboxList/CheckboxList.types.ts +0 -47
  105. package/src/components/CheckboxList/CheckboxListItem.tsx +0 -54
  106. package/src/components/ConfirmationDialog/ConfirmationDialog.scss +0 -15
  107. package/src/components/ConfirmationDialog/ConfirmationDialog.tsx +0 -84
  108. package/src/components/Container/FlexColumn.tsx +0 -18
  109. package/src/components/Container/FlexContainer.tsx +0 -46
  110. package/src/components/Container/FlexRow.tsx +0 -18
  111. package/src/components/Container/types/FlexContainerProps.type.ts +0 -18
  112. package/src/components/Datepicker/Datepicker.js +0 -96
  113. package/src/components/Datepicker/Datepicker.scss +0 -332
  114. package/src/components/Dropdown/Dropdown.js +0 -416
  115. package/src/components/Dropdown/Dropdown.scss +0 -83
  116. package/src/components/EmptyListMessage/EmptyListMessage.tsx +0 -34
  117. package/src/components/ErrorBlock/ErrorBlock.js +0 -24
  118. package/src/components/ErrorBlock/ErrorBlock.scss +0 -20
  119. package/src/components/Form/Form.tsx +0 -138
  120. package/src/components/Form/FormFieldDecorator.tsx +0 -66
  121. package/src/components/Form/FormInput.tsx +0 -47
  122. package/src/components/Form/FormRadioGroup.tsx +0 -23
  123. package/src/components/Form/FormSelect.tsx +0 -32
  124. package/src/components/Form/form.transformer.ts +0 -9
  125. package/src/components/Form/form.types.ts +0 -139
  126. package/src/components/Icons/AddIcon.tsx +0 -29
  127. package/src/components/Icons/AlertsIcon.tsx +0 -39
  128. package/src/components/Icons/BellIcon.tsx +0 -39
  129. package/src/components/Icons/ChartIcon.tsx +0 -22
  130. package/src/components/Icons/ChatBoxIcon.tsx +0 -23
  131. package/src/components/Icons/CheckIcon.tsx +0 -26
  132. package/src/components/Icons/ChevronDoubleIcon.tsx +0 -25
  133. package/src/components/Icons/ChevronDownIcon.tsx +0 -20
  134. package/src/components/Icons/ChevronRightIcon.tsx +0 -20
  135. package/src/components/Icons/CrossIcon.tsx +0 -24
  136. package/src/components/Icons/DeleteIcon.tsx +0 -23
  137. package/src/components/Icons/DownArrowIcon.tsx +0 -23
  138. package/src/components/Icons/DragIcon.tsx +0 -25
  139. package/src/components/Icons/DynamicIcon.tsx +0 -25
  140. package/src/components/Icons/EditIcon.tsx +0 -23
  141. package/src/components/Icons/EmptyIcon.tsx +0 -29
  142. package/src/components/Icons/EmptyStateDashboardIcon.tsx +0 -130
  143. package/src/components/Icons/ExclamationMarkIcon.tsx +0 -23
  144. package/src/components/Icons/EyeIcon.tsx +0 -23
  145. package/src/components/Icons/GearIcon.tsx +0 -23
  146. package/src/components/Icons/GroupIcon.tsx +0 -23
  147. package/src/components/Icons/HamburgerIcon.tsx +0 -31
  148. package/src/components/Icons/HeartIcon.tsx +0 -23
  149. package/src/components/Icons/ImageIcon.tsx +0 -23
  150. package/src/components/Icons/LeftArrowIcon.tsx +0 -23
  151. package/src/components/Icons/LightBulbIcon.tsx +0 -31
  152. package/src/components/Icons/LockIcon.tsx +0 -23
  153. package/src/components/Icons/MessagesIcon.tsx +0 -23
  154. package/src/components/Icons/NotesIcon.tsx +0 -23
  155. package/src/components/Icons/PinIcon.tsx +0 -23
  156. package/src/components/Icons/PrintIcon.tsx +0 -22
  157. package/src/components/Icons/RightArrowIcon.tsx +0 -23
  158. package/src/components/Icons/SearchCancelIcon.tsx +0 -23
  159. package/src/components/Icons/SearchIcon.tsx +0 -23
  160. package/src/components/Icons/SmallCircleIcon.tsx +0 -21
  161. package/src/components/Icons/SmallDiamondIcon.tsx +0 -31
  162. package/src/components/Icons/SmallSquareIcon.tsx +0 -21
  163. package/src/components/Icons/SpaceRocketIcon.tsx +0 -23
  164. package/src/components/Icons/StarIcon.tsx +0 -23
  165. package/src/components/Icons/WarningIcon.tsx +0 -24
  166. package/src/components/Icons/types/IconProps.type.ts +0 -5
  167. package/src/components/InfoBlock/InfoBlock.js +0 -24
  168. package/src/components/InfoBlock/InfoBlock.scss +0 -20
  169. package/src/components/InfoField/InfoField.tsx +0 -94
  170. package/src/components/Input/Input.css +0 -3
  171. package/src/components/Input/Input.tsx +0 -211
  172. package/src/components/Input/SearchInput.tsx +0 -24
  173. package/src/components/Line/Line.js +0 -38
  174. package/src/components/List/List.scss +0 -23
  175. package/src/components/List/List.tsx +0 -138
  176. package/src/components/List/List.types.ts +0 -41
  177. package/src/components/List/ListItem.tsx +0 -89
  178. package/src/components/List/ListItemSkeleton.tsx +0 -26
  179. package/src/components/List/ListSkeleton.scss +0 -5
  180. package/src/components/List/ListSkeleton.tsx +0 -30
  181. package/src/components/LoadingIndicator/LoadingIndicator.scss +0 -50
  182. package/src/components/LoadingIndicator/LoadingIndicator.tsx +0 -46
  183. package/src/components/Menu/Menu.js +0 -74
  184. package/src/components/Menu/Menu.scss +0 -27
  185. package/src/components/Modal/Modal.scss +0 -117
  186. package/src/components/Modal/Modal.tsx +0 -104
  187. package/src/components/Modal/ModalWithButtons.tsx +0 -34
  188. package/src/components/MultiSelect/MultiSelect.js +0 -117
  189. package/src/components/MultiSelect/MultiSelect.scss +0 -29
  190. package/src/components/MultiSelect/MultiSelectUtils.js +0 -23
  191. package/src/components/NavMenu/NavLayout.tsx +0 -40
  192. package/src/components/NavMenu/NavMenu.tsx +0 -39
  193. package/src/components/NavMenu/NavMenu.utils.ts +0 -6
  194. package/src/components/NavMenu/NavMenuContent.tsx +0 -23
  195. package/src/components/NavMenu/NavMenuItem.tsx +0 -102
  196. package/src/components/NotificationBanner/NotificationBanner.tsx +0 -104
  197. package/src/components/Page/CRUDPage.js +0 -123
  198. package/src/components/Page/CRUDPage.scss +0 -32
  199. package/src/components/Page/Page.js +0 -102
  200. package/src/components/Page/Page.scss +0 -59
  201. package/src/components/PageHeader/PageHeader.tsx +0 -51
  202. package/src/components/PaginationMenu/PaginationMenu.tsx +0 -47
  203. package/src/components/PaginationMenu/PaginationMenu.types.ts +0 -46
  204. package/src/components/PaginationMenu/PaginationMenu.utils.ts +0 -49
  205. package/src/components/PaginationMenu/PaginationMenuLarge.tsx +0 -96
  206. package/src/components/PaginationMenu/PaginationMenuSmall.tsx +0 -43
  207. package/src/components/PreviewPhone/PreviewPhone.tsx +0 -52
  208. package/src/components/PreviewPhone/useWindowDimensions.js +0 -26
  209. package/src/components/Radio/Radio.js +0 -102
  210. package/src/components/Radio/Radio.scss +0 -58
  211. package/src/components/Radio/RadioV2.css +0 -15
  212. package/src/components/Radio/RadioV2.tsx +0 -87
  213. package/src/components/RadioGroup/RadioGroup.js +0 -66
  214. package/src/components/RadioGroup/RadioGroup.scss +0 -37
  215. package/src/components/RadioGroup/RadioGroupV2.tsx +0 -35
  216. package/src/components/Section/Section.scss +0 -74
  217. package/src/components/Section/Section.tsx +0 -68
  218. package/src/components/Section/SectionItem.scss +0 -20
  219. package/src/components/Section/SectionItem.tsx +0 -26
  220. package/src/components/Section/SectionItemWithContent.tsx +0 -30
  221. package/src/components/Select/LegacySelect.js +0 -114
  222. package/src/components/Select/Select.scss +0 -29
  223. package/src/components/Select/Select.tsx +0 -151
  224. package/src/components/Select/SelectV2.tsx +0 -171
  225. package/src/components/Select/options.transformer.ts +0 -36
  226. package/src/components/Select/select.utils.spec.ts +0 -63
  227. package/src/components/Select/select.utils.ts +0 -45
  228. package/src/components/SettingsMenuButton/SettingsMenuButton.tsx +0 -111
  229. package/src/components/Spinner/Spinner.tsx +0 -23
  230. package/src/components/Steps/Step.tsx +0 -31
  231. package/src/components/Steps/Steps.tsx +0 -24
  232. package/src/components/Switcher/Switcher.js +0 -58
  233. package/src/components/Switcher/SwitcherItem.js +0 -61
  234. package/src/components/Switcher/SwitcherItem.scss +0 -67
  235. package/src/components/TabLinks/TabLinks.tsx +0 -63
  236. package/src/components/Tabbar/Tabbar.tsx +0 -60
  237. package/src/components/Tabbar/TabbarItem.tsx +0 -66
  238. package/src/components/Table/Table.tsx +0 -91
  239. package/src/components/Table/Table.types.ts +0 -28
  240. package/src/components/Table/Table.utils.ts +0 -23
  241. package/src/components/Table/TableBody.tsx +0 -57
  242. package/src/components/Table/TableBodyRow.tsx +0 -47
  243. package/src/components/Table/TableBodyRowDataCell.tsx +0 -76
  244. package/src/components/Table/TableFooter.tsx +0 -21
  245. package/src/components/Table/TableHeader.tsx +0 -28
  246. package/src/components/Tag/Tag.tsx +0 -58
  247. package/src/components/Tag/Tag.utils.ts +0 -4
  248. package/src/components/Tag/TagGroup.tsx +0 -29
  249. package/src/components/Text/LegacyText.js +0 -78
  250. package/src/components/Text/Text.scss +0 -67
  251. package/src/components/Text/Text.tsx +0 -131
  252. package/src/components/TextEditor/TextEditor.js +0 -61
  253. package/src/components/TextEditor/TextEditor.scss +0 -14
  254. package/src/components/TextEditorV2/TextEditorV2.js +0 -52
  255. package/src/components/TextEditorV2/TextEditorV2.scss +0 -110
  256. package/src/components/TextLink/TextLink.tsx +0 -42
  257. package/src/components/Textarea/Textarea.js +0 -108
  258. package/src/components/Textarea/Textarea.scss +0 -56
  259. package/src/components/Timeline/Timeline.tsx +0 -28
  260. package/src/components/Timeline/TimelineStep.tsx +0 -36
  261. package/src/components/Title/LegacyTitle.js +0 -64
  262. package/src/components/Title/Title.scss +0 -6
  263. package/src/components/Title/Title.tsx +0 -62
  264. package/src/components/Toaster/Toaster.scss +0 -57
  265. package/src/components/Toaster/Toaster.tsx +0 -100
  266. package/src/components/Toaster/toast-elements-getter.ts +0 -72
  267. package/src/components/Toaster/toast-progress-animator.ts +0 -53
  268. package/src/components/Toaster/toast.ts +0 -112
  269. package/src/components/ViewItem/ViewItem.tsx +0 -85
  270. package/src/custom.d.ts +0 -4
  271. package/src/index.tsx +0 -170
  272. package/src/styles/_colors.scss +0 -59
  273. package/src/styles/_layout.scss +0 -64
  274. package/src/styles/_shadows.scss +0 -19
  275. package/src/styles/_skeleton.scss +0 -63
  276. package/src/styles/_typography.scss +0 -8
  277. package/src/styles/_utils.scss +0 -45
  278. package/src/styles/fonts/avenir/3A0AF8_0_0.eot +0 -0
  279. package/src/styles/fonts/avenir/3A0AF8_0_0.ttf +0 -0
  280. package/src/styles/fonts/avenir/3A0AF8_0_0.woff +0 -0
  281. package/src/styles/fonts/avenir/3A0AF8_0_0.woff2 +0 -0
  282. package/src/styles/fonts/avenir/3A0AF8_1_0.eot +0 -0
  283. package/src/styles/fonts/avenir/3A0AF8_1_0.ttf +0 -0
  284. package/src/styles/fonts/avenir/3A0AF8_1_0.woff +0 -0
  285. package/src/styles/fonts/avenir/3A0AF8_1_0.woff2 +0 -0
  286. package/src/types/general.types.ts +0 -11
  287. package/src/utils/useOutsideClick.js +0 -19
@@ -1,123 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import classNames from "classnames";
4
-
5
- import LoadingIndicator from "../LoadingIndicator/LoadingIndicator";
6
- import LegacyTitle, { TITLE_TYPE_OPTIONS } from "../Title/LegacyTitle";
7
- import Button, { BUTTON_ROLES } from "../Button/Button";
8
- import Line from "../Line/Line";
9
- import { NavLayout } from "../NavMenu/NavLayout";
10
- import { Steps } from "../Steps/Steps";
11
-
12
- import "./CRUDPage.scss";
13
-
14
- function CRUDPage({
15
- dataTestId = "page",
16
- title,
17
- stepTitles,
18
- currentStep = 1,
19
- submitButtonProps,
20
- deleteButtonProps,
21
- cancelButtonProps,
22
- icon,
23
- className,
24
- children,
25
- isLoading,
26
- isSubmitting,
27
- navMenuComponent,
28
- localization,
29
- }) {
30
- const mergedClasses = classNames("cweb-crud-page max-w-3xl", className);
31
- const containerClassnames = classNames("cweb-crud-page-container mb-20");
32
-
33
- const submitButton = submitButtonProps && (
34
- <Button
35
- data-test-id="submit-button"
36
- key="submit-button"
37
- /* eslint-disable-next-line */
38
- onClick={submitButtonProps.handler}
39
- role={BUTTON_ROLES.PRIMARY}
40
- text={submitButtonProps.name}
41
- isPending={isSubmitting}
42
- />
43
- );
44
- const deleteButton = deleteButtonProps && (
45
- <Button
46
- data-test-id="delete-button"
47
- key="delete-button"
48
- /* eslint-disable-next-line */
49
- onClick={deleteButtonProps.handler}
50
- role={BUTTON_ROLES.NEGATIVE}
51
- text={deleteButtonProps.name}
52
- />
53
- );
54
- const cancelButton = cancelButtonProps && (
55
- <Button
56
- data-test-id="cancel-button"
57
- key="cancel-button"
58
- /* eslint-disable-next-line */
59
- onClick={cancelButtonProps.handler}
60
- role={BUTTON_ROLES.SECONDARY}
61
- text={cancelButtonProps.name}
62
- />
63
- );
64
-
65
- const renderHeader = () => {
66
- return (
67
- <div className="flex flex-row justify-start align-center">
68
- <img id="title-icon" src={icon} className="mr-4 w-11 h-11" alt={"title icon"} />
69
- <LegacyTitle id="title-text" text={title} type={TITLE_TYPE_OPTIONS.BOLD} />
70
- </div>
71
- );
72
- };
73
-
74
- return (
75
- <div className={containerClassnames}>
76
- <NavLayout menu={navMenuComponent}>
77
- <>
78
- {isLoading && (
79
- <div className={classNames(mergedClasses, "cweb-crud-page-loading-container")}>
80
- <div className="flex flex-row justify-start align-center">{renderHeader()}</div>
81
- <LoadingIndicator className="crud-page-loader" asModal={false} />
82
- </div>
83
- )}
84
-
85
- {!isLoading && (
86
- <div className={mergedClasses} data-test-id={dataTestId}>
87
- <div className="flex flex-row justify-start align-center">{renderHeader()}</div>
88
-
89
- <div className={"cweb-crud-page-form-container"}>
90
- {stepTitles && stepTitles.length > 0 && (
91
- <Steps orderedStepTitles={stepTitles} currentStep={currentStep} className={"mb-4"} localization={localization}/>
92
- )}
93
- {children}
94
- <Line
95
- left={[cancelButton, deleteButton]}
96
- right={[submitButton]}
97
- className={"cweb-crud-page-button-line"}
98
- />
99
- </div>
100
- </div>
101
- )}
102
- </>
103
- </NavLayout>
104
- </div>
105
- );
106
- }
107
-
108
- CRUDPage.propTypes = {
109
- isLoading: PropTypes.bool,
110
- title: PropTypes.string.isRequired,
111
- stepTitles: PropTypes.array,
112
- currentStep: PropTypes.number,
113
- submitButtonProps: PropTypes.shape({ name: PropTypes.string, handler: PropTypes.func }),
114
- deleteButtonProps: PropTypes.shape({ name: PropTypes.string, handler: PropTypes.func }),
115
- cancelButtonProps: PropTypes.shape({ name: PropTypes.string, handler: PropTypes.func }),
116
- className: PropTypes.string,
117
- icon: PropTypes.string,
118
- isSubmitting: PropTypes.bool,
119
- navMenuComponent: PropTypes.elementType,
120
- localization: PropTypes.object,
121
- };
122
-
123
- export default CRUDPage;
@@ -1,32 +0,0 @@
1
- @import "../../styles/colors";
2
-
3
- .cweb-crud-page {
4
- width: 100%;
5
- margin: 36px auto 0;
6
-
7
- &-form-container {
8
- background-color: #fff;
9
- border-radius: 8px;
10
- padding: 24px;
11
- margin-top: 16px;
12
- }
13
-
14
- &-button-line {
15
- border-top: 1px solid $color-divider;
16
- padding-top: 16px;
17
- margin-top: 16px;
18
- }
19
-
20
- &-loading-container {
21
- height: 90vh; /* puting this in 100vh causes an overflow bug */
22
- overflow-y: hidden;
23
- position: relative;
24
-
25
- .crud-page-loader {
26
- position: absolute;
27
- top: 50%;
28
- left: 50%;
29
- transform: translate(-50%, -50%);
30
- }
31
- }
32
- }
@@ -1,102 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import classNames from "classnames";
4
-
5
- //import Breadcrumbs from "../Breadcrumbs/Breadcrumbs";
6
- import LoadingIndicator from "../LoadingIndicator/LoadingIndicator";
7
- //import { SmartNavMenu } from "../../components/NavMenu/SmartNavMenu";
8
- import { NavLayout } from "../NavMenu/NavLayout";
9
- import { Title } from "../Title/Title";
10
- //import { shouldPageShowFeedbackBlock } from "../../common/utils/locationUtils";
11
- //import { FeedbackBlock } from "../FeedbackBlock/FeedbackBlock";
12
- //import { ERROR_PAGE_ID } from "../../components/ErrorPages/ErrorPage";
13
-
14
- import "./Page.scss";
15
-
16
- //TODO this page needs to be refactored
17
-
18
- /**
19
- * Renders page's content, if `isLoading` is false otherwise shows loading indicator.
20
- *
21
- * `breadcrumbs`, `title` and `content` can be lazy properties, that is parameterless functions which return actual value.
22
- * `children` property has priority over `content` property.
23
- *
24
- * @typedef {{ name?: string, icon?: string|Object, link?: string}} Breadcrumb
25
- *
26
- */
27
- function Page({
28
- dataTestId = "page",
29
- breadcrumbs,
30
- title,
31
- accessories,
32
- accessoryPosition = "right",
33
- className,
34
- children,
35
- content,
36
- isLoading = false,
37
- isPolling = false,
38
- spinnerColor = "blue",
39
- navLayoutProps = {},
40
- showFeedbackBlock = false,
41
- feedbackBlock = <></>,
42
- navMenu,
43
- id,
44
- }) {
45
- const mergedPageClasses = classNames("cweb-page", className);
46
- const containerClassnames = classNames("cweb-page-container");
47
-
48
- if (isLoading) {
49
- return (
50
- <div className={mergedPageClasses}>
51
- <LoadingIndicator asModal={false} />
52
- </div>
53
- );
54
- }
55
-
56
- const maybeTitle = title instanceof Function ? title() : title;
57
-
58
- const accessoryClasses = classNames("cweb-page-header mb-4", {
59
- [`accessory-${accessoryPosition}`]: true,
60
- });
61
-
62
- const accessoriesContent = accessories instanceof Function ? accessories() : accessories;
63
- const childrenOrContentProp = children || (content instanceof Function ? content() : content);
64
-
65
- return (
66
- <div id={id} className={containerClassnames}>
67
- <NavLayout menu={navMenu} {...navLayoutProps}>
68
- <div className={mergedPageClasses} data-test-id={dataTestId}>
69
- <div className={accessoryClasses}>
70
- <Title data-test-id={`${dataTestId}-title`} text={maybeTitle} />
71
- {isPolling && <LoadingIndicator asSpinner={true} className={"page-spinner"} spinnerColor={spinnerColor} />}
72
- {accessoriesContent}
73
- </div>
74
- {childrenOrContentProp}
75
- </div>
76
-
77
- {!isLoading && feedbackBlock}
78
- </NavLayout>
79
- </div>
80
- );
81
- }
82
-
83
- const breadcrumbItemShape = PropTypes.shape({
84
- name: PropTypes.string,
85
- icon: PropTypes.string,
86
- link: PropTypes.string,
87
- });
88
-
89
- Page.propTypes = {
90
- breadcrumbs: PropTypes.oneOfType([PropTypes.arrayOf(breadcrumbItemShape), PropTypes.func]),
91
- isLoading: PropTypes.bool,
92
- isFetching: PropTypes.bool,
93
- spinnerColor: PropTypes.oneOf(["blue", "gray"]),
94
- title: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
95
- accessories: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
96
- accessoryPosition: PropTypes.oneOf(["right", "bottom", "left"]),
97
- content: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.func]),
98
- id: PropTypes.string,
99
- navLayoutProps: PropTypes.object,
100
- };
101
-
102
- export default Page;
@@ -1,59 +0,0 @@
1
- .cweb-page {
2
- width: 100%;
3
- max-width: 1140px;
4
- margin: 32px auto 0 auto;
5
-
6
- .cweb-page-breadcrumbs {
7
- margin-bottom: 16px;
8
- }
9
-
10
- .page-spinner {
11
- margin-left: 8px;
12
- margin-bottom: 4px;
13
-
14
- img {
15
- width: 21px;
16
- }
17
- }
18
-
19
- .cweb-page-header {
20
- display: flex;
21
- align-items: center;
22
- width: 100%;
23
- flex-grow: 0;
24
-
25
- .cweb-page-title {
26
- display: inline;
27
- }
28
-
29
- &.accessory-right {
30
- flex-direction: row;
31
- justify-content: space-between;
32
- align-items: center;
33
- }
34
-
35
- &.accessory-bottom {
36
- @media screen and (max-width: 426px) {
37
- max-width: 75vw;
38
-
39
- img {
40
- max-width: 10vw;
41
- }
42
-
43
- button {
44
- p {
45
- font-size: 4vw;
46
- }
47
- }
48
- }
49
-
50
- flex-direction: column;
51
- align-items: flex-start;
52
-
53
- .cweb-page-title {
54
- margin-bottom: 8px;
55
- display: inline;
56
- }
57
- }
58
- }
59
- }
@@ -1,51 +0,0 @@
1
- import React from "react";
2
-
3
- import { Breadcrumbs, BreadcrumbProps } from "../Breadcrumbs/Breadcrumbs";
4
- import LoadingIndicator from "../LoadingIndicator/LoadingIndicator";
5
- import Tabbar, { TabbarProps } from "../Tabbar/Tabbar";
6
- import { Title } from "../Title/Title";
7
-
8
- export interface PageHeaderProps {
9
- navigation?: Omit<TabbarProps, "withoutPadding">;
10
- breadcrumbs?: BreadcrumbProps["crumbs"];
11
- dataTestId?: string;
12
- title: string;
13
- isPolling?: boolean;
14
- accessories?: React.ReactNode;
15
- }
16
-
17
- export const PageHeader: React.VoidFunctionComponent<PageHeaderProps> = ({
18
- navigation,
19
- breadcrumbs,
20
- dataTestId,
21
- accessories,
22
- isPolling,
23
- title,
24
- }) => {
25
- return (
26
- <div data-test-id="page-header" className="p-4 space-y-4 bg-white">
27
- {!!breadcrumbs?.length && (
28
- <div className="mb-4 space-y-4">
29
- <Breadcrumbs crumbs={breadcrumbs} />
30
- <div className="mb-4 border-b border-slate-100" />
31
- </div>
32
- )}
33
- <div className="flex flex-row items-center justify-between">
34
- <div className="flex flex-row items-center space-x-3">
35
- <Title data-test-id={`${dataTestId}-title`} text={title} />
36
- {isPolling && (
37
- <LoadingIndicator
38
- asSpinner={true}
39
- className={"page-spinner"}
40
- spinnerColor="gray"
41
- />
42
- )}
43
- </div>
44
- {accessories && (
45
- <div data-test-id="page-header-accessories">{accessories}</div>
46
- )}
47
- </div>
48
- {navigation && <Tabbar {...navigation} withoutPadding />}
49
- </div>
50
- );
51
- };
@@ -1,47 +0,0 @@
1
- import React from "react";
2
- import classNames from "classnames";
3
-
4
- import { PaginationMenuSmall } from "./PaginationMenuSmall";
5
- import { PaginationMenuLarge } from "./PaginationMenuLarge";
6
- import { PaginationMenuProps } from "./PaginationMenu.types";
7
-
8
- export const PaginationMenu = (props: PaginationMenuProps): JSX.Element => {
9
- const buildPaginationLarge = (): JSX.Element => {
10
- if (!props.localization) {
11
- console.error(
12
- "Localization is required to use the non small Pagination component, please make sure to pass it as a prop."
13
- );
14
- return <span>Invalid props passed to this component.</span>;
15
- }
16
- return (
17
- <PaginationMenuLarge
18
- pageCount={props.pageCount}
19
- currentPageNumber={props.currentPageNumber}
20
- onChange={props.onChange}
21
- pageSize={props.pageSize}
22
- localization={props.localization}
23
- resultCount={props.resultCount}
24
- />
25
- );
26
- };
27
-
28
- return (
29
- <div
30
- className={classNames(
31
- "flex flex-row w-full items-center justify-between",
32
- props.className
33
- )}
34
- >
35
- {props.small ? (
36
- <PaginationMenuSmall
37
- pageCount={props.pageCount}
38
- currentPageNumber={props.currentPageNumber}
39
- pageSize={props.pageSize}
40
- onChange={props.onChange}
41
- />
42
- ) : (
43
- buildPaginationLarge()
44
- )}
45
- </div>
46
- );
47
- };
@@ -1,46 +0,0 @@
1
- export interface PaginationMenuProps {
2
- pageCount: number;
3
- currentPageNumber: number;
4
- onChange: OnPaginationChange;
5
- pageSize?: PageSize;
6
- localization?: Localization;
7
- resultCount?: number;
8
- small?: boolean;
9
- className?: string;
10
- }
11
-
12
- export interface PaginationMenuSmallProps {
13
- pageCount: number;
14
- currentPageNumber: number;
15
- onChange: OnPaginationChange;
16
- pageSize?: PageSize;
17
- }
18
-
19
- export interface PaginationMenuLargeProps {
20
- pageCount: number;
21
- currentPageNumber: number;
22
- onChange: OnPaginationChange;
23
- pageSize?: PageSize;
24
- localization: Localization;
25
- resultCount?: number;
26
- }
27
-
28
- export type OnPaginationChange = (
29
- pageNumber: number,
30
- pageSize?: PageSize
31
- ) => void;
32
-
33
- export type PageSize = 25 | 50 | 75 | 100;
34
-
35
- export interface Localization {
36
- display: string;
37
- page: string;
38
- previous: string;
39
- next: string;
40
- of: string;
41
- }
42
-
43
- export type Option = {
44
- value: number;
45
- label: string;
46
- };
@@ -1,49 +0,0 @@
1
- import { Localization, Option, PageSize } from "./PaginationMenu.types";
2
-
3
- const PAGE_SIZES: PageSize[] = [25, 50, 75, 100];
4
-
5
- export const PAGE_SIZE_OPTIONS = PAGE_SIZES.map(pageSize => {
6
- return {
7
- label: pageSize.toString(),
8
- value: pageSize,
9
- };
10
- });
11
-
12
- export const getPageNumberOptions = (pageCount: number): Option[] => {
13
- const items: Option[] = [];
14
- for (let i = 1; i <= pageCount; i++) {
15
- items.push({
16
- label: i.toString(),
17
- value: i,
18
- });
19
- }
20
- return items;
21
- };
22
-
23
- /**
24
- *
25
- * @returns When the pageSize and resultCount params are present,
26
- * this function returns a text indicating the range of elements that are being displayed,
27
- * otherwise it returns a text indicating the current page and the page count.
28
- * @example 1-50 of 100
29
- *
30
- */
31
- export const getSummaryText = (
32
- pageCount: number,
33
- currentPageNumber: number,
34
- localization: Localization,
35
- pageSize?: number,
36
- resultCount?: number
37
- ): string => {
38
- if (pageSize && resultCount) {
39
- const lowestElement = (currentPageNumber - 1) * pageSize + 1;
40
- const highestElement =
41
- currentPageNumber === pageCount
42
- ? resultCount
43
- : currentPageNumber * pageSize;
44
-
45
- return `${lowestElement}-${highestElement} ${localization.of} ${resultCount}`;
46
- } else {
47
- return `${localization.page} ${currentPageNumber} / ${pageCount}`;
48
- }
49
- };
@@ -1,96 +0,0 @@
1
- import React from "react";
2
- import { GroupBase, SingleValue } from "react-select";
3
-
4
- import { SecondaryButton } from "../ButtonV2/SecondaryButton";
5
- import Select from "../Select/Select";
6
- import { Text } from "../Text/Text";
7
-
8
- import { Option, PaginationMenuLargeProps } from "./PaginationMenu.types";
9
- import {
10
- getPageNumberOptions,
11
- getSummaryText,
12
- PAGE_SIZE_OPTIONS,
13
- } from "./PaginationMenu.utils";
14
-
15
- export const PaginationMenuLarge = (
16
- props: PaginationMenuLargeProps
17
- ): JSX.Element => {
18
- const handleOnPageNumberSelect = (optionSelected: SingleValue<Option>) => {
19
- optionSelected && props.onChange(optionSelected.value, props.pageSize);
20
- };
21
- const handleOnPageSizeSelect = (optionSelected: SingleValue<Option>) => {
22
- const pageSize = PAGE_SIZE_OPTIONS.find(
23
- option => option === optionSelected
24
- );
25
- pageSize && props.onChange(1, pageSize.value);
26
- };
27
- const handleOnPrevNextButtonClick = (
28
- event: React.MouseEvent<HTMLButtonElement>
29
- ) => {
30
- const newPage = event.currentTarget.dataset.page;
31
- newPage && props.onChange(parseInt(newPage, 10), props.pageSize);
32
- };
33
-
34
- return (
35
- <>
36
- <div className={"flex flex-row items-center"}>
37
- {props.pageSize && props.resultCount && (
38
- <>
39
- <Text text={props.localization.display} />
40
- <Select<Option, false, GroupBase<Option>>
41
- className={"w-24 ml-2 mr-4"}
42
- options={PAGE_SIZE_OPTIONS}
43
- onChange={handleOnPageSizeSelect}
44
- value={{
45
- label: props.pageSize.toString(),
46
- value: props.pageSize,
47
- }}
48
- menuPlacement="auto"
49
- />
50
- </>
51
- )}
52
- <Text text={props.localization.page} />
53
- <Select<Option, false, GroupBase<Option>>
54
- className={"w-24 ml-2"}
55
- options={getPageNumberOptions(props.pageCount)}
56
- onChange={handleOnPageNumberSelect}
57
- value={{
58
- label: props.currentPageNumber.toString(),
59
- value: props.currentPageNumber,
60
- }}
61
- isDisabled={props.pageCount < 2}
62
- menuPlacement="auto"
63
- />
64
- </div>
65
-
66
- <div className={"ml-4 flex flex-row items-center"}>
67
- <Text
68
- text={getSummaryText(
69
- props.pageCount,
70
- props.currentPageNumber,
71
- props.localization,
72
- props.pageSize,
73
- props.resultCount
74
- )}
75
- color="slate-500"
76
- />
77
- <SecondaryButton
78
- data-test-id="prev-button"
79
- text={props.localization.previous}
80
- data-page={props.currentPageNumber - 1}
81
- onClick={handleOnPrevNextButtonClick}
82
- isDisabled={props.currentPageNumber === 1}
83
- className="ml-4"
84
- />
85
- <SecondaryButton
86
- data-test-id="next-button"
87
- text={props.localization.next}
88
- isDisabled={props.currentPageNumber === props.pageCount}
89
- data-page={props.currentPageNumber + 1}
90
- onClick={handleOnPrevNextButtonClick}
91
- className="ml-4"
92
- />
93
- </div>
94
- </>
95
- );
96
- };
@@ -1,43 +0,0 @@
1
- import React from "react";
2
-
3
- import { TertiaryButton } from "../ButtonV2/TertiaryButton";
4
- import { LeftArrowIcon } from "../Icons/LeftArrowIcon";
5
- import { RightArrowIcon } from "../Icons/RightArrowIcon";
6
- import { Text } from "../Text/Text";
7
-
8
- import { PaginationMenuSmallProps } from "./PaginationMenu.types";
9
-
10
- export const PaginationMenuSmall = (
11
- props: PaginationMenuSmallProps
12
- ): JSX.Element => {
13
- const handleOnChange = (event: React.MouseEvent<HTMLButtonElement>) => {
14
- const pageNumber = event.currentTarget.dataset.page;
15
- pageNumber && props.onChange(parseInt(pageNumber, 10), props.pageSize);
16
- };
17
-
18
- return (
19
- <>
20
- <TertiaryButton
21
- data-test-id="prev-button"
22
- icon={LeftArrowIcon}
23
- data-page={props.currentPageNumber - 1}
24
- onClick={handleOnChange}
25
- isDisabled={props.currentPageNumber === 1}
26
- />
27
- <Text
28
- className="ml-4"
29
- text={`${props.currentPageNumber} / ${props.pageCount}`}
30
- type="sm"
31
- color="slate-500"
32
- />
33
- <TertiaryButton
34
- className="ml-4"
35
- data-test-id="next-button"
36
- icon={RightArrowIcon}
37
- isDisabled={props.currentPageNumber === props.pageCount}
38
- data-page={props.currentPageNumber + 1}
39
- onClick={handleOnChange}
40
- />
41
- </>
42
- );
43
- };