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

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 (231) hide show
  1. package/README.md +116 -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/Card.d.ts +12 -9
  36. package/dist/components/Carousel/Carousel.d.ts +8 -9
  37. package/dist/components/Carousel/GliderContainer.d.ts +7 -5
  38. package/dist/components/CenteredHero/CenteredHero.d.ts +14 -12
  39. package/dist/components/CheckBoxListModal/CheckboxListModal.d.ts +30 -11
  40. package/dist/components/Checkbox/Checkbox.d.ts +64 -4
  41. package/dist/components/CheckboxList/CheckboxGroup.d.ts +3 -12
  42. package/dist/components/CheckboxList/CheckboxList.d.ts +4 -12
  43. package/dist/components/CheckboxList/CheckboxList.types.d.ts +74 -1
  44. package/dist/components/ConfirmationDialog/ConfirmationDialog.d.ts +3 -2
  45. package/dist/components/ConfirmationDialog/ConfirmationDialogChoices.d.ts +7 -4
  46. package/dist/components/ConfirmationDialog/ConfirmationDialogMessage.d.ts +4 -4
  47. package/dist/components/ConfirmationDialog/ConfirmationDialogTitle.d.ts +3 -5
  48. package/dist/components/ConfirmationDialog/types/ConfirmationDialog.types.d.ts +41 -41
  49. package/dist/components/Container/FlexColumn.d.ts +7 -15
  50. package/dist/components/Container/FlexContainer.d.ts +9 -4
  51. package/dist/components/Container/FlexRow.d.ts +7 -2
  52. package/dist/components/Container/types/FlexContainerProps.type.d.ts +26 -26
  53. package/dist/components/Divider/Divider.d.ts +6 -4
  54. package/dist/components/DragHandle/DragHandle.d.ts +7 -3
  55. package/dist/components/DragHandle/DragHandle.types.d.ts +6 -6
  56. package/dist/components/DragHandle/index.d.ts +2 -1
  57. package/dist/components/Dropzone/Dropzone.d.ts +6 -8
  58. package/dist/components/Dropzone/Dropzone.types.d.ts +33 -33
  59. package/dist/components/Dropzone/index.d.ts +2 -1
  60. package/dist/components/EmptyListMessage/EmptyListMessage.d.ts +14 -10
  61. package/dist/components/FilterBar/ActiveFilters.d.ts +9 -0
  62. package/dist/components/FilterBar/FilterBar.d.ts +96 -0
  63. package/dist/components/FilterBar/FilterBar.utils.d.ts +32 -0
  64. package/dist/components/FilterBar/FilterBarProps.type.d.ts +86 -0
  65. package/dist/components/FilterBar/FiltersMenus.d.ts +8 -0
  66. package/dist/components/FilterBar/SortMenu.d.ts +9 -0
  67. package/dist/components/FilterBar/index.d.ts +2 -0
  68. package/dist/components/Form/Form.d.ts +30 -15
  69. package/dist/components/Form/FormFieldCheckbox.d.ts +9 -2
  70. package/dist/components/Form/FormFieldCheckboxList.d.ts +9 -15
  71. package/dist/components/Form/FormFieldErrorMessages.d.ts +8 -4
  72. package/dist/components/Form/FormFieldLabeler.d.ts +8 -12
  73. package/dist/components/Form/FormImagePicker.d.ts +9 -2
  74. package/dist/components/Form/FormInput.d.ts +14 -2
  75. package/dist/components/Form/FormRadioGroup.d.ts +13 -2
  76. package/dist/components/Form/FormSelect.d.ts +10 -2
  77. package/dist/components/Form/FormTextarea.d.ts +14 -2
  78. package/dist/components/Form/form.transformer.d.ts +3 -1
  79. package/dist/components/Form/form.types.d.ts +92 -91
  80. package/dist/components/Icon/Icon.d.ts +17 -3
  81. package/dist/components/Icon/index.d.ts +1 -1
  82. package/dist/components/Icons/AddIcon.d.ts +4 -3
  83. package/dist/components/Icons/AlertsIcon.d.ts +4 -3
  84. package/dist/components/Icons/BellIcon.d.ts +4 -3
  85. package/dist/components/Icons/BluetoothIcon.d.ts +4 -3
  86. package/dist/components/Icons/ChartIcon.d.ts +4 -3
  87. package/dist/components/Icons/ChartLineColoredIcon.d.ts +4 -3
  88. package/dist/components/Icons/ChatBoxIcon.d.ts +4 -3
  89. package/dist/components/Icons/CheckIcon.d.ts +4 -3
  90. package/dist/components/Icons/ChevronDoubleIcon.d.ts +4 -3
  91. package/dist/components/Icons/ChevronDownIcon.d.ts +4 -3
  92. package/dist/components/Icons/ChevronRightIcon.d.ts +4 -3
  93. package/dist/components/Icons/CrossIcon.d.ts +4 -3
  94. package/dist/components/Icons/DeleteIcon.d.ts +4 -3
  95. package/dist/components/Icons/DownArrowIcon.d.ts +4 -3
  96. package/dist/components/Icons/DragIcon.d.ts +4 -3
  97. package/dist/components/Icons/EditIcon.d.ts +4 -3
  98. package/dist/components/Icons/EmptyIcon.d.ts +4 -3
  99. package/dist/components/Icons/EmptyStateDashboardIcon.d.ts +4 -3
  100. package/dist/components/Icons/ExclamationMarkIcon.d.ts +4 -3
  101. package/dist/components/Icons/EyeIcon.d.ts +4 -3
  102. package/dist/components/Icons/EyeIconSlashed.d.ts +4 -0
  103. package/dist/components/Icons/GearColoredIcon.d.ts +4 -3
  104. package/dist/components/Icons/GearIcon.d.ts +4 -3
  105. package/dist/components/Icons/GroupColoredIcon.d.ts +4 -3
  106. package/dist/components/Icons/GroupIcon.d.ts +4 -3
  107. package/dist/components/Icons/HamburgerIcon.d.ts +4 -3
  108. package/dist/components/Icons/HeartIcon.d.ts +4 -3
  109. package/dist/components/Icons/ImageIcon.d.ts +4 -3
  110. package/dist/components/Icons/InfoIcon.d.ts +4 -3
  111. package/dist/components/Icons/LeftArrowIcon.d.ts +4 -3
  112. package/dist/components/Icons/LightBulbIcon.d.ts +4 -3
  113. package/dist/components/Icons/LinkIcon.d.ts +4 -3
  114. package/dist/components/Icons/LockIcon.d.ts +4 -3
  115. package/dist/components/Icons/MessagesIcon.d.ts +4 -3
  116. package/dist/components/Icons/MouseIcon.d.ts +4 -3
  117. package/dist/components/Icons/NotesIcon.d.ts +4 -3
  118. package/dist/components/Icons/PageViewIcon.d.ts +4 -0
  119. package/dist/components/Icons/PinIcon.d.ts +4 -3
  120. package/dist/components/Icons/PrintIcon.d.ts +4 -3
  121. package/dist/components/Icons/RightArrowIcon.d.ts +4 -3
  122. package/dist/components/Icons/SearchCancelIcon.d.ts +4 -3
  123. package/dist/components/Icons/SearchIcon.d.ts +4 -3
  124. package/dist/components/Icons/SmallCircleIcon.d.ts +4 -3
  125. package/dist/components/Icons/SmallDiamondIcon.d.ts +4 -3
  126. package/dist/components/Icons/SmallSquareIcon.d.ts +4 -3
  127. package/dist/components/Icons/SpaceRocketIcon.d.ts +4 -3
  128. package/dist/components/Icons/StarIcon.d.ts +4 -3
  129. package/dist/components/Icons/StatusColoredIcon.d.ts +4 -3
  130. package/dist/components/Icons/WarningIcon.d.ts +4 -3
  131. package/dist/components/Icons/iconWrapper/iconWrapper.d.ts +4 -3
  132. package/dist/components/Icons/iconWrapper/index.d.ts +1 -1
  133. package/dist/components/Icons/index.d.ts +49 -47
  134. package/dist/components/Icons/templates/component.d.ts +3 -3
  135. package/dist/components/Icons/templates/index.d.ts +2 -2
  136. package/dist/components/Icons/types/IconProps.type.d.ts +8 -8
  137. package/dist/components/Image/Image.d.ts +10 -5
  138. package/dist/components/InfoField/InfoField.d.ts +28 -9
  139. package/dist/components/Input/Input.d.ts +57 -10
  140. package/dist/components/Input/SearchInput.d.ts +24 -2
  141. package/dist/components/Link/Link.d.ts +19 -0
  142. package/dist/components/List/List.d.ts +6 -5
  143. package/dist/components/List/List.types.d.ts +19 -19
  144. package/dist/components/List/ListItem.d.ts +4 -3
  145. package/dist/components/List/index.d.ts +5 -3
  146. package/dist/components/LoadingIndicator/LoadingIndicator.d.ts +12 -4
  147. package/dist/components/MediaPicker/ImageCategory.d.ts +14 -0
  148. package/dist/components/MediaPicker/MediaPicker.d.ts +95 -0
  149. package/dist/components/Modal/FullPageModal.d.ts +39 -29
  150. package/dist/components/Modal/FullPageModalHeader.d.ts +13 -7
  151. package/dist/components/Modal/Modal.d.ts +6 -2
  152. package/dist/components/Modal/ModalBase.d.ts +16 -5
  153. package/dist/components/Modal/ModalFooter.d.ts +12 -4
  154. package/dist/components/Modal/ModalHeader.d.ts +6 -4
  155. package/dist/components/Modal/subcomponents/FullPageModalActions.d.ts +18 -0
  156. package/dist/components/NavMenu/NavLayout.d.ts +20 -4
  157. package/dist/components/NavMenu/NavMenu.d.ts +16 -4
  158. package/dist/components/NavMenu/NavMenuContent.d.ts +3 -11
  159. package/dist/components/NavMenu/NavMenuFooter.d.ts +3 -8
  160. package/dist/components/NavMenu/NavMenuHeader.d.ts +3 -7
  161. package/dist/components/NavMenu/NavMenuItem.d.ts +3 -9
  162. package/dist/components/NavMenu/types/NavMenuFooterProps.type.d.ts +5 -5
  163. package/dist/components/NavMenu/types/NavMenuHeaderProps.type.d.ts +5 -5
  164. package/dist/components/NavMenu/types/NavMenuItemProps.type.d.ts +11 -11
  165. package/dist/components/NotificationBanner/NotificationBanner.d.ts +41 -12
  166. package/dist/components/Page/CRUDPage.d.ts +4 -17
  167. package/dist/components/Page/CRUDPage.types.d.ts +32 -32
  168. package/dist/components/Page/index.d.ts +3 -2
  169. package/dist/components/PageHeader/PageHeader.d.ts +4 -17
  170. package/dist/components/PageHeader/PageHeader.types.d.ts +28 -28
  171. package/dist/components/PageHeader/index.d.ts +2 -1
  172. package/dist/components/PaginationMenu/PaginationMenu.d.ts +3 -4
  173. package/dist/components/PaginationMenu/PaginationMenu.types.d.ts +37 -0
  174. package/dist/components/PaginationMenu/PaginationMenu.utils.d.ts +15 -4
  175. package/dist/components/PaginationMenu/PaginationMenuLarge.d.ts +3 -4
  176. package/dist/components/PaginationMenu/PaginationMenuSmall.d.ts +3 -4
  177. package/dist/components/PreviewPhone/PreviewPhone.d.ts +7 -11
  178. package/dist/components/Radio/RadioV2.d.ts +17 -3
  179. package/dist/components/RadioGroup/RadioGroupV2.d.ts +10 -2
  180. package/dist/components/Section/Section.d.ts +25 -4
  181. package/dist/components/Section/SectionItem.d.ts +9 -4
  182. package/dist/components/Section/SectionItemWithContent.d.ts +9 -3
  183. package/dist/components/Section/subcomponents/SectionActions.d.ts +21 -21
  184. package/dist/components/Select/Select.d.ts +46 -3
  185. package/dist/components/Select/SelectDropdownIndicator.d.ts +3 -2
  186. package/dist/components/Select/SelectLoadingIndicator.d.ts +3 -2
  187. package/dist/components/SettingsMenuButton/SettingsMenuButton.d.ts +19 -5
  188. package/dist/components/Spinner/Spinner.d.ts +6 -2
  189. package/dist/components/Steps/Step.d.ts +10 -9
  190. package/dist/components/Steps/Steps.d.ts +10 -9
  191. package/dist/components/TabLinks/TabLinks.d.ts +14 -10
  192. package/dist/components/Tabbar/Tabbar.d.ts +18 -13
  193. package/dist/components/Tabbar/TabbarItem.d.ts +16 -16
  194. package/dist/components/Table/Table.d.ts +16 -2
  195. package/dist/components/Table/Table.types.d.ts +43 -0
  196. package/dist/components/Table/Table.utils.d.ts +3 -2
  197. package/dist/components/Table/TableBody.d.ts +13 -4
  198. package/dist/components/Table/TableBodyRow.d.ts +10 -6
  199. package/dist/components/Table/TableBodyRowDataCell.d.ts +8 -4
  200. package/dist/components/Table/TableFooter.d.ts +8 -2
  201. package/dist/components/Table/TableHeader.d.ts +7 -4
  202. package/dist/components/Tag/Tag.d.ts +17 -12
  203. package/dist/components/Tag/Tag.utils.d.ts +4 -1
  204. package/dist/components/Tag/TagGroup.d.ts +10 -9
  205. package/dist/components/Text/Text.d.ts +115 -24
  206. package/dist/components/TextEditor/TextEditor.d.ts +17 -0
  207. package/dist/components/TextLink/TextLink.d.ts +14 -8
  208. package/dist/components/Textarea/Textarea.d.ts +29 -3
  209. package/dist/components/Timeline/Timeline.d.ts +14 -12
  210. package/dist/components/Timeline/TimelineHeader.d.ts +10 -10
  211. package/dist/components/Timeline/TimelineStep.d.ts +10 -2
  212. package/dist/components/Title/Title.d.ts +17 -8
  213. package/dist/components/Toaster/Toaster.d.ts +17 -19
  214. package/dist/components/Toaster/toast-elements-getter.d.ts +22 -9
  215. package/dist/components/Toaster/toast-progress-animator.d.ts +12 -1
  216. package/dist/components/Toaster/toast.d.ts +12 -5
  217. package/dist/components/ViewItem/ViewItem.d.ts +16 -3
  218. package/dist/index.d.ts +83 -78
  219. package/dist/index.development.js +5678 -0
  220. package/dist/index.development.js.map +1 -0
  221. package/dist/index.js +1 -1356
  222. package/dist/index.js.map +1 -1
  223. package/dist/types/general.types.d.ts +8 -8
  224. package/dist/utils/string.utils.d.ts +7 -1
  225. package/dist/web-ui-tailwind.css +909 -471
  226. package/dist/web-ui.esm.js +1 -1356
  227. package/dist/web-ui.esm.js.map +1 -1
  228. package/package.json +45 -50
  229. package/dist/components/CheckboxList/CheckboxListItem.d.ts +0 -13
  230. package/dist/components/ImagePicker/ImageCategory.d.ts +0 -4
  231. package/dist/components/ImagePicker/ImagePicker.d.ts +0 -17
package/README.md CHANGED
@@ -1,23 +1,23 @@
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
4
 
5
5
  ## Running locally
6
6
 
7
- If you want to run storybook locally you can use
7
+ If you want to run Storybook locally you can use:
8
8
 
9
9
  ```bash
10
10
  yarn install
11
- yarn storybook
11
+ yarn dev # runs a Tailwind watcher and Storybook
12
12
  ```
13
13
 
14
14
  ## Testing your production build
15
15
 
16
16
  Assuming the following setup:
17
17
 
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`
18
+ - The `web-ui` and `cVitals-Web` repositories are siblings in the same folder.
19
+ - You ran `yarn install` in `cVitals-Web`.
20
+ - You ran `yarn build` in `web-ui`.
21
21
 
22
22
  Run the script below in your terminal, _in the parent folder of the repositories_.
23
23
 
@@ -31,79 +31,149 @@ Or use the shortcut:
31
31
  yarn test-copy-build
32
32
  ```
33
33
 
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.
34
+ 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
35
 
36
36
  ## Contributing
37
37
 
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.
38
+ Thank you for your help in keeping our component library organized and easy to use!
39
39
 
40
- If you want to add components, do so in
40
+ 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
41
 
42
- ```
43
- /src/components
44
- ```
42
+ 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
43
 
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.
44
+ ### Documentation
47
45
 
48
- When you create new components, you must add them to storybook as well. Stories go in
46
+ 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
47
 
48
+ Component documentation should include the following parts:
49
+
50
+ - A short explanation of each prop in a JSDoc comment style.
51
+ - A stories file (`<ComponentName>.stories.tsx`).
52
+ - A docs file (`<ComponentName>.docs.mdx`).
53
+
54
+ Below is an explanation of each.
55
+
56
+ #### Props documented via JSDoc comments
57
+
58
+ 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.
59
+
60
+ ```ts
61
+ type Props = {
62
+ /**
63
+ * Optional description that will be shown close to the label, used to provide more
64
+ * detail about the field next to the concise text of the label.
65
+ */
66
+ helperText?: string;
67
+ };
50
68
  ```
51
- /stories
52
- ```
69
+
70
+ #### Stories file
71
+
72
+ 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.
73
+ 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.
74
+
75
+ You can find the Chromatic project for WebUI [here](https://www.chromatic.com/library?appId=62b0c4d5afd432f7ee70a740).
76
+
77
+ #### Docs file
78
+
79
+ The component docs file brings everything together and should be considered the source of truth about the component. What should be documented:
80
+
81
+ - Why we have the component and where it should be used.
82
+ - An overview of the different variants and states.
83
+ - Usage guidelines of when and where to use the component.
84
+ - Best practices to show what to do and what not do when working with the component.
85
+
86
+ > 🔎 If you need to e.g. create a story to show how NOT to use a component, you might not want
87
+ > to create a snapshot for that component or show it in the sidebar of Storybook. To omit a story
88
+ > from snapshots, add the following to its parameters:
89
+ >
90
+ > ```ts
91
+ > chromatic: { disableSnapshot: true },
92
+ > ```
93
+ >
94
+ > To hide a story from the sidebar, prefix the story (variable) name
95
+ > with `HIDE_`.
96
+
97
+ Please see examples of other components' docs files for inspiration and try to stay consistent with how they are documented.
98
+
99
+ ### Accessibility
100
+
101
+ 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.
102
+ 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.
103
+
104
+ ### Testing
105
+
106
+ WebUI relies on two types of testing: Visual snapshot testing via Chromatic and interaction testing via Storybook.
107
+
108
+ 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.
109
+
110
+ 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.
111
+ 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
112
 
54
113
  ### Adding icons
55
114
 
56
- Add new icons by:
115
+ Add new icons by following these steps:
57
116
 
58
- - Add the svg file(s) in `src/components/Icons/icons`
59
- - Run `yarn icons`
117
+ - Add the svg file(s) in `src/components/Icons/icons`.
118
+ - Run `yarn icons`.
60
119
 
61
120
  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
121
 
63
122
  ## CI setup
64
123
 
65
- #### Branching
124
+ ### Branching
66
125
 
67
- The `main` branch is our default branch. When you contribute, branch from there and name your branch
126
+ The `main` branch is our default branch. When you contribute, branch from there and use the following branch naming convention:
68
127
 
69
128
  ```
70
- //Branch names convention (enforced)
129
+ // Branch naming convention (enforced)
71
130
 
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
131
+ major/* // For a new design system or changes that effect our foundations (e.g. typography, color).
132
+ minor/* // For new components and stories.
133
+ patch/* // For small improvements to existing components or stories.
134
+ bug/* // For bugs or fixes.
135
+ chore/* // For things related to development that don't impact the output for consumers and/or users.
76
136
  ```
77
137
 
78
138
  We have configured at lot of magic for your convenience.
79
139
 
80
- #### On every PR
140
+ ### On every PR
81
141
 
82
- 1. the module build, lint and tests are checked.
83
- 2. The storybook build is published to chromatic.
142
+ 1. The module build, lint and tests are checked.
143
+ 2. The Storybook build is published to Chromatic.
84
144
  3. Labels are added based on the branch name and PR size.
85
- 4. Branch names must follow the convention and are checked
86
-
87
- #### On merge to main
145
+ 4. Branch names must follow the convention and are checked.
88
146
 
89
- 1. Draft a github release
90
- 2. Version bump of the package
91
- 3. Publish new package to NPM
147
+ ### On merge to main
92
148
 
93
- ---
149
+ 1. Drafts a GitHub release.
150
+ 2. Bumps the version of the package.
151
+ 3. Publishes the new package version to NPM.
94
152
 
95
- ## IE11
153
+ ## Stories
96
154
 
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.
155
+ ### Stories using deprecated props
98
156
 
99
- It should also at least include the following polyfills to make it work:
157
+ 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.
100
158
 
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)
159
+ For example a story of a `FullPageModal` component using the deprecated `primaryButtonProps` prop would look like this:
104
160
 
105
- Optional:
161
+ ```tsx
162
+ import { BADGES } from "../.storybook/constants";
106
163
 
107
- - [web-animations-js](https://www.npmjs.com/package/web-animations-js)
164
+ export const DeprecatedWithPrimaryButtonProps = {
165
+ render: OneColumTemplate,
166
+ args: {
167
+ isOpen: true,
168
+ primaryButtonProps: {
169
+ onClick: action("onClick Primary Button"),
170
+ text: "Primary",
171
+ },
172
+ },
173
+ parameters: {
174
+ badges: [BADGES.DEPRECATED],
175
+ },
176
+ };
177
+ ```
108
178
 
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.
179
+ 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;
@@ -1,9 +1,8 @@
1
- import e from "react";
2
- import "./ListSkeleton.scss";
3
- export declare const ListSkeleton: ({ items: t, dataTestId: s }: {
4
- items: any;
5
- dataTestId?: string | undefined;
6
- }) => e.DetailedReactHTMLElement<{
7
- "data-test-id": string;
8
- className: string;
9
- }, HTMLElement>;
1
+ /// <reference types="react" />
2
+ import "./ListSkeleton.scss";
3
+ type ListSkeletonProps = {
4
+ items: number;
5
+ dataTestId?: string;
6
+ };
7
+ export declare const ListSkeleton: ({ items, dataTestId, }: ListSkeletonProps) => JSX.Element;
8
+ export {};
@@ -1,3 +1,4 @@
1
- import f from "react";
2
- export declare const SortableBaseList: (o: any) => f.DetailedReactHTMLElement<f.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
3
- export default SortableBaseList;
1
+ import React from "react";
2
+ import type { SortableBaseListProps } from "../BaseList.types";
3
+ export declare const SortableBaseList: React.FC<SortableBaseListProps>;
4
+ export default SortableBaseList;
@@ -1,7 +1,3 @@
1
- import i from "react";
2
- export declare const SortableBaseListItem: (a: any) => i.FunctionComponentElement<i.RefAttributes<unknown>> | i.DetailedReactHTMLElement<{
3
- style: {
4
- transform: string | undefined;
5
- position: "relative";
6
- };
7
- }, HTMLElement>;
1
+ import React from "react";
2
+ import { SortableBaseListItemProps } from "../BaseList.types";
3
+ export declare const SortableBaseListItem: React.FC<SortableBaseListItemProps>;
@@ -1,2 +1,2 @@
1
- export { SortableBaseList } from "./SortableBaseList";
2
- export { SortableBaseListItem } from "./SortableBaseListItem";
1
+ export { SortableBaseList } from "./SortableBaseList";
2
+ export { SortableBaseListItem } from "./SortableBaseListItem";