@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,81 +0,0 @@
1
- import React, { useEffect, useState } from "react";
2
- import PropTypes from "prop-types";
3
- import classNames from "classnames";
4
-
5
- import "./Avatar.scss";
6
-
7
- function checkImageValidity(src) {
8
- return new Promise((resolve) => {
9
- const image = new Image();
10
- image.onload = () => {
11
- resolve(true);
12
- };
13
- image.onerror = () => {
14
- resolve(false);
15
- };
16
- image.src = src;
17
- });
18
- }
19
-
20
- const AVATAR_SIZE_OPTIONS = {
21
- LARGE: "large",
22
- MEDIUM: "medium",
23
- SMALL: "small",
24
- };
25
-
26
- export const Avatar = ({ size, src, defaultImage, initials, className }) => {
27
- const [hasValidImage, setHasValidImage] = useState(false);
28
-
29
- useEffect(() => {
30
- let mounted = true;
31
- if (!defaultImage && src) {
32
- checkImageValidity(src).then((res) => {
33
- if (mounted) {
34
- setHasValidImage(res);
35
- }
36
- });
37
- }
38
- return () => {
39
- mounted = false;
40
- };
41
- }, [defaultImage, src]);
42
-
43
- const containerClassName = classNames("cweb-avatar type-readonly", className, {
44
- "size-large": size === AVATAR_SIZE_OPTIONS.LARGE,
45
- "size-medium": size === AVATAR_SIZE_OPTIONS.MEDIUM,
46
- "size-small": size === AVATAR_SIZE_OPTIONS.SMALL,
47
- "display-image": hasValidImage,
48
- "display-initials": !hasValidImage,
49
- });
50
-
51
- const renderAvatar = () => {
52
- if (defaultImage) {
53
- return <img className="avatar-image" src={defaultImage} alt="User avatar image" />;
54
- } else if (hasValidImage) {
55
- return <img className="avatar-image" src={src} alt="User avatar image" />;
56
- } else {
57
- return <span className="avatar-initials-text">{initials}</span>;
58
- }
59
- };
60
-
61
- return (
62
- <div className={containerClassName}>
63
- <div className="avatar-content-container">{renderAvatar()}</div>
64
- </div>
65
- );
66
- };
67
-
68
- Avatar.propTypes = {
69
- src: PropTypes.string,
70
- initials: PropTypes.string.isRequired,
71
- size: PropTypes.oneOf([AVATAR_SIZE_OPTIONS.LARGE, AVATAR_SIZE_OPTIONS.MEDIUM, AVATAR_SIZE_OPTIONS.SMALL]),
72
- defaultImage: PropTypes.string,
73
- className: PropTypes.string,
74
- };
75
-
76
- Avatar.defaultProps = {
77
- size: AVATAR_SIZE_OPTIONS.MEDIUM,
78
- defaultImage: null,
79
- };
80
-
81
- export default Avatar;
@@ -1,153 +0,0 @@
1
- @import "../../styles/layout";
2
- @import "../../styles/colors";
3
- @import "../../styles/typography";
4
-
5
- .cweb-avatar {
6
- $readonly-color-text: #64748b; //slate-500
7
- $readonly-color-background: #f1f5f9; //slate-100
8
- $readonly-color-border: $color-border;
9
-
10
- $editable-color-text: $color-primary;
11
- $editable-color-background: $color-white;
12
- $editable-color-background-hover: rgba($editable-color-text, 0.1);
13
- $editable-color-border: $color-primary;
14
-
15
- $size-large: 128px;
16
- $size-medium: 64px;
17
- $size-small: 36px;
18
-
19
- $initials-size-large: 48px;
20
- $initials-size-medium: 24px;
21
- $initials-size-small: 14px;
22
-
23
- $border-width-large: 1px;
24
- $border-width-medium: $border-width-large / 2;
25
-
26
- @include flexbox-vertical(center);
27
- width: $size-medium;
28
- box-sizing: border-box;
29
-
30
- > .avatar-content-container {
31
- @include flexbox-horizontal(center, center);
32
- width: $size-medium;
33
- height: $size-medium;
34
- border-radius: 50%;
35
- box-sizing: border-box;
36
-
37
- > .avatar-image {
38
- width: 100%;
39
- height: 100%;
40
- border-radius: 50%;
41
- }
42
-
43
- > .avatar-initials-text {
44
- @include text($initials-size-medium, 1, $color-text-lighter, 300);
45
- pointer-events: none;
46
- }
47
- }
48
-
49
- &.size-large {
50
- width: $size-large;
51
-
52
- > .avatar-content-container {
53
- width: $size-large;
54
- height: $size-large;
55
-
56
- > .avatar-initials-text {
57
- font-size: $initials-size-large;
58
- }
59
- }
60
- }
61
-
62
- &.size-medium {
63
- width: $size-medium;
64
-
65
- > .avatar-content-container {
66
- width: $size-medium;
67
- height: $size-medium;
68
-
69
- > .avatar-initials-text {
70
- font-size: $initials-size-medium;
71
- }
72
- }
73
- }
74
-
75
- &.size-small {
76
- width: $size-small;
77
-
78
- > .avatar-content-container {
79
- width: $size-small;
80
- height: $size-small;
81
-
82
- > .avatar-initials-text {
83
- font-size: $initials-size-small;
84
- }
85
- }
86
- }
87
-
88
- &.type-editable {
89
- cursor: pointer;
90
-
91
- > .avatar-content-container {
92
- position: relative;
93
- border-color: $editable-color-border;
94
- background-color: $editable-color-background;
95
-
96
- &:after {
97
- content: "";
98
- position: absolute;
99
- top: 0;
100
- left: 0;
101
- right: 0;
102
- bottom: 0;
103
- z-index: 1;
104
- border-radius: 50%;
105
- transition: 0.4s ease background-color;
106
- }
107
-
108
- &:hover:after {
109
- background-color: $editable-color-background-hover;
110
- }
111
-
112
- > .avatar-initials-text {
113
- color: $editable-color-text;
114
- }
115
- }
116
- }
117
-
118
- &.type-readonly {
119
- > .avatar-content-container {
120
- border-color: $readonly-color-border;
121
- background-color: $readonly-color-background;
122
-
123
- > .avatar-initials-text {
124
- color: $readonly-color-text;
125
- }
126
- }
127
- }
128
-
129
- @media (max-width: $max-small-screen-width) {
130
- $size-large-mobile: $size-large / 2;
131
- $initials-size-large-mobile: $initials-size-large / 2;
132
- $border-width-large-mobile: $border-width-large / 2;
133
-
134
- &.size-large {
135
- width: $size-large-mobile;
136
-
137
- > .avatar-content-container {
138
- width: $size-large-mobile;
139
- height: $size-large-mobile;
140
-
141
- > .avatar-initials-text {
142
- font-size: $initials-size-large-mobile;
143
- }
144
- }
145
-
146
- &.display-initials {
147
- > .avatar-content-container {
148
- border-width: $border-width-large-mobile;
149
- }
150
- }
151
- }
152
- }
153
- }
@@ -1,23 +0,0 @@
1
- import React from "react";
2
- import classNames from "classnames";
3
-
4
- interface BadgeProps {
5
- badgeCount: number;
6
- className?: string;
7
- }
8
-
9
- const Badge = (props: BadgeProps): JSX.Element => {
10
- const containerClasses = classNames(
11
- ["inline-flex", "items-center", "justify-center", "rounded-full", "h-6", "min-w-24", "px-2", "bg-color-negative"],
12
- props.className
13
- );
14
- const textClasses = classNames(["text-xs", "text-white", "leading-none"]);
15
-
16
- return (
17
- <div className={containerClasses}>
18
- <span className={textClasses}>{props.badgeCount}</span>
19
- </div>
20
- );
21
- };
22
-
23
- export default Badge;
@@ -1,46 +0,0 @@
1
- import { Link } from "@reach/router";
2
- import React from "react";
3
-
4
- import Text from "../Text/Text";
5
-
6
- export interface Crumb {
7
- name: string;
8
- link?: string;
9
- }
10
-
11
- export interface BreadcrumbProps {
12
- crumbs: Crumb[];
13
- }
14
-
15
- export const Breadcrumbs: React.VoidFunctionComponent<BreadcrumbProps> = ({
16
- crumbs,
17
- }) => {
18
- const breadcrumbItems = crumbs.map(({ name, link }) => {
19
- return (
20
- <li
21
- key={name}
22
- className="flex flex-row items-center slash-split "
23
- >
24
- {link ? (
25
- <Link to={link}>
26
- <Text
27
- text={name}
28
- color="blue-800"
29
- />
30
- </Link>
31
- ) : (
32
- <Text text={name} />
33
- )}
34
- </li>
35
- );
36
- });
37
-
38
- return (
39
- <ul
40
- data-test-id="breadcrumbs"
41
- className="flex flex-row items-center space-x-2 "
42
- >
43
- {breadcrumbItems}
44
- </ul>
45
- );
46
- };
@@ -1,46 +0,0 @@
1
- ```js
2
- <div className="items-center mb-10 space-y-5">
3
- <div className="flex flex-row space-x-4">
4
- <Button text="Primary" onClick={() => console.log("primary")} />
5
- <Button text="Primary" isPending onClick={() => console.log("primary")} />
6
- <Button text="Primary" isDisabled onClick={() => console.log("primary")} />
7
- </div>
8
-
9
- <div className="flex flex-row space-x-4">
10
- <Button text="Secondary" role="secondary" onClick={() => console.log("primary")} />
11
- <Button text="Secondary" isPending role="secondary" onClick={() => console.log("primary")} />
12
- <Button text="Secondary" isDisabled role="secondary" onClick={() => console.log("primary")} />
13
- </div>
14
-
15
- <div className="flex flex-row space-x-4">
16
- <Button text="Tertiary" role="tertiary" onClick={() => console.log("tertiary")} />
17
- <Button text="Tertiary" isPending role="tertiary" onClick={() => console.log("tertiary")} />
18
- <Button text="Tertiary" isDisabled role="tertiary" onClick={() => console.log("tertiary")} />
19
- </div>
20
-
21
- <div className="flex flex-row space-x-4">
22
- <Button text="Destructive" role="negative" onClick={() => console.log("negative")} />
23
- <Button text="Destructive" isPending role="negative" onClick={() => console.log("negative")} />
24
- <Button text="Destructive" isDisabled role="negative" onClick={() => console.log("negative")} />
25
- </div>
26
-
27
- <div className="flex flex-row space-x-4">
28
- <Button text="Icon button" className="add-button" onClick={() => console.log("negative")} />
29
- <Button text="Icon button" className="edit-button" onClick={() => console.log("negative")} />
30
- <Button text="Icon button" className="delete-button" onClick={() => console.log("negative")} />
31
- </div>
32
-
33
- <div className="flex flex-row space-x-4">
34
- <Button className="add-button" onClick={() => console.log("negative")} />
35
- <Button role={BUTTON_ROLES.SECONDARY} className="add-button" onClick={() => console.log("negative")} />
36
- <Button className="edit-button" onClick={() => console.log("negative")} />
37
- <Button role={BUTTON_ROLES.SECONDARY} className="edit-button" onClick={() => console.log("negative")} />
38
- <Button
39
- role={BUTTON_ROLES.NEGATIVE}
40
- className="delete-button"
41
- onClick={() => console.log("negative")}
42
- link={generateLocationWithPath("healthcare/pages/groups/add")}
43
- />
44
- </div>
45
- </div>
46
- ```
@@ -1,200 +0,0 @@
1
- import React, { useEffect, useState } from "react";
2
- import classNames from "classnames";
3
- import { navigate } from "@reach/router";
4
-
5
- import { Spinner } from "../Spinner/Spinner";
6
- import { AddIcon } from "../Icons/AddIcon";
7
- import { DeleteIcon } from "../Icons/DeleteIcon";
8
- import { EditIcon } from "../Icons/EditIcon";
9
- import { LeftArrowIcon } from "../Icons/LeftArrowIcon";
10
- import { RightArrowIcon } from "../Icons/RightArrowIcon";
11
- import { ChartIcon } from "../Icons/ChartIcon";
12
- import { PrintIcon } from "../Icons/PrintIcon";
13
-
14
- import { ButtonIcon } from "./ButtonIcon";
15
- import { BUTTON_ROLES, ButtonProps } from "./Button.types";
16
-
17
- // TODO: use the Types from Button.types.ts instead of PropTypes
18
- function Button(props: ButtonProps): JSX.Element {
19
- const {
20
- text = "",
21
- role: propsRole = BUTTON_ROLES.PRIMARY,
22
- type = "button",
23
- title = "",
24
- link = "",
25
- isPending = false,
26
- isDisabled = false,
27
- onClick,
28
- className = "",
29
- iconName = "",
30
- hasIcon: hasIconProps = false,
31
- dynamicIcon,
32
- ...otherAttributes
33
- } = props;
34
-
35
- const hasAddIcon = className.includes("add-button");
36
- const hasEditIcon = className.includes("edit-button");
37
- const hasDeleteIcon = className.includes("delete-button");
38
- const hasPrevIcon = className.includes("prev-button");
39
- const hasNextIcon = className.includes("next-button");
40
- const hasChartIcon = className.includes("chart-button");
41
- const hasPrintIcon = className.includes("print-button");
42
- const hasIcon =
43
- hasIconProps ||
44
- iconName ||
45
- hasAddIcon ||
46
- hasEditIcon ||
47
- hasDeleteIcon ||
48
- hasPrevIcon ||
49
- hasNextIcon ||
50
- hasChartIcon ||
51
- hasPrintIcon ||
52
- dynamicIcon;
53
-
54
- const isIconOnly = hasIcon && !text;
55
-
56
- const [role, setRole] = useState(propsRole);
57
-
58
- // Fix to support the all the buttons in the application
59
- // Ideally we want to make a better implementation of them overall, but that's beyond the
60
- // scope of this task.
61
-
62
- useEffect(() => {
63
- if ((hasAddIcon || hasEditIcon) && !text) {
64
- setRole(BUTTON_ROLES.SECONDARY);
65
- } else if (propsRole === BUTTON_ROLES.TEXT || propsRole === BUTTON_ROLES.LINK) {
66
- setRole(BUTTON_ROLES.TERTIARY);
67
- } else if (hasDeleteIcon) {
68
- setRole(BUTTON_ROLES.NEGATIVE);
69
- }
70
- }, []);
71
-
72
- const isButtonDisabled = (role !== BUTTON_ROLES.LINK && isDisabled) || isPending;
73
- const isNonPrimaryNonNegative =
74
- role === BUTTON_ROLES.SECONDARY || role === BUTTON_ROLES.TERTIARY || role === BUTTON_ROLES.QUATERNARY;
75
-
76
- function handleClick(event: any) {
77
- if (link) {
78
- navigate(link);
79
- return;
80
- }
81
-
82
- if (isButtonDisabled || !onClick) {
83
- // without this, form will be submitted, if button has type submit.
84
- event.preventDefault();
85
- return;
86
- }
87
-
88
- onClick(event);
89
- }
90
-
91
- const buttonRolesStyling = {
92
- primary: [
93
- "bg-primary",
94
- "hover:bg-primary-dark",
95
- "text-white",
96
- "focus:outline-primary",
97
- "border",
98
- "border-solid",
99
- "border-primary-transparent",
100
- ],
101
- secondary: ["bg-slate-200"],
102
- secondaryDark: ["bg-slate-700", "hover:bg-slate-600"],
103
- tertiary: ["bg-transparent", "shadow-none", "hover:bg-slate-100"],
104
- quaternary: ["bg-white", "shadow-none", "border", "border-solid", "border-quaternary", "hover:border-slate-200"],
105
- negative: [
106
- "bg-negative",
107
- "text-negative-dark",
108
- "hover:text-negative-darker",
109
- "hover:border-negative-border",
110
- "focus:outline-negative",
111
- "border",
112
- "border-transparent",
113
- ],
114
- link: [],
115
- text: [],
116
- icon: [],
117
- };
118
-
119
- const containerClassName = classNames(
120
- // default button classes
121
- [
122
- "h-11",
123
- "focus:outline-none",
124
- "relative flex flex-row justify-center items-center",
125
- "shadow-sm",
126
- "transition-outline transition-colors duration-300 ease-in-out",
127
- "cursor-pointer",
128
- "rounded-full",
129
- "leading-none",
130
- ],
131
- // ensuring the buttons are 44px high including content
132
- {
133
- "py-2 px-2 w-11": isIconOnly,
134
- "px-4 py-3": !isIconOnly,
135
- },
136
- className,
137
- {
138
- "opacity-50 pointer-events-none": isButtonDisabled,
139
- "hover:text-primary-dark text-primary": isNonPrimaryNonNegative,
140
- "border border-transparent": isNonPrimaryNonNegative,
141
- "hover:border-slate-200 focus:outline-primary": isNonPrimaryNonNegative,
142
- "text-secondary-dark opacity-75": isButtonDisabled && isNonPrimaryNonNegative,
143
- },
144
- buttonRolesStyling[role]
145
- );
146
-
147
- const spinnerClassNames = classNames({
148
- hidden: !isPending,
149
- "text-white": role === BUTTON_ROLES.PRIMARY,
150
- "text-dark-gray": isNonPrimaryNonNegative,
151
- "text-negative-dark": role === BUTTON_ROLES.TERTIARY,
152
- });
153
-
154
- const buttonTextClasses = classNames(["text-sm", "font-medium"], {
155
- invisible: isPending,
156
- hidden: !text,
157
- "ml-3": hasIcon,
158
- });
159
-
160
- return (
161
- <button
162
- {...otherAttributes}
163
- aria-disabled={isButtonDisabled}
164
- disabled={isButtonDisabled}
165
- className={containerClassName}
166
- onClick={handleClick}
167
- type={type}
168
- title={title}
169
- data-role={role}
170
- >
171
- {hasAddIcon && <AddIcon className="w-5 h-5" />}
172
- {hasEditIcon && <EditIcon className="w-5 h-5" />}
173
- {hasDeleteIcon && <DeleteIcon className="w-5 h-5" />}
174
- {hasPrevIcon && <LeftArrowIcon className="w-5 h-5" />}
175
- {hasNextIcon && <RightArrowIcon className="w-5 h-5" />}
176
- {hasChartIcon && <ChartIcon className="w-5 h-5" />}
177
- {hasPrintIcon && <PrintIcon className="w-5 h-5" />}
178
- {iconName && <ButtonIcon name={iconName} />}
179
- {dynamicIcon && React.createElement(dynamicIcon, { className: "w-5 h-5" })}
180
-
181
- <span
182
- className="opacity-100"
183
- // IE11 center translate fix
184
- style={{
185
- position: "absolute",
186
- left: "50%",
187
- top: "50%",
188
- transform: "translate(-50%, -50%)",
189
- }}
190
- >
191
- <Spinner className={spinnerClassNames} />
192
- </span>
193
- <span className={buttonTextClasses}>{text}</span>
194
- </button>
195
- );
196
- }
197
-
198
- export default Button;
199
-
200
- export { BUTTON_ROLES };
@@ -1,41 +0,0 @@
1
- // These types were added because they are used in ViewItem that is completely refactored to TS
2
- // Ideally they should also be used in the Button TS component, but this was outside of the scope of this task
3
- import React from "react";
4
-
5
- import { RestPropped } from "../../types/general.types";
6
- import { IconProps } from "../Icons/types/IconProps.type";
7
-
8
- export const BUTTON_ROLES = {
9
- PRIMARY: "primary",
10
- SECONDARY: "secondary",
11
- SECONDARY_DARK: "secondaryDark",
12
- TERTIARY: "tertiary",
13
- QUATERNARY: "quaternary",
14
- NEGATIVE: "negative",
15
- TEXT: "text",
16
- LINK: "link",
17
- ICON: "icon",
18
- } as const;
19
-
20
- type BUTTON_KEYS = keyof typeof BUTTON_ROLES;
21
- export type BUTTON_TYPE = typeof BUTTON_ROLES[BUTTON_KEYS];
22
-
23
- export type ButtonType = "button" | "submit";
24
-
25
- export interface ButtonProps extends RestPropped {
26
- text?: string;
27
- role?: BUTTON_TYPE;
28
- type?: ButtonType;
29
- title?: string;
30
- link?: string;
31
- isPending?: boolean;
32
- isDisabled?: boolean;
33
- // TODO: add specific type of ButtonEvent
34
- onClick?: (arg: any) => void;
35
- className?: string;
36
- // name mapping to the right svg in ButtonIcon
37
- iconName?: string;
38
- // legacy - can be removed?
39
- hasIcon?: boolean;
40
- dynamicIcon?: React.FunctionComponent<IconProps>;
41
- }
@@ -1,42 +0,0 @@
1
- import * as React from "react";
2
-
3
- import CloseIcon from "../../assets/close.svg";
4
- import HamburgerIcon from "../../assets/hamburger.svg";
5
- import ChevronRightBlueIcon from "../../assets/right-arrow-blue.svg";
6
- import ChevronRightGreyIcon from "../../assets/right-arrow-grey.svg";
7
- import ChevronLeftBlueIcon from "../../assets/left-arrow-blue.svg";
8
- import ChevronLeftGreyIcon from "../../assets/left-arrow-grey.svg";
9
- import SearchIcon from "../../assets/search.svg";
10
- import SearchCancelIcon from "../../assets/search-cancel.svg";
11
- import StarIcon from "../../assets/starIcon.svg";
12
- import CheckIcon from "../../assets/check-icon-primary.svg";
13
-
14
- interface ButtonIconProps {
15
- name: string;
16
- className?: string;
17
- }
18
-
19
- type IconNames = {
20
- [key: string]: string;
21
- };
22
-
23
- const iconSrc: IconNames = {
24
- // These need to be converted to svg files instead of components and added in
25
- // "add": AddIcon,
26
- // "delete": DeleteIcon,
27
- // "edit": EditIcon,
28
- close: CloseIcon,
29
- hamburger: HamburgerIcon,
30
- "chevron-right-blue": ChevronRightBlueIcon,
31
- "chevron-left-blue": ChevronLeftBlueIcon,
32
- "chevron-right-grey": ChevronRightGreyIcon,
33
- "chevron-left-grey": ChevronLeftGreyIcon,
34
- search: SearchIcon,
35
- star: StarIcon,
36
- check: CheckIcon,
37
- "search-cancel": SearchCancelIcon,
38
- };
39
-
40
- export const ButtonIcon = (props: ButtonIconProps): JSX.Element => {
41
- return <img src={iconSrc[props.name]} className={props.className} />;
42
- };
@@ -1,44 +0,0 @@
1
- import React from "react";
2
-
3
- import { IconProps } from "../Icons/types/IconProps.type";
4
- import { TextColor, TextHoverColor } from "../Text/Text";
5
-
6
- /**
7
- * Properties that are present in all variants of the button
8
- *
9
- */
10
- export interface BaseButtonProps
11
- extends React.HTMLAttributes<HTMLButtonElement> {
12
- onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
13
- text?: string;
14
- icon?: React.FunctionComponent<IconProps>;
15
- isDisabled?: boolean;
16
- className?: string;
17
- }
18
-
19
- /**
20
- * Extra properties that can be set when the variant of the button
21
- * supports the pending state
22
- *
23
- */
24
- export interface ButtonWithPendingStateProps extends BaseButtonProps {
25
- isPending?: boolean;
26
- }
27
-
28
- /**
29
- * All properties of BaseButtonProps and ButtonWithPendingStateProps,
30
- * plus other properties that are assigned internally by the button variants.
31
- *
32
- */
33
- export interface ButtonProps extends BaseButtonProps, ButtonWithPendingStateProps {
34
- textColor?: TextColor;
35
- textHoverColor?: TextHoverColor;
36
- }
37
-
38
- /**
39
- * Interface for defining a button
40
- */
41
- export interface ButtonDefinition<Props extends BaseButtonProps = BaseButtonProps> {
42
- buttonType: React.FunctionComponent<Props>;
43
- buttonProps: React.Attributes & Props;
44
- }