@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,52 +0,0 @@
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
- export default PreviewPhone;
@@ -1,26 +0,0 @@
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
- };
@@ -1,102 +0,0 @@
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
- /**
9
- * @deprecated: use RadioV2 instead
10
- */
11
- class Radio extends PureComponent {
12
- static propTypes = {
13
- className: PropTypes.string,
14
- text: PropTypes.string,
15
- isChecked: PropTypes.bool.isRequired,
16
- isDisabled: PropTypes.bool,
17
- name: PropTypes.string.isRequired,
18
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
19
- onChange: PropTypes.func,
20
- };
21
-
22
- constructor(props) {
23
- super(props);
24
-
25
- this.state = {
26
- isFocused: false,
27
- };
28
- }
29
-
30
- handleChange = (event) => {
31
- const { onChange } = this.props;
32
-
33
- if (onChange) {
34
- onChange(event);
35
- }
36
- };
37
-
38
- handleFocus = () => {
39
- this.setState({
40
- isFocused: true,
41
- });
42
- };
43
-
44
- handleBlur = () => {
45
- this.setState({
46
- isFocused: false,
47
- });
48
- };
49
-
50
- render() {
51
- const { className, isChecked, isDisabled, name, value, text } = this.props;
52
-
53
- const { isFocused } = this.state;
54
-
55
- const containerClassName = classNames("cweb-radio mr-4", className, {
56
- "is-focused": isFocused,
57
- "is-checked": isChecked,
58
- "opacity-50": isDisabled,
59
- });
60
-
61
- return (
62
- <div className={containerClassName} ref={this.containerRef}>
63
- <label className="cweb-radio-label">
64
- <input
65
- className="cweb-radio-input"
66
- name={name}
67
- type="radio"
68
- checked={isChecked}
69
- disabled={isDisabled}
70
- value={value}
71
- onBlur={this.handleBlur}
72
- onFocus={this.handleFocus}
73
- onChange={this.handleChange}
74
- />
75
-
76
- <span
77
- className={classNames("cweb-radio-icon-container", {
78
- "bg-primary": isChecked,
79
- "hover:bg-primary-dark": isChecked,
80
- "outline-primary": isFocused,
81
- "cursor-not-allowed": isDisabled,
82
- "cursor-pointer": !isDisabled,
83
- })}
84
- >
85
- <span className="cweb-radio-icon" />
86
- </span>
87
-
88
- {text && (
89
- <Text
90
- className={classNames("cweb-radio-label-text", {
91
- "cursor-not-allowed": isDisabled,
92
- })}
93
- text={text}
94
- />
95
- )}
96
- </label>
97
- </div>
98
- );
99
- }
100
- }
101
-
102
- export default Radio;
@@ -1,58 +0,0 @@
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
- }
@@ -1,15 +0,0 @@
1
- .radio-form-field-label input[type="radio"]:checked + .radio-circle {
2
- @apply bg-primary;
3
- }
4
-
5
- .radio-form-field-label[data-has-error="true"] .radio-circle {
6
- @apply border-red-700;
7
- @apply outline-negative;
8
- }
9
-
10
- .radio-form-field-label
11
- input[type="radio"]:checked
12
- + .radio-circle
13
- .radio-inner-circle {
14
- @apply bg-white;
15
- }
@@ -1,87 +0,0 @@
1
- import React from "react";
2
- import classNames from "classnames";
3
-
4
- import Text from "../Text/Text";
5
-
6
- import "./RadioV2.css";
7
-
8
- export interface RadioProps
9
- extends React.InputHTMLAttributes<HTMLInputElement> {
10
- name: string;
11
- // value field is used by react-hook-form as the value returned
12
- value: string | number;
13
- // text shown to the user to explain the option
14
- text?: string;
15
- // text shown to the user underneath the text for extra information
16
- info?: string;
17
- isError?: boolean;
18
- innerRef?: React.Ref<HTMLInputElement>;
19
- }
20
-
21
- function RadioInner({
22
- text,
23
- info,
24
- isError,
25
- innerRef,
26
- className,
27
- ...otherProps
28
- }: RadioProps): JSX.Element {
29
- const { value, disabled } = otherProps;
30
- const nameHtmlFor = `field-${value}`;
31
-
32
- return (
33
- <label
34
- className="radio-form-field-label leading-tight"
35
- htmlFor={nameHtmlFor}
36
- data-has-error={isError}
37
- data-test-id={nameHtmlFor}
38
- >
39
- <div className="flex flex-row items-center ">
40
- <input
41
- {...otherProps}
42
- className={classNames("appearance-none", className)}
43
- ref={innerRef}
44
- type="radio"
45
- id={nameHtmlFor}
46
- disabled={disabled}
47
- />
48
- <span
49
- className={classNames(
50
- "flex flex-col items-center justify-center w-4 h-4 transition-colors duration-300 ease-in-out border radio-circle rounded-xl border-slate-300"
51
- )}
52
- >
53
- <span className="block transition-colors duration-300 ease-in-out radio-inner-circle w-1.5 h-1.5 rounded-xl"></span>
54
- </span>
55
- {text && (
56
- <div className="ml-2">
57
- <Text
58
- inline={true}
59
- text={text}
60
- type="base"
61
- color={disabled ? "slate-500" : undefined}
62
- />
63
- </div>
64
- )}
65
- </div>
66
- {info && (
67
- <Text
68
- inline={true}
69
- className="ml-6"
70
- text={info}
71
- type="sm"
72
- color={disabled ? "slate-200" : "slate-500"}
73
- />
74
- )}
75
- </label>
76
- );
77
- }
78
-
79
- /**
80
- * TODO: The CSS styling is all messed up, including isError
81
- * Warning: don't use this prop before this is resolved
82
- * Issue to track: https://github.com/Luscii/web-ui/issues/57
83
- * TODO: remove this comment once this is resolved
84
- */
85
- export const RadioV2 = React.forwardRef<HTMLInputElement, RadioProps>(
86
- (props, ref) => <RadioInner {...props} innerRef={ref} />
87
- );
@@ -1,66 +0,0 @@
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
- /**
10
- * @deprecated: use RadioV2 instead
11
- */
12
- function RadioGroup({
13
- className,
14
- radioClassName,
15
- name,
16
- selectedOption,
17
- isVertical,
18
- radioOptions,
19
- onChange,
20
- error,
21
- isDisabled,
22
- ...otherOptions
23
- }) {
24
- const containerClassName = classNames("cweb-radio-group", { vertical: isVertical }, { hasError: error }, className);
25
-
26
- function handleChange(event) {
27
- if (!isDisabled && onChange) {
28
- onChange(event);
29
- }
30
- }
31
-
32
- return (
33
- <div className={containerClassName} {...otherOptions}>
34
- {radioOptions.map((option) => (
35
- <Radio
36
- {...option}
37
- key={option.value}
38
- className={radioClassName}
39
- name={name}
40
- isChecked={selectedOption === option.value}
41
- onChange={handleChange}
42
- isDisabled={isDisabled}
43
- />
44
- ))}
45
- </div>
46
- );
47
- }
48
-
49
- RadioGroup.propTypes = {
50
- className: PropTypes.string,
51
- radioClassName: PropTypes.string,
52
- name: PropTypes.string,
53
- selectedOption: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
54
- isVertical: PropTypes.bool,
55
- radioOptions: PropTypes.arrayOf(
56
- PropTypes.shape({
57
- text: PropTypes.string,
58
- info: PropTypes.string,
59
- isDisabled: PropTypes.bool,
60
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
61
- })
62
- ).isRequired,
63
- onChange: PropTypes.func,
64
- };
65
-
66
- export default RadioGroup;
@@ -1,37 +0,0 @@
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
- }
@@ -1,35 +0,0 @@
1
- import React from "react";
2
- import classNames from "classnames";
3
-
4
- import { RadioProps, RadioV2 } from "../Radio/RadioV2";
5
-
6
- export interface RadioGroupProps
7
- extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "value"> {
8
- name: string;
9
- isError?: boolean;
10
- options: Omit<RadioProps, "name">[];
11
- innerRef?: React.Ref<HTMLInputElement>;
12
- }
13
-
14
- function RadioGroupInner({
15
- innerRef,
16
- options,
17
- ...registerProps
18
- }: RadioGroupProps): JSX.Element {
19
- return (
20
- <div className={classNames("flex flex-col space-y-2")}>
21
- {options.map((option) => (
22
- <RadioV2
23
- key={option.value}
24
- {...option}
25
- {...registerProps}
26
- ref={innerRef}
27
- />
28
- ))}
29
- </div>
30
- );
31
- }
32
-
33
- export const RadioGroupV2 = React.forwardRef<HTMLInputElement, RadioGroupProps>(
34
- (props, ref) => <RadioGroupInner {...props} innerRef={ref} />
35
- );
@@ -1,74 +0,0 @@
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
- }
@@ -1,68 +0,0 @@
1
- import React from "react";
2
- import classNames from "classnames";
3
-
4
- import { ButtonProps } from "../Button/Button.types";
5
- import Button from "../Button/Button";
6
- import { Title } from "../Title/Title";
7
- import { LoadingIndicator, LoadingIndicatorProps } from "../LoadingIndicator/LoadingIndicator";
8
- import { RestPropped } from "../../types/general.types";
9
-
10
- import "./Section.scss";
11
-
12
- export interface SectionProps extends RestPropped {
13
- title?: string;
14
- buttons?: ButtonProps[];
15
- footer?: React.ReactNode;
16
- className?: string;
17
- isLoading?: boolean;
18
- loadingIndicatorProps?: LoadingIndicatorProps;
19
- children?: React.ReactNode;
20
- }
21
-
22
- export function Section({
23
- title,
24
- buttons,
25
- footer,
26
- children,
27
- className,
28
- isLoading = false,
29
- loadingIndicatorProps,
30
- ...restProps
31
- }: SectionProps): JSX.Element {
32
- return (
33
- <div
34
- {...restProps}
35
- className={classNames(
36
- "cweb-section",
37
- "flex justify-start flex-col items-start",
38
- "rounded-lg",
39
- "mx-0 my-4",
40
- "bg-white",
41
- "w-full",
42
- className
43
- )}
44
- >
45
- {(title || buttons) && (
46
- <div className="cweb-section-header" data-test-id="section-header">
47
- {title && (
48
- <div className="flex flex-row items-center">
49
- <Title text={title} className="mr-3 cweb-section-title" type="sm" />
50
- {isLoading && <LoadingIndicator asSpinner={true} {...loadingIndicatorProps} />}
51
- </div>
52
- )}
53
- <div className={classNames("cweb-section-header-buttons-container", "flex flex-row space-x-3")}>
54
- {buttons &&
55
- buttons.length > 0 &&
56
- buttons.map((button) => <Button {...button} key={button.key || button.id || button.text} />)}
57
- </div>
58
- </div>
59
- )}
60
-
61
- <div className="cweb-section-content w-full">{!isLoading && children}</div>
62
-
63
- {footer && <div className="cweb-section-footer">{footer}</div>}
64
- </div>
65
- );
66
- }
67
-
68
- export default Section;
@@ -1,20 +0,0 @@
1
- @import "../../styles/colors";
2
- @import "../../styles/layout";
3
-
4
- .cweb-list-item {
5
- @include flexbox-horizontal(center);
6
- padding: 16px 0 16px 0;
7
- border-bottom: 1px solid $color-divider;
8
-
9
- &:last-child {
10
- border-bottom: none;
11
- }
12
-
13
- &.cweb-list-item-clickable {
14
- cursor: pointer;
15
- }
16
-
17
- &.cweb-list-item-clickable:hover {
18
- background-color: $color-pale-grey;
19
- }
20
- }
@@ -1,26 +0,0 @@
1
- import React, { SyntheticEvent } from "react";
2
- import classNames from "classnames";
3
-
4
- import "./SectionItem.scss";
5
-
6
- export interface SectionItemProps {
7
- className?: string;
8
- onClick?: (event: SyntheticEvent) => void; // func
9
- children?: React.ReactNode;
10
- }
11
-
12
- export const SectionItem: React.FC<SectionItemProps> = props => {
13
- const { children, className, onClick, ...rest } = props;
14
-
15
- const classes = classNames("cweb-list-item", className, {
16
- "cweb-list-item-clickable": !!onClick,
17
- });
18
-
19
- return (
20
- <div className={classes} onClick={onClick} {...rest}>
21
- {children}
22
- </div>
23
- );
24
- };
25
-
26
- export default SectionItem;