@luscii-healthtech/web-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/README.md +181 -0
  2. package/dist/components/Acknowledgement/Acknowledgement.d.ts +22 -0
  3. package/dist/components/Avatar/Avatar.d.ts +29 -0
  4. package/dist/components/Badge/Badge.d.ts +7 -0
  5. package/dist/components/Button/Button.d.ts +5 -0
  6. package/dist/components/Button/Button.types.d.ts +32 -0
  7. package/dist/components/Button/ButtonIcon.d.ts +7 -0
  8. package/dist/components/ButtonV2/ButtonV2.d.ts +13 -0
  9. package/dist/components/ButtonV2/PrimaryButton.d.ts +12 -0
  10. package/dist/components/ButtonV2/SecondaryButton.d.ts +8 -0
  11. package/dist/components/ButtonV2/TertiaryButton.d.ts +8 -0
  12. package/dist/components/Carousel/Carousel.d.ts +8 -0
  13. package/dist/components/Carousel/GliderContainer.d.ts +7 -0
  14. package/dist/components/CenteredHero/CenteredHero.d.ts +22 -0
  15. package/dist/components/Checkbox/Checkbox.d.ts +17 -0
  16. package/dist/components/ConfirmationDialog/ConfirmationDialog.d.ts +33 -0
  17. package/dist/components/Datepicker/Datepicker.d.ts +24 -0
  18. package/dist/components/Dropdown/Dropdown.d.ts +47 -0
  19. package/dist/components/EmptyListMessage/EmptyListMessage.d.ts +14 -0
  20. package/dist/components/ErrorBlock/ErrorBlock.d.ts +13 -0
  21. package/dist/components/Icons/AddIcon.d.ts +3 -0
  22. package/dist/components/Icons/AlertsIcon.d.ts +6 -0
  23. package/dist/components/Icons/BellIcon.d.ts +6 -0
  24. package/dist/components/Icons/ChartIcon.d.ts +3 -0
  25. package/dist/components/Icons/ChatBox.d.ts +5 -0
  26. package/dist/components/Icons/CheckIcon.d.ts +2 -0
  27. package/dist/components/Icons/ChevronIcon.d.ts +8 -0
  28. package/dist/components/Icons/CrossIcon.d.ts +7 -0
  29. package/dist/components/Icons/DeleteIcon.d.ts +6 -0
  30. package/dist/components/Icons/DownArrowIcon.d.ts +6 -0
  31. package/dist/components/Icons/DragIcon.d.ts +3 -0
  32. package/dist/components/Icons/EditIcon.d.ts +6 -0
  33. package/dist/components/Icons/EmptyStateDashboardIcon.d.ts +2 -0
  34. package/dist/components/Icons/ExclamationMarkIcon.d.ts +6 -0
  35. package/dist/components/Icons/EyeIcon.d.ts +3 -0
  36. package/dist/components/Icons/GearIcon.d.ts +3 -0
  37. package/dist/components/Icons/GroupIcon.d.ts +3 -0
  38. package/dist/components/Icons/HeartIcon.d.ts +6 -0
  39. package/dist/components/Icons/LeftArrowIcon.d.ts +6 -0
  40. package/dist/components/Icons/LightBulbIcon.d.ts +6 -0
  41. package/dist/components/Icons/LockIcon.d.ts +6 -0
  42. package/dist/components/Icons/MessagesIcon.d.ts +6 -0
  43. package/dist/components/Icons/NotesIcon.d.ts +6 -0
  44. package/dist/components/Icons/PinIcon.d.ts +6 -0
  45. package/dist/components/Icons/PrintIcon.d.ts +3 -0
  46. package/dist/components/Icons/RightArrowIcon.d.ts +6 -0
  47. package/dist/components/Icons/SmallCircleIcon.d.ts +6 -0
  48. package/dist/components/Icons/SmallDiamondIcon.d.ts +6 -0
  49. package/dist/components/Icons/SmallSquareIcon.d.ts +6 -0
  50. package/dist/components/Icons/SpaceRocketIcon.d.ts +6 -0
  51. package/dist/components/Icons/types/IconProps.type.d.ts +3 -0
  52. package/dist/components/InfoBlock/InfoBlock.d.ts +14 -0
  53. package/dist/components/InfoField/InfoField.d.ts +18 -0
  54. package/dist/components/Input/Input.d.ts +44 -0
  55. package/dist/components/Line/Line.d.ts +14 -0
  56. package/dist/components/ListItem/ListItem.d.ts +9 -0
  57. package/dist/components/ListTable/ListTable.d.ts +35 -0
  58. package/dist/components/ListTable/ListTableCell.d.ts +10 -0
  59. package/dist/components/ListTable/ListTableHeader.d.ts +7 -0
  60. package/dist/components/ListTable/ListTableRow.d.ts +9 -0
  61. package/dist/components/LoadingIndicator/LoadingIndicator.d.ts +11 -0
  62. package/dist/components/Menu/Menu.d.ts +14 -0
  63. package/dist/components/Modal/Modal.d.ts +31 -0
  64. package/dist/components/Modal/ModalWithButtons.d.ts +9 -0
  65. package/dist/components/MultiSelect/MultiSelect.d.ts +25 -0
  66. package/dist/components/MultiSelect/MultiSelectUtils.d.ts +1 -0
  67. package/dist/components/NavMenu/NavLayout.d.ts +20 -0
  68. package/dist/components/NavMenu/NavMenu.d.ts +1 -0
  69. package/dist/components/NavMenu/NavMenuContent.d.ts +7 -0
  70. package/dist/components/NavMenu/NavMenuItem.d.ts +15 -0
  71. package/dist/components/NotificationBanner/NotificationBanner.d.ts +22 -0
  72. package/dist/components/Page/CRUDPage.d.ts +43 -0
  73. package/dist/components/Page/Page.d.ts +58 -0
  74. package/dist/components/PaginationMenu/PaginationMenu.d.ts +20 -0
  75. package/dist/components/PaginationMenu/PaginationMenuLarge.d.ts +13 -0
  76. package/dist/components/PaginationMenu/PaginationMenuSmall.d.ts +8 -0
  77. package/dist/components/PreviewPhone/PreviewPhone.d.ts +7 -0
  78. package/dist/components/PreviewPhone/useWindowDimensions.d.ts +4 -0
  79. package/dist/components/Radio/Radio.d.ts +18 -0
  80. package/dist/components/RadioGroup/RadioGroup.d.ts +31 -0
  81. package/dist/components/Section/Section.d.ts +15 -0
  82. package/dist/components/Select/LegacySelect.d.ts +32 -0
  83. package/dist/components/Select/Select.d.ts +6 -0
  84. package/dist/components/Select/options.transformer.d.ts +14 -0
  85. package/dist/components/Select/select.utils.d.ts +7 -0
  86. package/dist/components/SettingsMenuButton/SettingsMenuButton.d.ts +16 -0
  87. package/dist/components/Spinner/Spinner.d.ts +6 -0
  88. package/dist/components/Steps/Step.d.ts +10 -0
  89. package/dist/components/Steps/Steps.d.ts +11 -0
  90. package/dist/components/Switcher/Switcher.d.ts +26 -0
  91. package/dist/components/Switcher/SwitcherItem.d.ts +24 -0
  92. package/dist/components/TabLinks/TabLinks.d.ts +14 -0
  93. package/dist/components/Tabbar/Tabbar.d.ts +10 -0
  94. package/dist/components/Tabbar/TabbarItem.d.ts +15 -0
  95. package/dist/components/Tag/Tag.d.ts +17 -0
  96. package/dist/components/Tag/TagGroup.d.ts +13 -0
  97. package/dist/components/Text/LegacyText.d.ts +37 -0
  98. package/dist/components/Text/Text.d.ts +27 -0
  99. package/dist/components/TextEditor/TextEditor.d.ts +14 -0
  100. package/dist/components/TextEditorV2/TextEditorV2.d.ts +6 -0
  101. package/dist/components/TextLink/TextLink.d.ts +11 -0
  102. package/dist/components/TextListItem/TextListItem.d.ts +12 -0
  103. package/dist/components/Textarea/Textarea.d.ts +22 -0
  104. package/dist/components/Title/LegacyTitle.d.ts +22 -0
  105. package/dist/components/Title/Title.d.ts +14 -0
  106. package/dist/components/ViewItem/ViewItem.d.ts +16 -0
  107. package/dist/index.d.ts +8 -0
  108. package/dist/index.js +8 -0
  109. package/dist/types/general.types.d.ts +7 -0
  110. package/dist/utils/useOutsideClick.d.ts +2 -0
  111. package/dist/web-ui.cjs.development.js +23 -0
  112. package/dist/web-ui.cjs.development.js.map +1 -0
  113. package/dist/web-ui.cjs.production.min.js +2 -0
  114. package/dist/web-ui.cjs.production.min.js.map +1 -0
  115. package/dist/web-ui.esm.js +17 -0
  116. package/dist/web-ui.esm.js.map +1 -0
  117. package/package.json +122 -0
  118. package/src/assets/add.svg +5 -0
  119. package/src/assets/add_hover.svg +4 -0
  120. package/src/assets/big-menu-icon-hover.svg +6 -0
  121. package/src/assets/big-menu-icon.svg +6 -0
  122. package/src/assets/check-cross-icon.svg +7 -0
  123. package/src/assets/check-icon-primary.svg +5 -0
  124. package/src/assets/check-icon.svg +3 -0
  125. package/src/assets/chevron-double.svg +3 -0
  126. package/src/assets/close.svg +3 -0
  127. package/src/assets/color-variant-cross.svg +3 -0
  128. package/src/assets/cross-dark.svg +3 -0
  129. package/src/assets/delete.svg +4 -0
  130. package/src/assets/delete_hover.svg +4 -0
  131. package/src/assets/edit.svg +6 -0
  132. package/src/assets/edit_hover.svg +6 -0
  133. package/src/assets/error-icon.svg +7 -0
  134. package/src/assets/grid-view-icon-active.svg +6 -0
  135. package/src/assets/grid-view-icon.svg +6 -0
  136. package/src/assets/groups.svg +3 -0
  137. package/src/assets/hamburger.svg +5 -0
  138. package/src/assets/happy-star.svg +9 -0
  139. package/src/assets/hcps.svg +3 -0
  140. package/src/assets/info-icon.svg +6 -0
  141. package/src/assets/left-arrow-blue.svg +3 -0
  142. package/src/assets/left-arrow-grey.svg +3 -0
  143. package/src/assets/list-view-icon-active.svg +3 -0
  144. package/src/assets/list-view-icon.svg +3 -0
  145. package/src/assets/loading.svg +16 -0
  146. package/src/assets/modal-close-icon-active.svg +9 -0
  147. package/src/assets/modal-close-icon.svg +9 -0
  148. package/src/assets/no-open-alerts.svg +19 -0
  149. package/src/assets/patients.svg +3 -0
  150. package/src/assets/phone-mockup.svg +9 -0
  151. package/src/assets/programs.svg +3 -0
  152. package/src/assets/right-arrow-blue.svg +3 -0
  153. package/src/assets/right-arrow-grey.svg +3 -0
  154. package/src/assets/search-cancel.svg +3 -0
  155. package/src/assets/search-not-found.svg +70 -0
  156. package/src/assets/search.svg +3 -0
  157. package/src/assets/spinner-gray.svg +6 -0
  158. package/src/assets/spinner.svg +6 -0
  159. package/src/assets/starIcon.svg +3 -0
  160. package/src/assets/success-icon.svg +7 -0
  161. package/src/components/Acknowledgement/Acknowledgement.js +61 -0
  162. package/src/components/Acknowledgement/Acknowledgement.scss +49 -0
  163. package/src/components/Avatar/Avatar.js +81 -0
  164. package/src/components/Avatar/Avatar.scss +153 -0
  165. package/src/components/Badge/Badge.tsx +23 -0
  166. package/src/components/Button/Button.examples.md +46 -0
  167. package/src/components/Button/Button.tsx +200 -0
  168. package/src/components/Button/Button.types.ts +41 -0
  169. package/src/components/Button/ButtonIcon.tsx +42 -0
  170. package/src/components/ButtonV2/ButtonV2.tsx +91 -0
  171. package/src/components/ButtonV2/PrimaryButton.tsx +43 -0
  172. package/src/components/ButtonV2/SecondaryButton.tsx +31 -0
  173. package/src/components/ButtonV2/TertiaryButton.tsx +31 -0
  174. package/src/components/Carousel/Carousel.tsx +52 -0
  175. package/src/components/Carousel/GliderContainer.scss +13 -0
  176. package/src/components/Carousel/GliderContainer.tsx +22 -0
  177. package/src/components/CenteredHero/CenteredHero.js +50 -0
  178. package/src/components/Checkbox/Checkbox.scss +115 -0
  179. package/src/components/Checkbox/Checkbox.tsx +114 -0
  180. package/src/components/ConfirmationDialog/ConfirmationDialog.scss +15 -0
  181. package/src/components/ConfirmationDialog/ConfirmationDialog.tsx +84 -0
  182. package/src/components/Datepicker/Datepicker.js +96 -0
  183. package/src/components/Datepicker/Datepicker.scss +331 -0
  184. package/src/components/Dropdown/Dropdown.js +364 -0
  185. package/src/components/Dropdown/Dropdown.scss +83 -0
  186. package/src/components/EmptyListMessage/EmptyListMessage.tsx +34 -0
  187. package/src/components/ErrorBlock/ErrorBlock.js +24 -0
  188. package/src/components/ErrorBlock/ErrorBlock.scss +20 -0
  189. package/src/components/Icons/AddIcon.tsx +27 -0
  190. package/src/components/Icons/AlertsIcon.tsx +26 -0
  191. package/src/components/Icons/BellIcon.tsx +26 -0
  192. package/src/components/Icons/ChartIcon.tsx +20 -0
  193. package/src/components/Icons/ChatBox.tsx +23 -0
  194. package/src/components/Icons/CheckIcon.tsx +23 -0
  195. package/src/components/Icons/ChevronIcon.tsx +30 -0
  196. package/src/components/Icons/CrossIcon.tsx +26 -0
  197. package/src/components/Icons/DeleteIcon.tsx +23 -0
  198. package/src/components/Icons/DownArrowIcon.tsx +17 -0
  199. package/src/components/Icons/DragIcon.tsx +23 -0
  200. package/src/components/Icons/EditIcon.tsx +23 -0
  201. package/src/components/Icons/EmptyStateDashboardIcon.tsx +130 -0
  202. package/src/components/Icons/ExclamationMarkIcon.tsx +23 -0
  203. package/src/components/Icons/EyeIcon.tsx +21 -0
  204. package/src/components/Icons/GearIcon.tsx +21 -0
  205. package/src/components/Icons/GroupIcon.tsx +21 -0
  206. package/src/components/Icons/HeartIcon.tsx +23 -0
  207. package/src/components/Icons/LeftArrowIcon.tsx +23 -0
  208. package/src/components/Icons/LightBulbIcon.tsx +28 -0
  209. package/src/components/Icons/LockIcon.tsx +23 -0
  210. package/src/components/Icons/MessagesIcon.tsx +23 -0
  211. package/src/components/Icons/NotesIcon.tsx +23 -0
  212. package/src/components/Icons/PinIcon.tsx +23 -0
  213. package/src/components/Icons/PrintIcon.tsx +15 -0
  214. package/src/components/Icons/RightArrowIcon.tsx +23 -0
  215. package/src/components/Icons/SmallCircleIcon.tsx +21 -0
  216. package/src/components/Icons/SmallDiamondIcon.tsx +31 -0
  217. package/src/components/Icons/SmallSquareIcon.tsx +21 -0
  218. package/src/components/Icons/SpaceRocketIcon.tsx +23 -0
  219. package/src/components/Icons/types/IconProps.type.ts +3 -0
  220. package/src/components/InfoBlock/InfoBlock.js +24 -0
  221. package/src/components/InfoBlock/InfoBlock.scss +20 -0
  222. package/src/components/InfoField/InfoField.tsx +86 -0
  223. package/src/components/Input/Input.examples.md +94 -0
  224. package/src/components/Input/Input.js +141 -0
  225. package/src/components/Line/Line.js +38 -0
  226. package/src/components/ListItem/ListItem.scss +20 -0
  227. package/src/components/ListItem/ListItem.tsx +26 -0
  228. package/src/components/ListTable/ListTable.tsx +157 -0
  229. package/src/components/ListTable/ListTableCell.tsx +67 -0
  230. package/src/components/ListTable/ListTableHeader.tsx +33 -0
  231. package/src/components/ListTable/ListTableRow.tsx +46 -0
  232. package/src/components/LoadingIndicator/LoadingIndicator.scss +50 -0
  233. package/src/components/LoadingIndicator/LoadingIndicator.tsx +44 -0
  234. package/src/components/Menu/Menu.js +74 -0
  235. package/src/components/Menu/Menu.scss +27 -0
  236. package/src/components/Modal/Modal.scss +117 -0
  237. package/src/components/Modal/Modal.tsx +104 -0
  238. package/src/components/Modal/ModalWithButtons.tsx +34 -0
  239. package/src/components/MultiSelect/MultiSelect.js +117 -0
  240. package/src/components/MultiSelect/MultiSelect.scss +29 -0
  241. package/src/components/MultiSelect/MultiSelectUtils.js +23 -0
  242. package/src/components/NavMenu/NavLayout.tsx +40 -0
  243. package/src/components/NavMenu/NavMenu.js +35 -0
  244. package/src/components/NavMenu/NavMenuContent.tsx +23 -0
  245. package/src/components/NavMenu/NavMenuItem.tsx +96 -0
  246. package/src/components/NotificationBanner/NotificationBanner.tsx +57 -0
  247. package/src/components/Page/CRUDPage.js +123 -0
  248. package/src/components/Page/CRUDPage.scss +32 -0
  249. package/src/components/Page/Page.js +102 -0
  250. package/src/components/Page/Page.scss +59 -0
  251. package/src/components/PaginationMenu/PaginationMenu.js +31 -0
  252. package/src/components/PaginationMenu/PaginationMenuLarge.tsx +94 -0
  253. package/src/components/PaginationMenu/PaginationMenuSmall.tsx +40 -0
  254. package/src/components/PreviewPhone/PreviewPhone.tsx +53 -0
  255. package/src/components/PreviewPhone/useWindowDimensions.js +26 -0
  256. package/src/components/Radio/Radio.js +99 -0
  257. package/src/components/Radio/Radio.scss +58 -0
  258. package/src/components/RadioGroup/RadioGroup.js +63 -0
  259. package/src/components/RadioGroup/RadioGroup.scss +37 -0
  260. package/src/components/Section/Section.scss +74 -0
  261. package/src/components/Section/Section.tsx +67 -0
  262. package/src/components/Select/LegacySelect.js +114 -0
  263. package/src/components/Select/Select.examples.md +161 -0
  264. package/src/components/Select/Select.tsx +136 -0
  265. package/src/components/Select/options.transformer.ts +36 -0
  266. package/src/components/Select/select.utils.spec.ts +63 -0
  267. package/src/components/Select/select.utils.ts +45 -0
  268. package/src/components/SettingsMenuButton/SettingsMenuButton.tsx +111 -0
  269. package/src/components/Spinner/Spinner.tsx +23 -0
  270. package/src/components/Steps/Step.tsx +22 -0
  271. package/src/components/Steps/Steps.tsx +24 -0
  272. package/src/components/Switcher/Switcher.js +58 -0
  273. package/src/components/Switcher/SwitcherItem.js +61 -0
  274. package/src/components/Switcher/SwitcherItem.scss +67 -0
  275. package/src/components/TabLinks/TabLinks.tsx +63 -0
  276. package/src/components/Tabbar/Tabbar.tsx +29 -0
  277. package/src/components/Tabbar/TabbarItem.tsx +53 -0
  278. package/src/components/Tag/Tag.tsx +39 -0
  279. package/src/components/Tag/TagGroup.tsx +25 -0
  280. package/src/components/Text/LegacyText.js +78 -0
  281. package/src/components/Text/Text.scss +67 -0
  282. package/src/components/Text/Text.tsx +81 -0
  283. package/src/components/TextEditor/TextEditor.js +61 -0
  284. package/src/components/TextEditor/TextEditor.scss +14 -0
  285. package/src/components/TextEditorV2/TextEditorV2.js +58 -0
  286. package/src/components/TextEditorV2/TextEditorV2.scss +110 -0
  287. package/src/components/TextLink/TextLink.tsx +42 -0
  288. package/src/components/TextListItem/TextListItem.js +31 -0
  289. package/src/components/TextListItem/TextListItem.scss +10 -0
  290. package/src/components/Textarea/Textarea.js +108 -0
  291. package/src/components/Textarea/Textarea.scss +56 -0
  292. package/src/components/Title/LegacyTitle.js +64 -0
  293. package/src/components/Title/Title.scss +65 -0
  294. package/src/components/Title/Title.tsx +57 -0
  295. package/src/components/ViewItem/ViewItem.tsx +73 -0
  296. package/src/index.tsx +14 -0
  297. package/src/styles/_colors.scss +59 -0
  298. package/src/styles/_layout.scss +64 -0
  299. package/src/styles/_shadows.scss +19 -0
  300. package/src/styles/_typography.scss +8 -0
  301. package/src/styles/_utils.scss +45 -0
  302. package/src/styles/fonts/avenir/3A0AF8_0_0.eot +0 -0
  303. package/src/styles/fonts/avenir/3A0AF8_0_0.ttf +0 -0
  304. package/src/styles/fonts/avenir/3A0AF8_0_0.woff +0 -0
  305. package/src/styles/fonts/avenir/3A0AF8_0_0.woff2 +0 -0
  306. package/src/styles/fonts/avenir/3A0AF8_1_0.eot +0 -0
  307. package/src/styles/fonts/avenir/3A0AF8_1_0.ttf +0 -0
  308. package/src/styles/fonts/avenir/3A0AF8_1_0.woff +0 -0
  309. package/src/styles/fonts/avenir/3A0AF8_1_0.woff2 +0 -0
  310. package/src/types/general.types.ts +11 -0
  311. package/src/utils/useOutsideClick.js +19 -0
@@ -0,0 +1,67 @@
1
+ @import "../../styles/colors";
2
+ @import "../../styles/typography";
3
+
4
+ .cweb-text {
5
+ $color: $color-body;
6
+ $color-fineprint: $color-text-lighter;
7
+ $color-small: $color-text-secondary;
8
+
9
+ $font-size: 1rem;
10
+ $font-size-small: 0.875rem;
11
+
12
+ $line-height: 1.31em;
13
+ $line-height-small: 1.25em;
14
+
15
+ @include text($font-size, $line-height, $color);
16
+
17
+ &.type-emphasized {
18
+ font-weight: bold;
19
+ }
20
+
21
+ &.type-error {
22
+ color: $color-negative-alt-emphasis;
23
+ font-size: $font-size-small;
24
+ line-height: $line-height-small;
25
+ }
26
+
27
+ &.type-strong {
28
+ font-weight: bold;
29
+ color: $color-text-emphasis;
30
+ }
31
+
32
+ &.type-small-dark {
33
+ font-size: $font-size-small;
34
+ line-height: $line-height-small;
35
+ color: $color-body;
36
+ }
37
+
38
+ &.type-small {
39
+ font-size: $font-size-small;
40
+ line-height: $line-height-small;
41
+ color: $color-small;
42
+ }
43
+
44
+ &.type-small-fineprint {
45
+ font-size: $font-size-small;
46
+ line-height: $line-height-small;
47
+ color: $color-fineprint;
48
+ }
49
+
50
+ &.type-fineprint {
51
+ color: $color-fineprint;
52
+ }
53
+
54
+ &.level-inline {
55
+ display: inline;
56
+ }
57
+
58
+ &.level-block {
59
+ display: block;
60
+ }
61
+ }
62
+
63
+ .in-html-link {
64
+ a:hover {
65
+ text-decoration: underline;
66
+ }
67
+ }
@@ -0,0 +1,81 @@
1
+ import classNames from "classnames";
2
+ import React from "react";
3
+
4
+ import { RestPropped } from "../../types/general.types";
5
+
6
+ import "./Text.scss";
7
+
8
+ export type TextStyle = "sm" | "sm-strong" | "base" | "strong" | "lg" | "lg-strong" | "xl" | "xl-strong" | string;
9
+
10
+ //Extend with other colors that we want to enable for text
11
+ export type TextColor = "base" | "gray-500" | "gray-200" | "white" | "blue" | "red" | "green" | "amber" | "inherit";
12
+
13
+ export interface TextProps extends RestPropped {
14
+ text: string;
15
+ type?: TextStyle; //defaults to "base"
16
+ inline?: boolean; //defaults to false
17
+ color?: TextColor; //defaults to "base"
18
+ hoverColor?: TextColor; //defaults to "base"
19
+ className?: string;
20
+ containsDangerousHtml?: boolean; //defaults to false
21
+ truncate?: boolean; //defaults to false
22
+ "data-test-id"?: string;
23
+ }
24
+
25
+ export const Text = (props: TextProps): JSX.Element => {
26
+ const containerProps = {
27
+ "data-test-id": props["data-test-id"],
28
+ className: classNames(
29
+ // apply different style classes
30
+ // for now we stick with font-size 16px on the body
31
+ // so I am adjusting our styles accordingly (one step down)
32
+ {
33
+ "text-xs font-medium": props.type === "sm",
34
+ "text-xs font-semibold": props.type === "sm-strong",
35
+ "text-sm": props.type === "base",
36
+ "text-sm font-semibold": props.type === "strong",
37
+ "": props.type === "lg",
38
+ "font-semibold": props.type === "lg-strong",
39
+ "text-lg": props.type === "xl",
40
+ "font-semibold text-lg": props.type === "xl-strong",
41
+ },
42
+ {
43
+ inline: props.inline,
44
+ // FIXME: this class doesn't do anything without a max-width
45
+ truncate: props.truncate,
46
+ },
47
+ {
48
+ "text-slate-700": props.color === "base",
49
+ "text-slate-500": props.color === "gray-500",
50
+ "text-slate-200": props.color === "gray-200",
51
+ "text-red-700": props.color === "red",
52
+ "text-green-700": props.color === "green",
53
+ "text-yellow-700": props.color === "amber",
54
+ "text-blue-700": props.color === "blue",
55
+ "text-white": props.color === "white",
56
+ "text-primary-dark": props.color === "blue",
57
+ },
58
+ {
59
+ "in-html-link": props.containsDangerousHtml,
60
+ },
61
+ //can be used to overwrite other classes like the color
62
+ props.className
63
+ ),
64
+ };
65
+
66
+ return props.containsDangerousHtml ? (
67
+ <p {...containerProps} dangerouslySetInnerHTML={{ __html: props.text }} />
68
+ ) : (
69
+ <p {...containerProps}>{props.text}</p>
70
+ );
71
+ };
72
+
73
+ export default Text;
74
+
75
+ Text.defaultProps = {
76
+ type: "base",
77
+ inline: false,
78
+ color: "base",
79
+ containsDangerousHtml: false,
80
+ truncate: false,
81
+ };
@@ -0,0 +1,61 @@
1
+ import React, { useEffect, useMemo, useRef } from "react";
2
+ import PropTypes from "prop-types";
3
+ import ReactQuill from "react-quill";
4
+
5
+ import "react-quill/dist/quill.snow.css";
6
+ import "./TextEditor.scss";
7
+
8
+ export default function TextEditor({ defaultValue, onValueChange, placeholder }) {
9
+ const formats = ["bold", "italic", "underline", "strike", "list", "bullet", "link", "video"];
10
+ const toolbarLastGroup = ["link", "video"];
11
+ const quillRef = useRef();
12
+
13
+
14
+ useEffect(() => {
15
+ if (quillRef.current) {
16
+ const quillInstance = quillRef.current;
17
+ const tooltipSave = quillInstance.editor.theme.tooltip.save;
18
+
19
+ quillInstance.editor.theme.tooltip.save = function () {
20
+ // overwrite save link functionality
21
+ let url = this.textbox.value;
22
+
23
+ if (url.indexOf("http") === -1 || url.indexOf("https") === -1) {
24
+ url = `https://${url}`;
25
+ this.textbox.value = url;
26
+ }
27
+ tooltipSave.call(this);
28
+ };
29
+ }
30
+ }, []);
31
+
32
+ const modules = useMemo(() => {
33
+ return {
34
+ toolbar: {
35
+ container: [
36
+ ["bold", "italic", "underline", "strike"],
37
+ [{ list: "ordered" }, { list: "bullet" }],
38
+ toolbarLastGroup,
39
+ ],
40
+ },
41
+ };
42
+ }, []);
43
+
44
+ return (
45
+ <ReactQuill
46
+ ref={quillRef}
47
+ theme="snow"
48
+ modules={modules}
49
+ placeholder={placeholder}
50
+ formats={formats}
51
+ value={defaultValue}
52
+ onChange={onValueChange}
53
+ />
54
+ );
55
+ }
56
+
57
+ TextEditor.propTypes = {
58
+ defaultValue: PropTypes.string,
59
+ placeholder: PropTypes.string,
60
+ onValueChange: PropTypes.func.isRequired,
61
+ };
@@ -0,0 +1,14 @@
1
+ @import "../../styles/colors";
2
+
3
+ .ql-editor {
4
+ resize: vertical;
5
+ min-height: 10rem;
6
+ }
7
+
8
+ .ql-snow.ql-toolbar {
9
+ display: block;
10
+ background: $color-slate-100;
11
+ border-top-left-radius: 0.5em;
12
+ border-top-right-radius: 0.5em;
13
+ margin-top: 0.5em;
14
+ }
@@ -0,0 +1,58 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import { EditorState, convertToRaw, ContentState } from "draft-js";
3
+ import { Editor } from "react-draft-wysiwyg";
4
+ import draftToHtml from "draftjs-to-html";
5
+ import htmlToDraft from "html-to-draftjs";
6
+
7
+ import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
8
+ import "./TextEditorV2.scss";
9
+
10
+ export const TextEditorV2 = ({ defaultValue, onValueChange, locale }) => {
11
+ const [editorState, setEditorState] = useState(EditorState.createEmpty());
12
+
13
+ const getOptions = () => {
14
+ const options = ["inline", "list", "link", "textAlign", "history"];
15
+ options.splice(options.length - 1, 0, "embedded");
16
+ return options;
17
+ };
18
+
19
+ useEffect(() => {
20
+ const { contentBlocks, entityMap } = htmlToDraft(defaultValue);
21
+ setEditorState(EditorState.createWithContent(ContentState.createFromBlockArray(contentBlocks, entityMap)));
22
+ }, []);
23
+
24
+ const onEditorStateChange = (state) => {
25
+ setEditorState(state);
26
+ onValueChange(draftToHtml(convertToRaw(state.getCurrentContent())));
27
+ };
28
+
29
+ return (
30
+ <div className="editor">
31
+ <Editor
32
+ toolbar={{
33
+ options: getOptions(),
34
+ inline: {
35
+ options: ["bold", "italic", "underline"],
36
+ },
37
+ list: {
38
+ options: ["unordered", "ordered"],
39
+ },
40
+ link: {
41
+ showOpenOptionOnHover: false,
42
+ defaultTargetOption: "_blank",
43
+ },
44
+ }}
45
+ editorState={editorState}
46
+ onEditorStateChange={onEditorStateChange}
47
+ wrapperClassName="mb-6"
48
+ toolbarClassName="border border-solid border-color-border-primary"
49
+ editorClassName="border border-solid border-color-border-primary h-56"
50
+ localization={{
51
+ locale: locale,
52
+ }}
53
+ />
54
+ </div>
55
+ );
56
+ };
57
+
58
+ export default TextEditorV2;
@@ -0,0 +1,110 @@
1
+ .editor {
2
+ .rdw-editor {
3
+ overflow-y: auto;
4
+
5
+ .rdw-link-modal {
6
+ width: 20rem;
7
+ height: 19rem;
8
+
9
+ .rdw-link-modal-label,
10
+ .rdw-link-modal-target-option {
11
+ font-weight: normal;
12
+ }
13
+
14
+ .rdw-link-modal-input {
15
+ margin-bottom: 1rem;
16
+
17
+ font-size: 16px;
18
+ font-weight: normal;
19
+ line-height: 21px;
20
+ color: #2d2d2d;
21
+ height: 44px;
22
+ border: 1px solid #cccccc;
23
+ border-radius: 4px;
24
+ outline: none;
25
+ background-color: #ffffff;
26
+ padding: 12px;
27
+ caret-color: #0a78b2;
28
+ }
29
+
30
+ .rdw-link-modal-buttonsection {
31
+ display: flex;
32
+ flex-direction: row-reverse;
33
+ align-items: center;
34
+
35
+ .rdw-link-modal-btn {
36
+ border-radius: 1.375rem;
37
+ width: 6.5rem;
38
+ height: 2.75rem;
39
+ border: 1px solid #009fe3;
40
+ background-color: transparent;
41
+ color: #009fe3;
42
+ }
43
+
44
+ .rdw-link-modal-btn:first-child,
45
+ .rdw-link-modal-btn:disabled {
46
+ background: #009fe3;
47
+ color: #ffffff;
48
+ }
49
+ }
50
+ }
51
+
52
+ .rdw-embedded-modal {
53
+ width: 22rem;
54
+ height: 15rem;
55
+
56
+ .rdw-embedded-modal-link-input,
57
+ .rdw-embedded-modal-size-input {
58
+ font-size: 16px;
59
+ font-weight: normal;
60
+ line-height: 21px;
61
+ color: #2d2d2d;
62
+ height: 44px;
63
+ border: 1px solid #cccccc;
64
+ border-radius: 4px;
65
+ outline: none;
66
+ background-color: #ffffff;
67
+ padding: 12px;
68
+ caret-color: #0a78b2;
69
+ }
70
+
71
+ .rdw-embedded-modal-link-input {
72
+ width: 100%;
73
+ }
74
+
75
+ .rdw-embedded-modal-size-input {
76
+ width: 90%;
77
+ }
78
+
79
+ .rdw-embedded-modal-btn-section {
80
+ display: flex;
81
+ flex-direction: row;
82
+ align-items: center;
83
+
84
+ .rdw-embedded-modal-btn {
85
+ border-radius: 1.375rem;
86
+ width: 6.5rem;
87
+ height: 2.75rem;
88
+ border: 1px solid #009fe3;
89
+ background-color: transparent;
90
+ color: #009fe3;
91
+ }
92
+
93
+ .rdw-embedded-modal-btn:first-child,
94
+ .rdw-embedded-modal-btn:disabled {
95
+ background: #009fe3;
96
+ color: #ffffff;
97
+ }
98
+ }
99
+ }
100
+
101
+ .rdw-editor-main {
102
+ min-height: 14rem;
103
+ overflow: hidden;
104
+
105
+ .DraftEditor-root {
106
+ margin: 0 12px;
107
+ }
108
+ }
109
+ }
110
+ }
@@ -0,0 +1,42 @@
1
+ import classNames from "classnames";
2
+ import React from "react";
3
+
4
+ export interface TextLinkProps {
5
+ text: string;
6
+ enabled?: boolean;
7
+ href?: string;
8
+ rel?: string;
9
+ target?: string;
10
+ onClick?: () => void;
11
+ className?: string;
12
+ }
13
+
14
+ export const TextLink = (props: TextLinkProps): JSX.Element => {
15
+ const className = classNames(
16
+ "text-sm hover:underline",
17
+ {
18
+ "cursor-pointer": props.enabled,
19
+ "cursor-default": !props.enabled,
20
+ },
21
+ {
22
+ "text-blue-800": props.enabled,
23
+ "text-slate-800": !props.enabled,
24
+ },
25
+ {
26
+ "hover:text-blue-900": props.enabled,
27
+ "hover:text-slate-900": !props.enabled,
28
+ }
29
+ );
30
+
31
+ return (
32
+ <a
33
+ href={props.href}
34
+ rel={props.rel}
35
+ target={props.target}
36
+ onClick={props.onClick}
37
+ className={classNames(className, props.className)}
38
+ >
39
+ {props.text}
40
+ </a>
41
+ );
42
+ };
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import classNames from "classnames";
4
+
5
+ import LegacyText from "../Text/LegacyText";
6
+ import "./TextListItem.scss";
7
+ import ListItem from "../ListItem/ListItem";
8
+
9
+ function TextListItem(props) {
10
+ const { text, icon, className, iconClass, onClick, ...rest } = props;
11
+
12
+ const mergedClasses = classNames("cweb-text-list-item", className);
13
+ const iconClasses = classNames("cweb-text-list-item-icon", iconClass);
14
+
15
+ return (
16
+ <ListItem className={mergedClasses} onClick={onClick} {...rest}>
17
+ {icon && <img className={iconClasses} src={icon} alt="" />}
18
+ <LegacyText text={text} />
19
+ </ListItem>
20
+ );
21
+ }
22
+
23
+ TextListItem.propTypes = {
24
+ text: PropTypes.string.isRequired,
25
+ icon: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
26
+ className: PropTypes.string,
27
+ iconClass: PropTypes.string,
28
+ onClick: PropTypes.func,
29
+ };
30
+
31
+ export default TextListItem;
@@ -0,0 +1,10 @@
1
+ @import "../../styles/colors";
2
+ @import "../../styles/layout";
3
+
4
+ .cweb-text-list-item {
5
+ .cweb-text-list-item-icon {
6
+ width: 24px;
7
+ height: 24px;
8
+ margin-right: 16px;
9
+ }
10
+ }
@@ -0,0 +1,108 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import classNames from "classnames";
4
+
5
+ import "./Textarea.scss";
6
+
7
+ const RESIZE_TYPES = {
8
+ NONE: "none",
9
+ BOTH: "both",
10
+ HORIZONTAL: "horizontal",
11
+ VERTICAL: "vertical",
12
+ };
13
+
14
+ Textarea.propTypes = {
15
+ className: PropTypes.string,
16
+ value: PropTypes.string,
17
+ name: PropTypes.string.isRequired,
18
+ placeholder: PropTypes.string,
19
+ maxLength: PropTypes.number,
20
+ rows: PropTypes.number,
21
+ resizable: PropTypes.oneOf([RESIZE_TYPES.BOTH, RESIZE_TYPES.HORIZONTAL, RESIZE_TYPES.VERTICAL, RESIZE_TYPES.NONE]),
22
+ isDisabled: PropTypes.bool,
23
+ icon: PropTypes.string,
24
+ onChange: PropTypes.func.isRequired,
25
+ onBlur: PropTypes.func,
26
+ onFocus: PropTypes.func,
27
+ onKeyPress: PropTypes.func,
28
+ onKeyDown: PropTypes.func,
29
+ onCtrlEnter: PropTypes.func,
30
+ };
31
+
32
+ function Textarea(props) {
33
+ const {
34
+ className,
35
+ value,
36
+ name,
37
+ placeholder,
38
+ maxLength,
39
+ rows = 4,
40
+ resizable = RESIZE_TYPES.VERTICAL,
41
+ isDisabled = false,
42
+ icon,
43
+ onChange,
44
+ onBlur,
45
+ onFocus,
46
+ onKeyPress,
47
+ onKeyDown,
48
+ onCtrlEnter,
49
+ ...otherProps
50
+ } = props;
51
+
52
+ let style;
53
+
54
+ if (icon) {
55
+ style = {
56
+ backgroundImage: `url(${icon})`,
57
+ };
58
+ }
59
+
60
+ return (
61
+ <textarea
62
+ {...otherProps}
63
+ name={name}
64
+ value={value}
65
+ placeholder={placeholder}
66
+ onChange={onChange}
67
+ onBlur={onBlur}
68
+ onFocus={onFocus}
69
+ onKeyPress={onKeyPress}
70
+ onKeyDown={(event) => {
71
+ onKeyDown?.();
72
+ const { ctrlKey, metaKey, key } = event;
73
+
74
+ if ((ctrlKey || metaKey) && key === "Enter") {
75
+ onCtrlEnter?.();
76
+ }
77
+ }}
78
+ maxLength={maxLength}
79
+ rows={rows}
80
+ disabled={isDisabled}
81
+ className={classNames(
82
+ "cweb-textarea",
83
+ className,
84
+ "p-2",
85
+ "border",
86
+ "placeholder-gray-500",
87
+ "text-sm",
88
+ "border-solid",
89
+ "border-input-border",
90
+ "hover:border-input-border-dark",
91
+ "focus:outline-primary",
92
+ "transition-colors",
93
+ "duration-300",
94
+ "w-full",
95
+ "focus:border-primary",
96
+ {
97
+ "has-icon": !!icon,
98
+ resizable: resizable === RESIZE_TYPES.BOTH,
99
+ "resizable-x": resizable === RESIZE_TYPES.HORIZONTAL,
100
+ "resizable-y": resizable === RESIZE_TYPES.VERTICAL,
101
+ }
102
+ )}
103
+ style={style}
104
+ />
105
+ );
106
+ }
107
+
108
+ export default Textarea;
@@ -0,0 +1,56 @@
1
+ @import "../../styles/colors";
2
+ @import "../../styles/typography";
3
+ @import "../../styles/layout";
4
+
5
+ .cweb-textarea {
6
+ border: 1px solid $color-border;
7
+ border-radius: $default-border-radius;
8
+ outline: none;
9
+ background-color: $color-white;
10
+
11
+ resize: none;
12
+
13
+ &.has-icon {
14
+ background-size: 24px;
15
+ background-position: 10px 10px;
16
+ background-repeat: no-repeat;
17
+ padding-left: 44px;
18
+ }
19
+
20
+ &.resizable {
21
+ resize: both;
22
+ }
23
+
24
+ &.resizable-x {
25
+ resize: horizontal;
26
+ }
27
+
28
+ &.resizable-y {
29
+ resize: vertical;
30
+ }
31
+
32
+ &::placeholder {
33
+ color: $color-text-lighter;
34
+ }
35
+
36
+ &:-ms-input-placeholder {
37
+ color: $color-placeholder !important;
38
+ }
39
+
40
+ &::-ms-input-placeholder {
41
+ color: $color-placeholder;
42
+ }
43
+
44
+ &:focus {
45
+ border-color: $color-primary;
46
+ }
47
+
48
+ &:disabled {
49
+ cursor: not-allowed;
50
+ }
51
+
52
+ &.has-error {
53
+ border: 1px solid $color-negative;
54
+ color: $color-negative;
55
+ }
56
+ }