@luscii-healthtech/web-ui 0.0.0-alpha.caf5372 → 0.0.0-alpha.d641b2f

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 (240) hide show
  1. package/README.md +175 -46
  2. package/dist/components/Accordion/Accordion.d.ts +10 -11
  3. package/dist/components/Accordion/AccordionItem.d.ts +9 -10
  4. package/dist/components/AccordionList/AccordionList.d.ts +42 -5
  5. package/dist/components/AccordionList/subcomponents/AccordionListActions.d.ts +18 -0
  6. package/dist/components/Badge/Badge.d.ts +7 -5
  7. package/dist/components/BaseList/BaseList.d.ts +7 -13
  8. package/dist/components/BaseList/BaseList.types.d.ts +55 -55
  9. package/dist/components/BaseList/BaseListEmptyState.d.ts +7 -9
  10. package/dist/components/BaseList/BaseListHeader.d.ts +4 -11
  11. package/dist/components/BaseList/BaseListIcon.d.ts +5 -7
  12. package/dist/components/BaseList/BaseListItem.d.ts +4 -3
  13. package/dist/components/BaseList/DraggableBaseList/DraggableBaseList.d.ts +4 -14
  14. package/dist/components/BaseList/DraggableBaseList/DraggableBaseListItem.d.ts +3 -2
  15. package/dist/components/BaseList/DraggableBaseList/index.d.ts +2 -2
  16. package/dist/components/BaseList/ListSkeleton/ListItemSkeleton.d.ts +2 -4
  17. package/dist/components/BaseList/ListSkeleton/ListSkeleton.d.ts +8 -9
  18. package/dist/components/BaseList/SortableBaseList/SortableBaseList.d.ts +4 -3
  19. package/dist/components/BaseList/SortableBaseList/SortableBaseListItem.d.ts +3 -7
  20. package/dist/components/BaseList/SortableBaseList/index.d.ts +2 -2
  21. package/dist/components/BaseList/index.d.ts +6 -5
  22. package/dist/components/BaseList/utils.d.ts +10 -18
  23. package/dist/components/Breadcrumbs/BreadcrumbItem.d.ts +4 -12
  24. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +3 -8
  25. package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +14 -1
  26. package/dist/components/Breadcrumbs/index.d.ts +2 -1
  27. package/dist/components/Button/Button.d.ts +9 -7
  28. package/dist/components/Button/Button.types.d.ts +32 -11
  29. package/dist/components/Button/ButtonIcon.d.ts +7 -5
  30. package/dist/components/ButtonV2/ButtonProps.type.d.ts +49 -0
  31. package/dist/components/ButtonV2/ButtonV2.d.ts +3 -2
  32. package/dist/components/ButtonV2/PrimaryButton.d.ts +3 -2
  33. package/dist/components/ButtonV2/SecondaryButton.d.ts +3 -2
  34. package/dist/components/ButtonV2/TertiaryButton.d.ts +3 -2
  35. package/dist/components/Card/Actions.d.ts +2 -0
  36. package/dist/components/Card/Card.d.ts +57 -9
  37. package/dist/components/Card/Padding.d.ts +6 -0
  38. package/dist/components/Card/Section.d.ts +6 -0
  39. package/dist/components/Card/TopBar.d.ts +9 -0
  40. package/dist/components/Carousel/Carousel.d.ts +8 -9
  41. package/dist/components/Carousel/GliderContainer.d.ts +7 -5
  42. package/dist/components/CenteredHero/CenteredHero.d.ts +14 -12
  43. package/dist/components/CheckBoxListModal/CheckboxListModal.d.ts +30 -11
  44. package/dist/components/Checkbox/Checkbox.d.ts +64 -4
  45. package/dist/components/CheckboxList/CheckboxGroup.d.ts +3 -12
  46. package/dist/components/CheckboxList/CheckboxList.d.ts +4 -12
  47. package/dist/components/CheckboxList/CheckboxList.types.d.ts +74 -1
  48. package/dist/components/ConfirmationDialog/ConfirmationDialog.d.ts +3 -2
  49. package/dist/components/ConfirmationDialog/ConfirmationDialogChoices.d.ts +7 -4
  50. package/dist/components/ConfirmationDialog/ConfirmationDialogMessage.d.ts +4 -4
  51. package/dist/components/ConfirmationDialog/ConfirmationDialogTitle.d.ts +3 -5
  52. package/dist/components/ConfirmationDialog/types/ConfirmationDialog.types.d.ts +41 -41
  53. package/dist/components/Container/FlexColumn.d.ts +7 -15
  54. package/dist/components/Container/FlexContainer.d.ts +9 -4
  55. package/dist/components/Container/FlexRow.d.ts +7 -2
  56. package/dist/components/Container/types/FlexContainerProps.type.d.ts +26 -26
  57. package/dist/components/Divider/Divider.d.ts +6 -4
  58. package/dist/components/DragHandle/DragHandle.d.ts +7 -3
  59. package/dist/components/DragHandle/DragHandle.types.d.ts +6 -6
  60. package/dist/components/DragHandle/index.d.ts +2 -1
  61. package/dist/components/Dropzone/Dropzone.d.ts +6 -8
  62. package/dist/components/Dropzone/Dropzone.types.d.ts +33 -33
  63. package/dist/components/Dropzone/index.d.ts +2 -1
  64. package/dist/components/EmptyListMessage/EmptyListMessage.d.ts +14 -10
  65. package/dist/components/FilterBar/ActiveFilters.d.ts +9 -0
  66. package/dist/components/FilterBar/FilterBar.d.ts +96 -0
  67. package/dist/components/FilterBar/FilterBar.utils.d.ts +32 -0
  68. package/dist/components/FilterBar/FilterBarProps.type.d.ts +86 -0
  69. package/dist/components/FilterBar/FiltersMenus.d.ts +8 -0
  70. package/dist/components/FilterBar/SortMenu.d.ts +9 -0
  71. package/dist/components/FilterBar/index.d.ts +2 -0
  72. package/dist/components/Form/Form.d.ts +30 -15
  73. package/dist/components/Form/FormFieldCheckbox.d.ts +9 -2
  74. package/dist/components/Form/FormFieldCheckboxList.d.ts +9 -15
  75. package/dist/components/Form/FormFieldErrorMessages.d.ts +8 -4
  76. package/dist/components/Form/FormFieldLabeler.d.ts +8 -12
  77. package/dist/components/Form/FormImagePicker.d.ts +9 -2
  78. package/dist/components/Form/FormInput.d.ts +14 -2
  79. package/dist/components/Form/FormRadioGroup.d.ts +13 -2
  80. package/dist/components/Form/FormSelect.d.ts +10 -2
  81. package/dist/components/Form/FormTextarea.d.ts +14 -2
  82. package/dist/components/Form/form.transformer.d.ts +3 -1
  83. package/dist/components/Form/form.types.d.ts +92 -91
  84. package/dist/components/Icon/Icon.d.ts +17 -3
  85. package/dist/components/Icon/index.d.ts +1 -1
  86. package/dist/components/Icons/AddIcon.d.ts +4 -3
  87. package/dist/components/Icons/AlertsIcon.d.ts +4 -3
  88. package/dist/components/Icons/BellIcon.d.ts +4 -3
  89. package/dist/components/Icons/BluetoothIcon.d.ts +4 -3
  90. package/dist/components/Icons/ChartIcon.d.ts +4 -3
  91. package/dist/components/Icons/ChartLineColoredIcon.d.ts +4 -3
  92. package/dist/components/Icons/ChatBoxIcon.d.ts +4 -3
  93. package/dist/components/Icons/CheckIcon.d.ts +4 -3
  94. package/dist/components/Icons/ChevronDoubleIcon.d.ts +4 -3
  95. package/dist/components/Icons/ChevronDownIcon.d.ts +4 -3
  96. package/dist/components/Icons/ChevronRightIcon.d.ts +4 -3
  97. package/dist/components/Icons/ClockIcon.d.ts +4 -0
  98. package/dist/components/Icons/CrossIcon.d.ts +4 -3
  99. package/dist/components/Icons/DeleteIcon.d.ts +4 -3
  100. package/dist/components/Icons/DownArrowIcon.d.ts +4 -3
  101. package/dist/components/Icons/DragIcon.d.ts +4 -3
  102. package/dist/components/Icons/EditIcon.d.ts +4 -3
  103. package/dist/components/Icons/EmptyIcon.d.ts +4 -3
  104. package/dist/components/Icons/EmptyStateDashboardIcon.d.ts +4 -3
  105. package/dist/components/Icons/ExclamationMarkIcon.d.ts +4 -3
  106. package/dist/components/Icons/ExportIcon.d.ts +4 -0
  107. package/dist/components/Icons/EyeIcon.d.ts +4 -3
  108. package/dist/components/Icons/EyeIconSlashed.d.ts +4 -0
  109. package/dist/components/Icons/GearColoredIcon.d.ts +4 -3
  110. package/dist/components/Icons/GearIcon.d.ts +4 -3
  111. package/dist/components/Icons/GroupColoredIcon.d.ts +4 -3
  112. package/dist/components/Icons/GroupIcon.d.ts +4 -3
  113. package/dist/components/Icons/HamburgerIcon.d.ts +4 -3
  114. package/dist/components/Icons/HeartIcon.d.ts +4 -3
  115. package/dist/components/Icons/ImageIcon.d.ts +4 -3
  116. package/dist/components/Icons/InfoIcon.d.ts +4 -3
  117. package/dist/components/Icons/LeftArrowIcon.d.ts +4 -3
  118. package/dist/components/Icons/LightBulbIcon.d.ts +4 -3
  119. package/dist/components/Icons/LinkIcon.d.ts +4 -3
  120. package/dist/components/Icons/LockIcon.d.ts +4 -3
  121. package/dist/components/Icons/MessagesIcon.d.ts +4 -3
  122. package/dist/components/Icons/MouseIcon.d.ts +4 -3
  123. package/dist/components/Icons/NotesIcon.d.ts +4 -3
  124. package/dist/components/Icons/PageViewIcon.d.ts +4 -0
  125. package/dist/components/Icons/PinIcon.d.ts +4 -3
  126. package/dist/components/Icons/PrintIcon.d.ts +4 -3
  127. package/dist/components/Icons/RightArrowIcon.d.ts +4 -3
  128. package/dist/components/Icons/RobotIcon.d.ts +4 -0
  129. package/dist/components/Icons/SearchCancelIcon.d.ts +4 -3
  130. package/dist/components/Icons/SearchIcon.d.ts +4 -3
  131. package/dist/components/Icons/SmallCircleIcon.d.ts +4 -3
  132. package/dist/components/Icons/SmallDiamondIcon.d.ts +4 -3
  133. package/dist/components/Icons/SmallSquareIcon.d.ts +4 -3
  134. package/dist/components/Icons/SpaceRocketIcon.d.ts +4 -3
  135. package/dist/components/Icons/StarIcon.d.ts +4 -3
  136. package/dist/components/Icons/StatusColoredIcon.d.ts +4 -3
  137. package/dist/components/Icons/WarningIcon.d.ts +4 -3
  138. package/dist/components/Icons/iconWrapper/iconWrapper.d.ts +4 -3
  139. package/dist/components/Icons/iconWrapper/index.d.ts +1 -1
  140. package/dist/components/Icons/index.d.ts +52 -47
  141. package/dist/components/Icons/types/IconProps.type.d.ts +8 -8
  142. package/dist/components/Image/Image.d.ts +10 -5
  143. package/dist/components/InfoField/InfoField.d.ts +28 -9
  144. package/dist/components/Input/Input.d.ts +56 -10
  145. package/dist/components/Input/SearchInput.d.ts +24 -2
  146. package/dist/components/Link/Link.d.ts +19 -0
  147. package/dist/components/List/List.d.ts +6 -5
  148. package/dist/components/List/List.types.d.ts +19 -19
  149. package/dist/components/List/ListItem.d.ts +4 -3
  150. package/dist/components/List/index.d.ts +5 -3
  151. package/dist/components/LoadingIndicator/LoadingIndicator.d.ts +12 -4
  152. package/dist/components/MediaPicker/ImageCategory.d.ts +14 -0
  153. package/dist/components/MediaPicker/MediaPicker.d.ts +91 -0
  154. package/dist/components/Modal/FullPageModal.d.ts +41 -29
  155. package/dist/components/Modal/FullPageModalHeader.d.ts +13 -7
  156. package/dist/components/Modal/Modal.d.ts +11 -2
  157. package/dist/components/Modal/ModalBase.d.ts +16 -5
  158. package/dist/components/Modal/ModalFooter.d.ts +12 -4
  159. package/dist/components/Modal/ModalHeader.d.ts +6 -4
  160. package/dist/components/Modal/subcomponents/FullPageModalActions.d.ts +18 -0
  161. package/dist/components/NavMenu/NavLayout.d.ts +35 -4
  162. package/dist/components/NavMenu/NavMenu.d.ts +16 -4
  163. package/dist/components/NavMenu/NavMenuContent.d.ts +3 -11
  164. package/dist/components/NavMenu/NavMenuFooter.d.ts +3 -8
  165. package/dist/components/NavMenu/NavMenuHeader.d.ts +3 -7
  166. package/dist/components/NavMenu/NavMenuItem.d.ts +3 -9
  167. package/dist/components/NavMenu/types/NavMenuFooterProps.type.d.ts +5 -5
  168. package/dist/components/NavMenu/types/NavMenuHeaderProps.type.d.ts +11 -5
  169. package/dist/components/NavMenu/types/NavMenuItemProps.type.d.ts +11 -11
  170. package/dist/components/NotificationBanner/NotificationBanner.d.ts +41 -12
  171. package/dist/components/Page/CRUDPage.d.ts +4 -17
  172. package/dist/components/Page/CRUDPage.types.d.ts +32 -32
  173. package/dist/components/Page/index.d.ts +3 -2
  174. package/dist/components/PageHeader/PageHeader.d.ts +4 -17
  175. package/dist/components/PageHeader/PageHeader.types.d.ts +28 -28
  176. package/dist/components/PageHeader/index.d.ts +2 -1
  177. package/dist/components/PaginationMenu/PaginationMenu.d.ts +3 -4
  178. package/dist/components/PaginationMenu/PaginationMenu.types.d.ts +37 -0
  179. package/dist/components/PaginationMenu/PaginationMenu.utils.d.ts +15 -4
  180. package/dist/components/PaginationMenu/PaginationMenuLarge.d.ts +3 -4
  181. package/dist/components/PaginationMenu/PaginationMenuSmall.d.ts +3 -4
  182. package/dist/components/PreviewPhone/PreviewPhone.d.ts +7 -11
  183. package/dist/components/Radio/RadioV2.d.ts +17 -3
  184. package/dist/components/RadioGroup/RadioGroupV2.d.ts +10 -2
  185. package/dist/components/Section/Section.d.ts +25 -4
  186. package/dist/components/Section/SectionItem.d.ts +9 -4
  187. package/dist/components/Section/SectionItemWithContent.d.ts +9 -3
  188. package/dist/components/Section/subcomponents/SectionActions.d.ts +21 -21
  189. package/dist/components/Select/Select.d.ts +46 -3
  190. package/dist/components/Select/SelectDropdownIndicator.d.ts +3 -2
  191. package/dist/components/Select/SelectLoadingIndicator.d.ts +3 -2
  192. package/dist/components/SettingsMenuButton/SettingsMenuButton.d.ts +19 -5
  193. package/dist/components/Spinner/Spinner.d.ts +6 -2
  194. package/dist/components/Steps/Step.d.ts +10 -9
  195. package/dist/components/Steps/Steps.d.ts +10 -9
  196. package/dist/components/Tabbar/Tabbar.d.ts +18 -13
  197. package/dist/components/Tabbar/TabbarItem.d.ts +16 -16
  198. package/dist/components/Table/Table.d.ts +16 -2
  199. package/dist/components/Table/Table.types.d.ts +42 -0
  200. package/dist/components/Table/Table.utils.d.ts +3 -2
  201. package/dist/components/Table/TableBody.d.ts +13 -4
  202. package/dist/components/Table/TableBodyRow.d.ts +10 -6
  203. package/dist/components/Table/TableBodyRowDataCell.d.ts +8 -4
  204. package/dist/components/Table/TableFooter.d.ts +8 -2
  205. package/dist/components/Table/TableHeader.d.ts +7 -4
  206. package/dist/components/Tag/Tag.d.ts +26 -12
  207. package/dist/components/Tag/TagGroup.d.ts +23 -9
  208. package/dist/components/Text/Text.d.ts +115 -24
  209. package/dist/components/TextEditor/TextEditor.d.ts +53 -0
  210. package/dist/components/TextLink/TextLink.d.ts +14 -8
  211. package/dist/components/Textarea/Textarea.d.ts +33 -3
  212. package/dist/components/Timeline/Timeline.d.ts +14 -12
  213. package/dist/components/Timeline/TimelineHeader.d.ts +10 -10
  214. package/dist/components/Timeline/TimelineStep.d.ts +10 -2
  215. package/dist/components/Title/Title.d.ts +31 -8
  216. package/dist/components/Toaster/Toaster.d.ts +17 -19
  217. package/dist/components/Toaster/toast-elements-getter.d.ts +22 -9
  218. package/dist/components/Toaster/toast-progress-animator.d.ts +12 -1
  219. package/dist/components/Toaster/toast.d.ts +12 -5
  220. package/dist/components/UnorderedList/UnorderedList.d.ts +61 -0
  221. package/dist/components/ViewItem/ViewItem.d.ts +16 -3
  222. package/dist/components/WeekdaysPicker/WeekdaysPicker.d.ts +42 -0
  223. package/dist/index.d.ts +81 -78
  224. package/dist/index.development.js +5843 -0
  225. package/dist/index.development.js.map +1 -0
  226. package/dist/index.js +1 -1356
  227. package/dist/index.js.map +1 -1
  228. package/dist/types/general.types.d.ts +8 -8
  229. package/dist/utils/string.utils.d.ts +7 -1
  230. package/dist/web-ui-tailwind.css +998 -529
  231. package/dist/web-ui.esm.js +1 -1356
  232. package/dist/web-ui.esm.js.map +1 -1
  233. package/package.json +53 -55
  234. package/dist/components/CheckboxList/CheckboxListItem.d.ts +0 -13
  235. package/dist/components/Icons/templates/component.d.ts +0 -3
  236. package/dist/components/Icons/templates/index.d.ts +0 -2
  237. package/dist/components/ImagePicker/ImageCategory.d.ts +0 -4
  238. package/dist/components/ImagePicker/ImagePicker.d.ts +0 -17
  239. package/dist/components/TabLinks/TabLinks.d.ts +0 -10
  240. package/dist/components/Tag/Tag.utils.d.ts +0 -1
package/README.md CHANGED
@@ -1,23 +1,82 @@
1
- # web-ui
1
+ # WebUI
2
2
 
3
- The web-ui repository contains the web UI components for Luscii's front end projects. It is published to NPM for inclusion into our projects. It also uses storybook and is published to chromatic for easy review of changes.
3
+ The `web-ui` repository contains the UI components for Luscii's frontend projects. It is published to NPM for usage into our projects. It uses Storybook and is published to Chromatic for easy review and tracking of visual changes.
4
+
5
+ ## Table of contents
6
+
7
+ - 📦 [Installation](#installation)
8
+ - 💻 [Running locally](#running-locally)
9
+ - 🏭 [Testing your production build](#testing-your-production-build)
10
+ - 🤝 [Contributing](#contributing)
11
+ - 📖 [Documentation](#documentation)
12
+ - 🌈 [Accessibility](#accessibility)
13
+ - 🧪 [Testing](#testing)
14
+ - 🔰 [Adding icons](#adding-icons)
15
+ - ♻️ [CI setup](#ci-setup)
16
+ - 📗 [Stories](#stories)
17
+
18
+ ## Installation
19
+
20
+ To use WebUI, you need to add it as a dependency to your project:
21
+
22
+ ```bash
23
+ yarn add @luscii-healthtech/web-ui
24
+ ```
25
+
26
+ Then you can use components like this:
27
+
28
+ ```tsx
29
+ import { Text } from "@luscii-healthtech/web-ui";
30
+
31
+ function MyComponent() {
32
+ return <Text>Some beautiful text from WebUI!</Text>;
33
+ }
34
+ ```
35
+
36
+ ### Fonts
37
+
38
+ WebUI uses the Avenir Next LT Pro font family for some headings. If you want to use these, you need to make them available in your project. You can do this by declaring the following `@font-face` rules in your CSS:
39
+
40
+ ```css
41
+ @font-face {
42
+ font-family: "AvenirNextLTPro-Regular";
43
+ src:
44
+ url("./<regular-font-file>.eot") format("embedded-opentype"),
45
+ url("./<regular-font-file>.woff2") format("woff2"),
46
+ url("./<regular-font-file>.woff") format("woff"),
47
+ url("./<regular-font-file>.ttf") format("truetype");
48
+ }
49
+
50
+ @font-face {
51
+ font-family: "AvenirNextLTPro-Bold";
52
+ src:
53
+ url("./<bold-font-file>.eot") format("embedded-opentype"),
54
+ url("./<bold-font-file>.woff2") format("woff2"),
55
+ url("./<bold-font-file>.woff") format("woff"),
56
+ url("./<bold-font-file>.ttf") format("truetype");
57
+ }
58
+ ```
59
+
60
+ The `font-family` property value is important, as this is what WebUI is referencing to use the font. The `src` property values should point to the font files you want to use.
61
+
62
+ If you don't declare these `@font-face` rules, the font will not be available and the headings will gracefully fall back to next available font in your application.
4
63
 
5
64
  ## Running locally
6
65
 
7
- If you want to run storybook locally you can use
66
+ If you want to run Storybook locally you can use:
8
67
 
9
68
  ```bash
10
69
  yarn install
11
- yarn storybook
70
+ yarn dev # runs a Tailwind watcher and Storybook
12
71
  ```
13
72
 
14
73
  ## Testing your production build
15
74
 
16
75
  Assuming the following setup:
17
76
 
18
- - The `web-ui` and `cVitals-Web` repositories are siblings are in the same folder
19
- - You have ran `yarn install` on `cVitals-Web`
20
- - You have ran `yarn build` on `web-ui`
77
+ - The `web-ui` and `cVitals-Web` repositories are siblings in the same folder.
78
+ - You ran `yarn install` in `cVitals-Web`.
79
+ - You ran `yarn build` in `web-ui`.
21
80
 
22
81
  Run the script below in your terminal, _in the parent folder of the repositories_.
23
82
 
@@ -31,79 +90,149 @@ Or use the shortcut:
31
90
  yarn test-copy-build
32
91
  ```
33
92
 
34
- When you run cVitals again, it should contain your latest updates in the component library. Use this to make sure your changes are solid before merging a pull request.
93
+ When you run `cVitals-Web` again, it should contain your latest updates in the component library. Use this to make sure your changes are solid before opening a pull request.
35
94
 
36
95
  ## Contributing
37
96
 
38
- Make sure you understand our design system and follow its guidelines. They are document in storybook. We value consistency, simplicity and usability highly. Don't mess it up.
97
+ Thank you for your help in keeping our component library organized and easy to use!
39
98
 
40
- If you want to add components, do so in
99
+ When adding components, please make sure to implement them consistently in our projects and that it is clear where and when they should be used. We want to avoid having many similar components. If you want to add components, do so in the `/src/components` directory. When you create new components, add them to Storybook as well. Stories go in the `/stories` directory.
41
100
 
42
- ```
43
- /src/components
44
- ```
101
+ If you add new components, please make sure they fit in with our existing ones and that it's clear where and when they should be used. We want to avoid having too many similar components.
45
102
 
46
- Please stay vigilant when adding components that we implement them consistently in our projects and that it is clear when and where they have to be used. We want to avoid a lot of components that are similar.
103
+ ### Documentation
47
104
 
48
- When you create new components, you must add them to storybook as well. Stories go in
105
+ Every component should have proper documentation that explains when, where and how to use it. This sounds like a lot of work, but it doesn't have to be. And it's important, also for you, to quickly see how to best use a component.
49
106
 
107
+ Component documentation should include the following parts:
108
+
109
+ - A short explanation of each prop in a JSDoc comment style.
110
+ - A stories file (`<ComponentName>.stories.tsx`).
111
+ - A docs file (`<ComponentName>.docs.mdx`).
112
+
113
+ Below is an explanation of each.
114
+
115
+ #### Props documented via JSDoc comments
116
+
117
+ A short explanation of each prop in a JSDoc comment style. These will show up in your IDE for on the fly documentation when you need it. It will also show up in Storybook, so this is a double-whammy and provides documentation exactly where you need it.
118
+
119
+ ```ts
120
+ type Props = {
121
+ /**
122
+ * Optional description that will be shown close to the label, used to provide more
123
+ * detail about the field next to the concise text of the label.
124
+ */
125
+ helperText?: string;
126
+ };
50
127
  ```
51
- /stories
52
- ```
128
+
129
+ #### Stories file
130
+
131
+ Stories files (`*stories.tsx`) will show up in Storybook as separate entries/pages for each component. Each component can have multiple stories defined for it, showing different use cases, variants and states of that component.
132
+ It is important to include stories for a lot of these different variants and states, because visual snapshots will be created of these stories by a tool called Chromatic. This allows us to visually track changes to the component over time, and ensure that it looks and behaves correctly across different use cases. By writing stories that showcase all the different ways your component can be used, you can catch issues early and ensure that your component is robust and reliable.
133
+
134
+ You can find the Chromatic project for WebUI [here](https://www.chromatic.com/library?appId=62b0c4d5afd432f7ee70a740).
135
+
136
+ #### Docs file
137
+
138
+ The component docs file brings everything together and should be considered the source of truth about the component. What should be documented:
139
+
140
+ - Why we have the component and where it should be used.
141
+ - An overview of the different variants and states.
142
+ - Usage guidelines of when and where to use the component.
143
+ - Best practices to show what to do and what not do when working with the component.
144
+
145
+ > 🔎 If you need to e.g. create a story to show how NOT to use a component, you might not want
146
+ > to create a snapshot for that component or show it in the sidebar of Storybook. To omit a story
147
+ > from snapshots, add the following to its parameters:
148
+ >
149
+ > ```ts
150
+ > chromatic: { disableSnapshot: true },
151
+ > ```
152
+ >
153
+ > To hide a story from the sidebar, prefix the story (variable) name
154
+ > with `HIDE_`.
155
+
156
+ Please see examples of other components' docs files for inspiration and try to stay consistent with how they are documented.
157
+
158
+ ### Accessibility
159
+
160
+ WebUI is not currently designed to support screen reader usage. This is because our application is designed specifically for healthcare providers and is not publicly accessible. Our primary users are caregivers who work in healthcare and do not rely on screen readers to be able to use our application.
161
+ However, it is important for developers to write accessible frontend code. Even if our current application is not designed to support screen reader usage. This means following best practices for web accessibility, such as using semantic HTML, providing alternative text for images, and ensuring keyboard navigation is possible. While our primary users may not rely on screen readers, it is important to make our application as inclusive as possible to all users.
162
+
163
+ ### Testing
164
+
165
+ WebUI relies on two types of testing: Visual snapshot testing via Chromatic and interaction testing via Storybook.
166
+
167
+ Visual snapshot testing is handled for you. Any story you write will be picked up by Chromatic and it will create a snapshot for it.
168
+
169
+ Interaction testing via Storybook allows to programmatically interact with the component. This is very helpful in testing any logic that the component may use internally and any states of the component that might be hard/impossible to trigger from the outside.
170
+ More information on how to approach writing interaction tests can be found in [this page of the Storybook documentation](https://storybook.js.org/docs/react/writing-tests/interaction-testing#write-an-interaction-test).
53
171
 
54
172
  ### Adding icons
55
173
 
56
- Add new icons by:
174
+ Add new icons by following these steps:
57
175
 
58
- - Add the svg file(s) in `src/components/Icons/icons`
59
- - Run `yarn icons`
176
+ - Add the svg file(s) in `src/components/Icons/icons`.
177
+ - Run `yarn icons`.
60
178
 
61
179
  The icons are optimized by SVGO and transformed into React components by [SVGR](https://react-svgr.com) which are placed in `src/components/Icons`.
62
180
 
63
181
  ## CI setup
64
182
 
65
- #### Branching
183
+ ### Branching
66
184
 
67
- The `main` branch is our default branch. When you contribute, branch from there and name your branch
185
+ The `main` branch is our default branch. When you contribute, branch from there and use the following branch naming convention:
68
186
 
69
187
  ```
70
- //Branch names convention (enforced)
188
+ // Branch naming convention (enforced)
71
189
 
72
- major/* //for a new design system or changes that effect our foundations (typography, color)
73
- minor/* //for new components and stories
74
- patch/* //for small improvements to existing components, stories
75
- bug/* //for bugs, fixes
190
+ major/* // For a new design system or changes that effect our foundations (e.g. typography, color).
191
+ minor/* // For new components and stories.
192
+ patch/* // For small improvements to existing components or stories.
193
+ bug/* // For bugs or fixes.
194
+ chore/* // For things related to development that don't impact the output for consumers and/or users.
76
195
  ```
77
196
 
78
197
  We have configured at lot of magic for your convenience.
79
198
 
80
- #### On every PR
199
+ ### On every PR
81
200
 
82
- 1. the module build, lint and tests are checked.
83
- 2. The storybook build is published to chromatic.
201
+ 1. The module build, lint and tests are checked.
202
+ 2. The Storybook build is published to Chromatic.
84
203
  3. Labels are added based on the branch name and PR size.
85
- 4. Branch names must follow the convention and are checked
204
+ 4. Branch names must follow the convention and are checked.
86
205
 
87
- #### On merge to main
206
+ ### On merge to main
88
207
 
89
- 1. Draft a github release
90
- 2. Version bump of the package
91
- 3. Publish new package to NPM
208
+ 1. Drafts a GitHub release.
209
+ 2. Bumps the version of the package.
210
+ 3. Publishes the new package version to NPM.
92
211
 
93
- ---
212
+ ## Stories
94
213
 
95
- ## IE11
214
+ ### Stories using deprecated props
96
215
 
97
- This package includes [dnd-kit](https://dndkit.com) as a peer dependency. The bundle of dnd-kit contains syntax which isn't compatible with IE11, therefore any application needing to support IE11 has to transpile dnd-kit.
216
+ When creating new stories for components with deprecated functionality please prefix the story name with `Deprecated`. In addition, also mark it with a "DEPRECATED" badge via the story's parameters.
98
217
 
99
- It should also at least include the following polyfills to make it work:
218
+ For example a story of a `FullPageModal` component using the deprecated `primaryButtonProps` prop would look like this:
100
219
 
101
- - [core-js](https://www.npmjs.com/package/core-js)
102
- - [regenerator-runtime](https://www.npmjs.com/package/regenerator-runtime)
103
- - [smoothscroll-polyfill](https://www.npmjs.com/package/smoothscroll-polyfill)
220
+ ```tsx
221
+ import { BADGES } from "../.storybook/constants";
104
222
 
105
- Optional:
106
-
107
- - [web-animations-js](https://www.npmjs.com/package/web-animations-js)
223
+ export const DeprecatedWithPrimaryButtonProps = {
224
+ render: OneColumTemplate,
225
+ args: {
226
+ isOpen: true,
227
+ primaryButtonProps: {
228
+ onClick: action("onClick Primary Button"),
229
+ text: "Primary",
230
+ },
231
+ },
232
+ parameters: {
233
+ badges: [BADGES.DEPRECATED],
234
+ },
235
+ };
236
+ ```
108
237
 
109
- This isn't necessary if the [drop animation is disabled](https://github.com/clauderic/dnd-kit/issues/705#issuecomment-1103056336). Check out [this ticket](https://github.com/clauderic/dnd-kit/issues/271) for more information on IE11.
238
+ This groups deprecated stories together and will make it easier to remove them later on.
@@ -1,11 +1,10 @@
1
- import p from "react";
2
- declare const I: ({ dataTestId: a, isCollapsedByDefault: o, items: r, className: i }: {
3
- dataTestId: any;
4
- isCollapsedByDefault?: boolean | undefined;
5
- items: any;
6
- className: any;
7
- }) => p.DetailedReactHTMLElement<{
8
- "data-test-id": any;
9
- className: any;
10
- }, HTMLElement>;
11
- export default I;
1
+ import React from "react";
2
+ import { AccordionItemProps } from "./AccordionItem";
3
+ export interface AccordionProps {
4
+ dataTestId?: string;
5
+ items: AccordionItemProps[];
6
+ className?: string;
7
+ isCollapsedByDefault?: boolean;
8
+ }
9
+ declare const Accordion: React.VFC<AccordionProps>;
10
+ export default Accordion;
@@ -1,10 +1,9 @@
1
- import e from "react";
2
- export declare const AccordionItem: ({ id: t, title: s, content: i, isCollapsedByDefault: l }: {
3
- id: any;
4
- title: any;
5
- content: any;
6
- isCollapsedByDefault?: boolean | undefined;
7
- }) => e.DetailedReactHTMLElement<{
8
- className: string;
9
- "data-test-id": any;
10
- }, HTMLElement>;
1
+ import React from "react";
2
+ export interface AccordionItemProps {
3
+ id: string | number;
4
+ title: string;
5
+ content: React.ReactNode;
6
+ className?: string;
7
+ isCollapsedByDefault?: boolean;
8
+ }
9
+ export declare const AccordionItem: React.VFC<AccordionItemProps>;
@@ -1,5 +1,42 @@
1
- import n from "react";
2
- export declare const AccordionList: (z: any) => n.DetailedReactHTMLElement<{
3
- className: string;
4
- }, HTMLElement>;
5
- export default AccordionList;
1
+ import React from "react";
2
+ import { AccordionProps } from "../Accordion/Accordion";
3
+ import { DraggableListProps, ListItemProps, SortableListProps } from "../List/List.types";
4
+ import { AccordionItemProps } from "../Accordion/AccordionItem";
5
+ import { BaseButtonProps } from "../ButtonV2/ButtonProps.type";
6
+ import { AccordionListActions } from "./subcomponents/AccordionListActions";
7
+ export interface AccordionListProps extends Omit<AccordionProps, "items"> {
8
+ localisations: {
9
+ title: string;
10
+ searchPlaceholder?: string;
11
+ emptyListText?: string;
12
+ };
13
+ accordionItems: AccordionItem[];
14
+ /**
15
+ * @deprecated
16
+ * Use the `actions` prop to render any button(s)
17
+ * or other component(s) automatically in the correct area.
18
+ */
19
+ buttonProps?: BaseButtonProps;
20
+ isSearchEnabled?: boolean;
21
+ isLoading?: boolean;
22
+ actions?: React.ReactNode;
23
+ }
24
+ export type AccordionListItemProps<T = ListItemProps> = Omit<AccordionItemProps, "content"> & {
25
+ listItems: T[];
26
+ draggableListType?: "default";
27
+ };
28
+ export type DraggableAccordionListItemProps = Omit<AccordionItemProps, "content"> & {
29
+ draggableListType: "draggable";
30
+ listItems: DraggableListProps["items"];
31
+ };
32
+ export type SortableAccordionListItemProps = Omit<AccordionItemProps, "content"> & {
33
+ draggableListType: "sortable";
34
+ draggableIdentifier: string;
35
+ listItems: SortableListProps["items"];
36
+ };
37
+ export type AccordionItem = AccordionListItemProps | DraggableAccordionListItemProps | SortableAccordionListItemProps;
38
+ interface StaticComponents {
39
+ Actions: typeof AccordionListActions;
40
+ }
41
+ export declare const AccordionList: React.FC<AccordionListProps> & StaticComponents;
42
+ export default AccordionList;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ /**
3
+ * Use in the actions of an AccordionList. Spaces out the action
4
+ * components correctly in relation to the styling of the AccordionList component.
5
+ *
6
+ * @usage
7
+ * ```tsx
8
+ * <AccordionList
9
+ * actions={
10
+ * <AccordionList.Actions>
11
+ * <PrimaryButton />
12
+ * <SecondaryButton />
13
+ * </AccordionList.Actions>
14
+ * }
15
+ * />
16
+ * ```
17
+ */
18
+ export declare const AccordionListActions: React.FC<React.PropsWithChildren>;
@@ -1,5 +1,7 @@
1
- import s from "react";
2
- declare const o: (e: any) => s.DetailedReactHTMLElement<{
3
- className: string;
4
- }, HTMLElement>;
5
- export default o;
1
+ /// <reference types="react" />
2
+ interface BadgeProps {
3
+ badgeCount: number;
4
+ className?: string;
5
+ }
6
+ declare const Badge: (props: BadgeProps) => JSX.Element;
7
+ export default Badge;
@@ -1,13 +1,7 @@
1
- import o from "react";
2
- export declare const BaseList: o.ForwardRefExoticComponent<{
3
- dataTestId: any;
4
- title: any;
5
- headerButton: any;
6
- emptyStateMessage: any;
7
- isLoading: any;
8
- items: any;
9
- headerTransparent: any;
10
- itemComponent: any;
11
- footer: any;
12
- withBorder?: boolean | undefined;
13
- } & o.RefAttributes<unknown>>;
1
+ import React from "react";
2
+ import type { BaseListItemProps, BaseListProps } from "./BaseList.types";
3
+ declare const BaseListInner: <T extends BaseListItemProps>({ dataTestId, title, headerButton, emptyStateMessage, isLoading, items, headerTransparent, itemComponent, footer, withBorder, }: BaseListProps<T>, ref: React.ForwardedRef<HTMLUListElement>) => JSX.Element;
4
+ export declare const BaseList: <T extends BaseListItemProps>(props: BaseListProps<T> & {
5
+ ref?: React.ForwardedRef<HTMLUListElement> | undefined;
6
+ }) => ReturnType<typeof BaseListInner>;
7
+ export {};
@@ -1,55 +1,55 @@
1
- import React, { Ref, ReactNode } from "react";
2
- import { PrimaryButtonProps } from "../..";
3
- import { ButtonDefinition } from "../ButtonV2/ButtonProps.type";
4
- import { IconProps } from "../Icons/types/IconProps.type";
5
- import { TitleProps } from "../Title/Title";
6
- export type BaseListItemProps = {
7
- itemId: string | number;
8
- title: string;
9
- subtitle?: string;
10
- icon?: React.FunctionComponent<IconProps> | string;
11
- accessories?: JSX.Element[];
12
- onClick?: (e: React.MouseEvent<HTMLLIElement>) => void;
13
- /** Same as onClick to be compatible with listItem */
14
- handleItemClick?: (e: React.MouseEvent<HTMLLIElement>) => void;
15
- onAssetLoadError?: (payload: OnAssetLoadErrorPayload) => void;
16
- tooltipId?: string;
17
- isSelected?: boolean;
18
- roundTop?: boolean;
19
- roundBottom?: boolean;
20
- withBorder?: boolean;
21
- isDraggable?: boolean;
22
- dataTestId?: string;
23
- ref?: Ref<HTMLLIElement>;
24
- renderDragHandle?: () => ReactNode;
25
- htmlProps?: React.HTMLProps<HTMLLIElement>;
26
- };
27
- export type OnAssetLoadErrorPayload = Pick<BaseListItemProps, "itemId" | "subtitle" | "title" | "icon">;
28
- export interface BaseListProps<T extends BaseListItemProps = BaseListItemProps> {
29
- items: T[];
30
- title?: string | TitleProps;
31
- headerButton?: ButtonDefinition<PrimaryButtonProps>;
32
- headerTransparent?: boolean;
33
- itemComponent?: React.FC<T>;
34
- emptyStateMessage?: string;
35
- isLoading?: boolean;
36
- dataTestId?: string;
37
- footer?: ReactNode;
38
- withBorder?: boolean;
39
- ref?: Ref<HTMLUListElement>;
40
- }
41
- export type BaseListHeaderProps = {
42
- title?: string | TitleProps;
43
- button?: ButtonDefinition<PrimaryButtonProps>;
44
- transparent?: boolean;
45
- withBorder?: boolean;
46
- };
47
- export type DraggableBaseListProps = Omit<BaseListProps<DraggableBaseListItemProps>, "itemComponent">;
48
- export type DraggableBaseListItemProps = BaseListItemProps & {
49
- draggableIdentifier: string;
50
- draggableData?: Record<string, unknown>;
51
- };
52
- export type SortableBaseListProps = DraggableBaseListProps & {
53
- draggableIdentifier: string;
54
- };
55
- export type SortableBaseListItemProps = DraggableBaseListItemProps;
1
+ import React, { Ref, ReactNode } from "react";
2
+ import { PrimaryButtonProps } from "../..";
3
+ import { ButtonDefinition } from "../ButtonV2/ButtonProps.type";
4
+ import { IconProps } from "../Icons/types/IconProps.type";
5
+ import { TitleProps } from "../Title/Title";
6
+ export type BaseListItemProps = {
7
+ itemId: string | number;
8
+ title: string;
9
+ subtitle?: string;
10
+ icon?: React.FunctionComponent<IconProps> | string;
11
+ accessories?: JSX.Element[];
12
+ onClick?: (e: React.MouseEvent<HTMLLIElement>) => void;
13
+ /** Same as onClick to be compatible with listItem */
14
+ handleItemClick?: (e: React.MouseEvent<HTMLLIElement>) => void;
15
+ onAssetLoadError?: (payload: OnAssetLoadErrorPayload) => void;
16
+ tooltipId?: string;
17
+ isSelected?: boolean;
18
+ roundTop?: boolean;
19
+ roundBottom?: boolean;
20
+ withBorder?: boolean;
21
+ isDraggable?: boolean;
22
+ dataTestId?: string;
23
+ ref?: Ref<HTMLLIElement>;
24
+ renderDragHandle?: () => ReactNode;
25
+ htmlProps?: React.HTMLProps<HTMLLIElement>;
26
+ };
27
+ export type OnAssetLoadErrorPayload = Pick<BaseListItemProps, "itemId" | "subtitle" | "title" | "icon">;
28
+ export interface BaseListProps<T extends BaseListItemProps = BaseListItemProps> {
29
+ items: T[];
30
+ title?: string | TitleProps;
31
+ headerButton?: ButtonDefinition<PrimaryButtonProps>;
32
+ headerTransparent?: boolean;
33
+ itemComponent?: React.FC<T>;
34
+ emptyStateMessage?: string;
35
+ isLoading?: boolean;
36
+ dataTestId?: string;
37
+ footer?: ReactNode;
38
+ withBorder?: boolean;
39
+ ref?: Ref<HTMLUListElement>;
40
+ }
41
+ export type BaseListHeaderProps = {
42
+ title?: string | TitleProps;
43
+ button?: ButtonDefinition<PrimaryButtonProps>;
44
+ transparent?: boolean;
45
+ withBorder?: boolean;
46
+ };
47
+ export type DraggableBaseListProps = Omit<BaseListProps<DraggableBaseListItemProps>, "itemComponent">;
48
+ export type DraggableBaseListItemProps = BaseListItemProps & {
49
+ draggableIdentifier: string;
50
+ draggableData?: Record<string, unknown>;
51
+ };
52
+ export type SortableBaseListProps = DraggableBaseListProps & {
53
+ draggableIdentifier: string;
54
+ };
55
+ export type SortableBaseListItemProps = DraggableBaseListItemProps;
@@ -1,9 +1,7 @@
1
- import e from "react";
2
- export declare const BaseListEmptyState: ({ message: t, roundTop: o, withBorder: r }: {
3
- message: any;
4
- roundTop: any;
5
- withBorder: any;
6
- }) => e.DetailedReactHTMLElement<{
7
- className: string;
8
- }, HTMLElement>;
9
- export default BaseListEmptyState;
1
+ import React from "react";
2
+ export declare const BaseListEmptyState: React.FC<{
3
+ message: string;
4
+ roundTop?: boolean;
5
+ withBorder?: boolean;
6
+ }>;
7
+ export default BaseListEmptyState;
@@ -1,11 +1,4 @@
1
- import p from "react";
2
- export declare const BaseListHeader: ({ title: s, button: e, transparent: r, withBorder: o }: {
3
- title: any;
4
- button: any;
5
- transparent: any;
6
- withBorder: any;
7
- }) => p.DetailedReactHTMLElement<{
8
- "data-test-id": string;
9
- className: string;
10
- }, HTMLElement>;
11
- export default BaseListHeader;
1
+ import React from "react";
2
+ import type { BaseListHeaderProps } from "./BaseList.types";
3
+ export declare const BaseListHeader: React.FC<BaseListHeaderProps>;
4
+ export default BaseListHeader;
@@ -1,7 +1,5 @@
1
- import o from "react";
2
- export declare const BaseListIcon: ({ icon: t, onAssetLoadError: e }: {
3
- icon: any;
4
- onAssetLoadError: any;
5
- }) => o.FunctionComponentElement<{
6
- children?: o.ReactNode;
7
- }>;
1
+ import React from "react";
2
+ import { BaseListItemProps } from "./BaseList.types";
3
+ export declare const BaseListIcon: React.FC<Pick<BaseListItemProps, "icon"> & {
4
+ onAssetLoadError?: () => void;
5
+ }>;
@@ -1,3 +1,4 @@
1
- import s from "react";
2
- export declare const BaseListItem: s.ForwardRefExoticComponent<s.RefAttributes<unknown>>;
3
- export default BaseListItem;
1
+ import React from "react";
2
+ import type { BaseListItemProps } from "./BaseList.types";
3
+ export declare const BaseListItem: React.FC<BaseListItemProps>;
4
+ export default BaseListItem;
@@ -1,14 +1,4 @@
1
- import b from "react";
2
- export declare const DraggableBaseList: (r: any) => b.FunctionComponentElement<{
3
- dataTestId: any;
4
- title: any;
5
- headerButton: any;
6
- emptyStateMessage: any;
7
- isLoading: any;
8
- items: any;
9
- headerTransparent: any;
10
- itemComponent: any;
11
- footer: any;
12
- withBorder?: boolean | undefined;
13
- } & b.RefAttributes<unknown>>;
14
- export default DraggableBaseList;
1
+ import React from "react";
2
+ import type { DraggableBaseListProps } from "../BaseList.types";
3
+ export declare const DraggableBaseList: React.FC<DraggableBaseListProps>;
4
+ export default DraggableBaseList;
@@ -1,2 +1,3 @@
1
- import d from "react";
2
- export declare const DraggableBaseListItem: (r: any) => d.FunctionComponentElement<d.RefAttributes<unknown>>;
1
+ import React from "react";
2
+ import { DraggableBaseListItemProps } from "../BaseList.types";
3
+ export declare const DraggableBaseListItem: React.FC<DraggableBaseListItemProps>;
@@ -1,2 +1,2 @@
1
- export { DraggableBaseList } from "./DraggableBaseList";
2
- export { DraggableBaseListItem } from "./DraggableBaseListItem";
1
+ export { DraggableBaseList } from "./DraggableBaseList";
2
+ export { DraggableBaseListItem } from "./DraggableBaseListItem";
@@ -1,4 +1,2 @@
1
- import e from "react";
2
- export declare const ListItemSkeleton: () => e.DetailedReactHTMLElement<{
3
- className: string;
4
- }, HTMLElement>;
1
+ /// <reference types="react" />
2
+ export declare const ListItemSkeleton: () => JSX.Element;