@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,59 @@
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
+ }
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import classNames from "classnames";
4
+
5
+ import { PaginationMenuSmall } from "./PaginationMenuSmall";
6
+ import { PaginationMenuLarge } from "./PaginationMenuLarge";
7
+
8
+ PaginationMenu.propTypes = {
9
+ pageCount: PropTypes.number.isRequired,
10
+ currentPage: PropTypes.number.isRequired,
11
+ onPageClick: PropTypes.func.isRequired,
12
+ small: PropTypes.bool,
13
+ className: PropTypes.string,
14
+ localization: PropTypes.object,
15
+ };
16
+
17
+ function PaginationMenu({ pageCount, currentPage, onPageClick, small, className, localization }) {
18
+ const containerClassName = classNames("flex flex-row flex-space-between w-full items-center", className);
19
+
20
+ return (
21
+ <div className={containerClassName}>
22
+ {small ? (
23
+ <PaginationMenuSmall pageCount={pageCount} currentPage={currentPage} onPageClick={onPageClick} />
24
+ ) : (
25
+ <PaginationMenuLarge pageCount={pageCount} currentPage={currentPage} onPageClick={onPageClick} localization={localization}/>
26
+ )}
27
+ </div>
28
+ );
29
+ }
30
+
31
+ export default PaginationMenu;
@@ -0,0 +1,94 @@
1
+ import * as React from "react";
2
+ import { useEffect, useState } from "react";
3
+ import { GroupBase, SingleValue } from "react-select";
4
+
5
+ import Button, { BUTTON_ROLES } from "../Button/Button";
6
+ import Select from "../Select/Select";
7
+ import { Text } from "../Text/Text";
8
+
9
+ interface PaginationMenuLargeProps {
10
+ pageCount: number;
11
+ currentPage: number;
12
+ onPageClick: (page: number) => void;
13
+ localization: {previous: string, next: string, page: string};
14
+ }
15
+
16
+ type Option = {
17
+ value: string;
18
+ label: string;
19
+ };
20
+
21
+ export const PaginationMenuLarge = (props: PaginationMenuLargeProps): JSX.Element => {
22
+ const [page, setPage] = useState<Option>({ value: "", label: "" });
23
+
24
+ useEffect(() => {
25
+ setPage({
26
+ label: props.currentPage.toString(),
27
+ value: props.currentPage.toString(),
28
+ });
29
+ }, [props.currentPage]);
30
+
31
+ function handleOnPageClick(event: React.MouseEvent<HTMLButtonElement>) {
32
+ event.preventDefault();
33
+ const newPage: string = event.currentTarget.dataset.page;
34
+ setPage({ value: newPage, label: newPage });
35
+ props.onPageClick(parseInt(newPage, 10));
36
+ }
37
+
38
+ function handleOnPageSelect(newValue: SingleValue<Option>) {
39
+ newValue?.value && props.onPageClick(parseInt(newValue.value));
40
+ }
41
+
42
+ function getPageOptions(): Option[] {
43
+ const items = [];
44
+ for (let i = 1; i <= props.pageCount; i++) {
45
+ items.push({
46
+ label: i.toString(),
47
+ value: i.toString(),
48
+ });
49
+ }
50
+
51
+ return items;
52
+ }
53
+
54
+ return (
55
+ <>
56
+ <div className={"flex flex-row ml-2 mr-3 items-center"}>
57
+ <Text className="mr-3" text={props.localization.page} />
58
+ <Select<Option, false, GroupBase<Option>>
59
+ className={"w-24"}
60
+ options={getPageOptions()}
61
+ onChange={handleOnPageSelect}
62
+ value={page}
63
+ isDisabled={props.pageCount < 2}
64
+ menuPlacement="auto"
65
+ />
66
+ </div>
67
+ <div className={"mr-2 ml-auto flex flex-row items-center"}>
68
+ <Text
69
+ className="mr-3"
70
+ text={`${props.localization.page} ${props.currentPage} / ${props.pageCount}`}
71
+ color="gray-500"
72
+ />
73
+ <Button
74
+ data-test-id="prev-button"
75
+ role={BUTTON_ROLES.SECONDARY}
76
+ text={props.localization.previous}
77
+ data-page={props.currentPage - 1}
78
+ onClick={handleOnPageClick}
79
+ isDisabled={props.currentPage === 1}
80
+ className="w-24 mr-3"
81
+ />
82
+ <Button
83
+ data-test-id="next-button"
84
+ role={BUTTON_ROLES.SECONDARY}
85
+ text={props.localization.next}
86
+ isDisabled={props.currentPage === props.pageCount}
87
+ data-page={props.currentPage + 1}
88
+ onClick={handleOnPageClick}
89
+ className="w-24"
90
+ />
91
+ </div>
92
+ </>
93
+ );
94
+ };
@@ -0,0 +1,40 @@
1
+ import * as React from "react";
2
+
3
+ import Button, { BUTTON_ROLES } from "../Button/Button";
4
+ import { Text } from "../Text/Text";
5
+
6
+ interface PaginationMenuSmallProps {
7
+ pageCount: number;
8
+ currentPage: number;
9
+ onPageClick: (page: number) => void;
10
+ }
11
+
12
+ export const PaginationMenuSmall = (props: PaginationMenuSmallProps): JSX.Element => {
13
+ function handleOnPageClick(event: React.MouseEvent<HTMLButtonElement>) {
14
+ event.preventDefault();
15
+ const page = event.currentTarget.dataset.page;
16
+ props.onPageClick(parseInt(page, 10));
17
+ }
18
+
19
+ return (
20
+ <>
21
+ <Button
22
+ data-test-id="prev-button"
23
+ role={BUTTON_ROLES.TERTIARY}
24
+ iconName={props.currentPage === 1 ? "chevron-left-grey" : "chevron-left-blue"}
25
+ data-page={props.currentPage - 1}
26
+ onClick={handleOnPageClick}
27
+ isDisabled={props.currentPage === 1}
28
+ />
29
+ <Text text={`${props.currentPage} / ${props.pageCount}`} type="sm" color="gray-500" />
30
+ <Button
31
+ data-test-id="next-button"
32
+ role={BUTTON_ROLES.TERTIARY}
33
+ iconName={props.currentPage === props.pageCount ? "chevron-right-grey" : "chevron-right-blue"}
34
+ isDisabled={props.currentPage === props.pageCount}
35
+ data-page={props.currentPage + 1}
36
+ onClick={handleOnPageClick}
37
+ />
38
+ </>
39
+ );
40
+ };
@@ -0,0 +1,53 @@
1
+ import React, { useCallback, useEffect, useState } from "react";
2
+ import classNames from "classnames";
3
+
4
+ import phoneMockup from "../../assets/phone-mockup.svg";
5
+
6
+ import { useWindowDimensions } from "./useWindowDimensions";
7
+
8
+ interface PreviewPhoneProps {
9
+ className?: string;
10
+ children: React.ReactNode;
11
+ }
12
+
13
+ const PreviewPhone = ({ className, children }: PreviewPhoneProps): JSX.Element => {
14
+ const phoneHeight = 637;
15
+ const phoneWidth = 340;
16
+ const [scale, setScale] = useState(1);
17
+ const [showPhone, setShowPhone] = useState(false);
18
+ const { height: windowHeight, width: windowWidth } = useWindowDimensions();
19
+
20
+ useEffect(() => {
21
+ // hack to offset rendering the phone after the first render
22
+ // this way the scale calculation works without fixed width
23
+ setShowPhone(true);
24
+ }, []);
25
+
26
+ const containerCallbak = useCallback(
27
+ (containerElement) => {
28
+ if (!containerElement) {
29
+ return;
30
+ }
31
+ const { clientWidth: containerWidth, clientHeight: containerHeight } = containerElement;
32
+ const heightScale = containerHeight < phoneHeight ? containerHeight / phoneHeight : 1;
33
+ const widthScale = containerWidth < phoneWidth ? containerWidth / phoneWidth : 1;
34
+ setScale(heightScale < widthScale ? heightScale : widthScale);
35
+ },
36
+ [windowHeight, windowWidth]
37
+ );
38
+
39
+ return (
40
+ showPhone && (
41
+ <div ref={containerCallbak} className={classNames("relative h-full flex items-center justify-center", className)}>
42
+ <div className={"absolute"} style={{ width: phoneWidth, height: phoneHeight, transform: `scale(${scale})` }}>
43
+ <div className={"h-full px-5 pt-11 pb-20"}>
44
+ <div className={"h-full overflow-y-auto bg-white"}>{children}</div>
45
+ </div>
46
+ <img className="absolute top-0 pointer-events-none" src={phoneMockup} alt="phone mockup" />
47
+ </div>
48
+ </div>
49
+ )
50
+ );
51
+ };
52
+
53
+ export default PreviewPhone;
@@ -0,0 +1,26 @@
1
+ import { useState, useEffect } from "react";
2
+ import debounce from "lodash/debounce";
3
+
4
+ export const useWindowDimensions = () => {
5
+ const [height, setHeight] = useState(window.innerHeight);
6
+ const [width, setWidth] = useState(window.innerWidth);
7
+
8
+ useEffect(() => {
9
+ const handleResize = debounce(() => {
10
+ if (height !== window.innerHeight) {
11
+ setHeight(window.innerHeight);
12
+ }
13
+ if (width !== window.innerWidth) {
14
+ setWidth(window.innerWidth);
15
+ }
16
+ }, 500);
17
+
18
+ window.addEventListener("resize", handleResize);
19
+
20
+ return () => {
21
+ window.removeEventListener("resize", handleResize);
22
+ };
23
+ }, []);
24
+
25
+ return { height, width };
26
+ };
@@ -0,0 +1,99 @@
1
+ import React, { PureComponent } from "react";
2
+ import PropTypes from "prop-types";
3
+ import classNames from "classnames";
4
+
5
+ import "./Radio.scss";
6
+ import { Text } from "../Text/Text";
7
+
8
+ class Radio extends PureComponent {
9
+ static propTypes = {
10
+ className: PropTypes.string,
11
+ text: PropTypes.string,
12
+ isChecked: PropTypes.bool.isRequired,
13
+ isDisabled: PropTypes.bool,
14
+ name: PropTypes.string.isRequired,
15
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
16
+ onChange: PropTypes.func,
17
+ };
18
+
19
+ constructor(props) {
20
+ super(props);
21
+
22
+ this.state = {
23
+ isFocused: false,
24
+ };
25
+ }
26
+
27
+ handleChange = (event) => {
28
+ const { onChange } = this.props;
29
+
30
+ if (onChange) {
31
+ onChange(event);
32
+ }
33
+ };
34
+
35
+ handleFocus = () => {
36
+ this.setState({
37
+ isFocused: true,
38
+ });
39
+ };
40
+
41
+ handleBlur = () => {
42
+ this.setState({
43
+ isFocused: false,
44
+ });
45
+ };
46
+
47
+ render() {
48
+ const { className, isChecked, isDisabled, name, value, text } = this.props;
49
+
50
+ const { isFocused } = this.state;
51
+
52
+ const containerClassName = classNames("cweb-radio mr-4", className, {
53
+ "is-focused": isFocused,
54
+ "is-checked": isChecked,
55
+ "opacity-50": isDisabled,
56
+ });
57
+
58
+ return (
59
+ <div className={containerClassName} ref={this.containerRef}>
60
+ <label className="cweb-radio-label">
61
+ <input
62
+ className="cweb-radio-input"
63
+ name={name}
64
+ type="radio"
65
+ checked={isChecked}
66
+ disabled={isDisabled}
67
+ value={value}
68
+ onBlur={this.handleBlur}
69
+ onFocus={this.handleFocus}
70
+ onChange={this.handleChange}
71
+ />
72
+
73
+ <span
74
+ className={classNames("cweb-radio-icon-container", {
75
+ "bg-primary": isChecked,
76
+ "hover:bg-primary-dark": isChecked,
77
+ "outline-primary": isFocused,
78
+ "cursor-not-allowed": isDisabled,
79
+ "cursor-pointer": !isDisabled,
80
+ })}
81
+ >
82
+ <span className="cweb-radio-icon" />
83
+ </span>
84
+
85
+ {text && (
86
+ <Text
87
+ className={classNames("cweb-radio-label-text", {
88
+ "cursor-not-allowed": isDisabled,
89
+ })}
90
+ text={text}
91
+ />
92
+ )}
93
+ </label>
94
+ </div>
95
+ );
96
+ }
97
+ }
98
+
99
+ export default Radio;
@@ -0,0 +1,58 @@
1
+ @import "../../styles/colors";
2
+
3
+ .cweb-radio {
4
+ outline: none;
5
+
6
+ .cweb-radio-input {
7
+ -webkit-appearance: none;
8
+ height: 1px;
9
+ opacity: 0;
10
+ width: 1px;
11
+ }
12
+
13
+ .cweb-radio-label-text {
14
+ margin-left: 8px;
15
+ user-select: none;
16
+ text-align: left;
17
+ }
18
+
19
+ .cweb-radio-label {
20
+ display: flex;
21
+ align-items: center;
22
+ margin-bottom: 0;
23
+ }
24
+
25
+ .cweb-radio-icon-container {
26
+ width: 16px;
27
+ height: 16px;
28
+ position: relative;
29
+
30
+ border: 1px solid $color-border;
31
+ border-radius: 50%;
32
+
33
+ transition: background-color 0.3s ease-in-out;
34
+ }
35
+
36
+ .cweb-radio-icon {
37
+ position: absolute;
38
+ top: 50%;
39
+ left: 50%;
40
+ transform: translate(-50%, -50%);
41
+ display: block;
42
+ }
43
+
44
+ &.is-focused {
45
+ .cweb-radio-icon-container {
46
+ border-color: $color-primary;
47
+ }
48
+ }
49
+
50
+ &.is-checked {
51
+ .cweb-radio-icon {
52
+ width: 5px;
53
+ height: 5px;
54
+ background-color: $color-white;
55
+ border-radius: 50%;
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,63 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import classNames from "classnames";
4
+
5
+ import Radio from "../Radio/Radio";
6
+
7
+ import "./RadioGroup.scss";
8
+
9
+ function RadioGroup({
10
+ className,
11
+ radioClassName,
12
+ name,
13
+ selectedOption,
14
+ isVertical,
15
+ radioOptions,
16
+ onChange,
17
+ error,
18
+ isDisabled,
19
+ ...otherOptions
20
+ }) {
21
+ const containerClassName = classNames("cweb-radio-group", { vertical: isVertical }, { hasError: error }, className);
22
+
23
+ function handleChange(event) {
24
+ if (!isDisabled && onChange) {
25
+ onChange(event);
26
+ }
27
+ }
28
+
29
+ return (
30
+ <div className={containerClassName} {...otherOptions}>
31
+ {radioOptions.map((option) => (
32
+ <Radio
33
+ {...option}
34
+ key={option.value}
35
+ className={radioClassName}
36
+ name={name}
37
+ isChecked={selectedOption === option.value}
38
+ onChange={handleChange}
39
+ isDisabled={isDisabled}
40
+ />
41
+ ))}
42
+ </div>
43
+ );
44
+ }
45
+
46
+ RadioGroup.propTypes = {
47
+ className: PropTypes.string,
48
+ radioClassName: PropTypes.string,
49
+ name: PropTypes.string,
50
+ selectedOption: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
51
+ isVertical: PropTypes.bool,
52
+ radioOptions: PropTypes.arrayOf(
53
+ PropTypes.shape({
54
+ text: PropTypes.string,
55
+ info: PropTypes.string,
56
+ isDisabled: PropTypes.bool,
57
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
58
+ })
59
+ ).isRequired,
60
+ onChange: PropTypes.func,
61
+ };
62
+
63
+ export default RadioGroup;
@@ -0,0 +1,37 @@
1
+ @import "../../styles/colors";
2
+ @import "../../styles/layout";
3
+
4
+ .cweb-radio-group {
5
+ @include flexbox-horizontal(center);
6
+
7
+ > .cweb-radio {
8
+ flex: 0 0 auto;
9
+ margin-right: 8px;
10
+ }
11
+
12
+ .cweb-form-field {
13
+ margin-bottom: 12px;
14
+ }
15
+
16
+ .cweb-form-info-text {
17
+ margin-left: 1.5rem;
18
+ }
19
+
20
+ &.vertical {
21
+ @include flexbox-vertical(flex-start);
22
+
23
+ .cweb-form-field:not(:last-child) {
24
+ margin-bottom: 8px;
25
+ }
26
+
27
+ > .cweb-radio {
28
+ flex: 0 0 auto;
29
+ margin-bottom: 8px;
30
+ }
31
+ }
32
+ &.hasError {
33
+ > .cweb-radio .cweb-radio-icon-container {
34
+ border: 1px solid $color-negative !important;
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,74 @@
1
+ @import "../../styles/layout";
2
+ @import "../../styles/colors";
3
+
4
+ .cweb-section {
5
+ .cweb-button {
6
+ &:last-of-type {
7
+ margin-right: 24px;
8
+ }
9
+ &:not(:last-of-type) {
10
+ margin-right: 8px;
11
+ }
12
+ &.add-button,
13
+ &.edit-button,
14
+ &.delete-button {
15
+ margin-left: auto;
16
+ width: 32px;
17
+ height: 32px;
18
+ }
19
+ &.add-button {
20
+ background: url("../../assets/add.svg") no-repeat center;
21
+ background-size: contain;
22
+ &:hover,
23
+ &:active,
24
+ &:focus {
25
+ background: url("../../assets/add_hover.svg") no-repeat center;
26
+ background-size: contain;
27
+ }
28
+ }
29
+
30
+ &.edit-button {
31
+ background: url("../../assets/edit.svg") no-repeat center;
32
+ background-size: contain;
33
+ &:hover,
34
+ &:active,
35
+ &:focus {
36
+ background: url("../../assets/edit_hover.svg") no-repeat center;
37
+ background-size: contain;
38
+ }
39
+ }
40
+
41
+ &.delete-button {
42
+ background: url("../../assets/delete.svg") no-repeat center;
43
+ background-size: contain;
44
+ &:hover,
45
+ &:active,
46
+ &:focus {
47
+ background: url("../../assets/delete_hover.svg") no-repeat center;
48
+ background-size: contain;
49
+ }
50
+ }
51
+ }
52
+
53
+ > .cweb-section-header {
54
+ @include flexbox-horizontal(center, space-between);
55
+ border-bottom: 1px solid $color-divider;
56
+ width: 100%;
57
+ padding: 18px 24px;
58
+ }
59
+
60
+ > .cweb-section-footer {
61
+ display: flex;
62
+ justify-content: space-between;
63
+ flex-direction: row;
64
+ align-items: center;
65
+ border-top: 1px solid #eeeeee;
66
+ width: 100%;
67
+ padding: 1rem 24px 1rem 24px;
68
+
69
+ img {
70
+ width: 32px;
71
+ height: 32px;
72
+ }
73
+ }
74
+ }