@luscii-healthtech/web-ui 7.6.2 → 7.6.3
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.
- package/README.md +66 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# WebUI
|
|
2
2
|
|
|
3
|
-
The web-ui repository contains the UI components for Luscii's
|
|
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
|
|
|
@@ -31,17 +31,73 @@ 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 opening 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
|
-
|
|
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 the `/src/components` directory.
|
|
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
|
-
|
|
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.
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
### Documentation
|
|
45
|
+
|
|
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.
|
|
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
|
+
};
|
|
68
|
+
```
|
|
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
|
+
Please see examples of other components' docs files for inspiration and try to stay consistent with how they are documented.
|
|
87
|
+
|
|
88
|
+
### Accessibility
|
|
89
|
+
|
|
90
|
+
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.
|
|
91
|
+
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.
|
|
92
|
+
|
|
93
|
+
### Testing
|
|
94
|
+
|
|
95
|
+
WebUI relies on two types of testing: Visual snapshot testing via Chromatic and interaction testing via Storybook.
|
|
96
|
+
|
|
97
|
+
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.
|
|
98
|
+
|
|
99
|
+
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.
|
|
100
|
+
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).
|
|
45
101
|
|
|
46
102
|
### Adding icons
|
|
47
103
|
|
|
@@ -79,27 +135,9 @@ We have configured at lot of magic for your convenience.
|
|
|
79
135
|
|
|
80
136
|
### On merge to main
|
|
81
137
|
|
|
82
|
-
1.
|
|
83
|
-
2.
|
|
84
|
-
3.
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## IE11
|
|
89
|
-
|
|
90
|
-
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.
|
|
91
|
-
|
|
92
|
-
It should also at least include the following polyfills to make it work:
|
|
93
|
-
|
|
94
|
-
- [core-js](https://www.npmjs.com/package/core-js)
|
|
95
|
-
- [regenerator-runtime](https://www.npmjs.com/package/regenerator-runtime)
|
|
96
|
-
- [smoothscroll-polyfill](https://www.npmjs.com/package/smoothscroll-polyfill)
|
|
97
|
-
|
|
98
|
-
Optional:
|
|
99
|
-
|
|
100
|
-
- [web-animations-js](https://www.npmjs.com/package/web-animations-js)
|
|
101
|
-
|
|
102
|
-
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.
|
|
138
|
+
1. Drafts a GitHub release.
|
|
139
|
+
2. Bumps the version of the package.
|
|
140
|
+
3. Publishes the new package version to NPM.
|
|
103
141
|
|
|
104
142
|
## Stories
|
|
105
143
|
|