@luscii-healthtech/web-ui 0.0.0-alpha.ab3fdb2 → 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.
- package/README.md +175 -46
- package/dist/components/AccordionList/AccordionList.d.ts +11 -1
- package/dist/components/AccordionList/subcomponents/AccordionListActions.d.ts +18 -0
- package/dist/components/Card/Actions.d.ts +2 -0
- package/dist/components/Card/Card.d.ts +54 -9
- package/dist/components/Card/Padding.d.ts +6 -0
- package/dist/components/Card/Section.d.ts +6 -0
- package/dist/components/Card/TopBar.d.ts +9 -0
- package/dist/components/Checkbox/Checkbox.d.ts +46 -1
- package/dist/components/CheckboxList/CheckboxGroup.d.ts +1 -1
- package/dist/components/CheckboxList/CheckboxList.d.ts +1 -2
- package/dist/components/CheckboxList/CheckboxList.types.d.ts +35 -13
- package/dist/components/Container/types/FlexContainerProps.type.d.ts +2 -2
- package/dist/components/Divider/Divider.d.ts +1 -1
- package/dist/components/FilterBar/ActiveFilters.d.ts +9 -0
- package/dist/components/FilterBar/FilterBar.d.ts +96 -0
- package/dist/components/FilterBar/FilterBar.utils.d.ts +32 -0
- package/dist/components/FilterBar/FilterBarProps.type.d.ts +86 -0
- package/dist/components/FilterBar/FiltersMenus.d.ts +8 -0
- package/dist/components/FilterBar/SortMenu.d.ts +9 -0
- package/dist/components/FilterBar/index.d.ts +2 -0
- package/dist/components/Form/FormImagePicker.d.ts +3 -3
- package/dist/components/Form/form.types.d.ts +9 -8
- package/dist/components/Icon/Icon.d.ts +1 -1
- package/dist/components/Icons/ClockIcon.d.ts +4 -0
- package/dist/components/Icons/ExportIcon.d.ts +4 -0
- package/dist/components/Icons/EyeIconSlashed.d.ts +4 -0
- package/dist/components/Icons/PageViewIcon.d.ts +4 -0
- package/dist/components/Icons/RobotIcon.d.ts +4 -0
- package/dist/components/Icons/index.d.ts +5 -0
- package/dist/components/InfoField/InfoField.d.ts +19 -9
- package/dist/components/Input/Input.d.ts +1 -2
- package/dist/components/Input/SearchInput.d.ts +23 -3
- package/dist/components/Link/Link.d.ts +19 -0
- package/dist/components/{ImagePicker → MediaPicker}/ImageCategory.d.ts +2 -2
- package/dist/components/MediaPicker/MediaPicker.d.ts +91 -0
- package/dist/components/Modal/FullPageModal.d.ts +31 -1
- package/dist/components/Modal/FullPageModalHeader.d.ts +6 -0
- package/dist/components/Modal/Modal.d.ts +6 -1
- package/dist/components/Modal/subcomponents/FullPageModalActions.d.ts +18 -0
- package/dist/components/NavMenu/NavLayout.d.ts +30 -15
- package/dist/components/NavMenu/types/NavMenuHeaderProps.type.d.ts +6 -0
- package/dist/components/NotificationBanner/NotificationBanner.d.ts +1 -1
- package/dist/components/Page/CRUDPage.types.d.ts +1 -1
- package/dist/components/PreviewPhone/PreviewPhone.d.ts +1 -1
- package/dist/components/Section/Section.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +9 -3
- package/dist/components/Spinner/Spinner.d.ts +2 -2
- package/dist/components/Table/Table.types.d.ts +1 -2
- package/dist/components/Tag/Tag.d.ts +23 -14
- package/dist/components/Tag/TagGroup.d.ts +22 -9
- package/dist/components/Text/Text.d.ts +78 -29
- package/dist/components/TextEditor/TextEditor.d.ts +53 -0
- package/dist/components/TextLink/TextLink.d.ts +3 -0
- package/dist/components/Textarea/Textarea.d.ts +4 -0
- package/dist/components/Timeline/TimelineHeader.d.ts +1 -1
- package/dist/components/Title/Title.d.ts +18 -4
- package/dist/components/Toaster/toast-progress-animator.d.ts +1 -1
- package/dist/components/UnorderedList/UnorderedList.d.ts +61 -0
- package/dist/components/WeekdaysPicker/WeekdaysPicker.d.ts +42 -0
- package/dist/index.d.ts +13 -13
- package/dist/index.development.js +5843 -0
- package/dist/index.development.js.map +1 -0
- package/dist/index.js +1 -1356
- package/dist/index.js.map +1 -1
- package/dist/web-ui-tailwind.css +996 -532
- package/dist/web-ui.esm.js +1 -1356
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +52 -54
- package/dist/components/CheckboxList/CheckboxListItem.d.ts +0 -3
- package/dist/components/Icons/templates/component.d.ts +0 -3
- package/dist/components/Icons/templates/index.d.ts +0 -2
- package/dist/components/ImagePicker/ImagePicker.d.ts +0 -29
- package/dist/components/TabLinks/TabLinks.d.ts +0 -14
- package/dist/components/Tag/Tag.utils.d.ts +0 -4
package/README.md
CHANGED
|
@@ -1,23 +1,82 @@
|
|
|
1
|
-
#
|
|
1
|
+
# WebUI
|
|
2
2
|
|
|
3
|
-
The web-ui repository contains the
|
|
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
|
|
66
|
+
If you want to run Storybook locally you can use:
|
|
8
67
|
|
|
9
68
|
```bash
|
|
10
69
|
yarn install
|
|
11
|
-
yarn
|
|
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
|
|
19
|
-
- You
|
|
20
|
-
- You
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
103
|
+
### Documentation
|
|
47
104
|
|
|
48
|
-
|
|
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
|
-
|
|
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
|
-
|
|
183
|
+
### Branching
|
|
66
184
|
|
|
67
|
-
The `main` branch is our default branch. When you contribute, branch from there and
|
|
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
|
|
188
|
+
// Branch naming convention (enforced)
|
|
71
189
|
|
|
72
|
-
major/* //
|
|
73
|
-
minor/* //
|
|
74
|
-
patch/* //
|
|
75
|
-
bug/* //
|
|
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
|
-
|
|
199
|
+
### On every PR
|
|
81
200
|
|
|
82
|
-
1.
|
|
83
|
-
2. The
|
|
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
|
-
|
|
206
|
+
### On merge to main
|
|
88
207
|
|
|
89
|
-
1.
|
|
90
|
-
2.
|
|
91
|
-
3.
|
|
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
|
-
|
|
214
|
+
### Stories using deprecated props
|
|
96
215
|
|
|
97
|
-
|
|
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
|
-
|
|
218
|
+
For example a story of a `FullPageModal` component using the deprecated `primaryButtonProps` prop would look like this:
|
|
100
219
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
- [smoothscroll-polyfill](https://www.npmjs.com/package/smoothscroll-polyfill)
|
|
220
|
+
```tsx
|
|
221
|
+
import { BADGES } from "../.storybook/constants";
|
|
104
222
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
|
238
|
+
This groups deprecated stories together and will make it easier to remove them later on.
|
|
@@ -3,6 +3,7 @@ import { AccordionProps } from "../Accordion/Accordion";
|
|
|
3
3
|
import { DraggableListProps, ListItemProps, SortableListProps } from "../List/List.types";
|
|
4
4
|
import { AccordionItemProps } from "../Accordion/AccordionItem";
|
|
5
5
|
import { BaseButtonProps } from "../ButtonV2/ButtonProps.type";
|
|
6
|
+
import { AccordionListActions } from "./subcomponents/AccordionListActions";
|
|
6
7
|
export interface AccordionListProps extends Omit<AccordionProps, "items"> {
|
|
7
8
|
localisations: {
|
|
8
9
|
title: string;
|
|
@@ -10,9 +11,15 @@ export interface AccordionListProps extends Omit<AccordionProps, "items"> {
|
|
|
10
11
|
emptyListText?: string;
|
|
11
12
|
};
|
|
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
|
+
*/
|
|
13
19
|
buttonProps?: BaseButtonProps;
|
|
14
20
|
isSearchEnabled?: boolean;
|
|
15
21
|
isLoading?: boolean;
|
|
22
|
+
actions?: React.ReactNode;
|
|
16
23
|
}
|
|
17
24
|
export type AccordionListItemProps<T = ListItemProps> = Omit<AccordionItemProps, "content"> & {
|
|
18
25
|
listItems: T[];
|
|
@@ -28,5 +35,8 @@ export type SortableAccordionListItemProps = Omit<AccordionItemProps, "content">
|
|
|
28
35
|
listItems: SortableListProps["items"];
|
|
29
36
|
};
|
|
30
37
|
export type AccordionItem = AccordionListItemProps | DraggableAccordionListItemProps | SortableAccordionListItemProps;
|
|
31
|
-
|
|
38
|
+
interface StaticComponents {
|
|
39
|
+
Actions: typeof AccordionListActions;
|
|
40
|
+
}
|
|
41
|
+
export declare const AccordionList: React.FC<AccordionListProps> & StaticComponents;
|
|
32
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,12 +1,57 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
import { TitleProps } from "../Title/Title";
|
|
3
|
+
type TitleAndMaybeActions = {
|
|
3
4
|
title: string;
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Spaces and positions the action components correctly in relation to
|
|
7
|
+
* the styling of the card.
|
|
8
|
+
*
|
|
9
|
+
* @usage
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <Card
|
|
12
|
+
* actions={
|
|
13
|
+
* <Card.Actions>
|
|
14
|
+
* <PrimaryButton />
|
|
15
|
+
* <SecondaryButton />
|
|
16
|
+
* </Card.Actions>
|
|
17
|
+
* }
|
|
18
|
+
* />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
actions: React.ReactNode;
|
|
22
|
+
} | {
|
|
23
|
+
title: undefined;
|
|
24
|
+
actions: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
title?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The `actions` prop can only be used in conjunction with the `title` prop.
|
|
29
|
+
*/
|
|
30
|
+
actions?: never;
|
|
6
31
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
32
|
+
export type Props<C extends React.ElementType> = React.ComponentPropsWithoutRef<C> & {
|
|
33
|
+
as?: C;
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Whether or not to add the default padding to the card. Set this
|
|
37
|
+
* to `false` if you want to render something full width inside of the
|
|
38
|
+
* card, like an image or a list. You have access to the `Card.Padding`
|
|
39
|
+
* subcomponent to then add back the default padding wherever needed.
|
|
40
|
+
*
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
padding?: boolean;
|
|
44
|
+
} & TitleAndMaybeActions;
|
|
45
|
+
export declare function Card<C extends React.ElementType = "div">(props: Props<C>): React.JSX.Element;
|
|
46
|
+
export declare namespace Card {
|
|
47
|
+
var Title: (props: TitleProps) => React.JSX.Element;
|
|
48
|
+
var TopBar: typeof import("./TopBar").TopBar;
|
|
49
|
+
var Padding: React.FC<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
50
|
+
children?: React.ReactNode;
|
|
51
|
+
}>;
|
|
52
|
+
var Section: React.FC<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
53
|
+
children?: React.ReactNode;
|
|
54
|
+
}>;
|
|
55
|
+
var Actions: React.FC<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">>;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Props = React.ComponentPropsWithoutRef<"div"> & {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
};
|
|
5
|
+
export declare function TopBar(props: Props): React.JSX.Element;
|
|
6
|
+
export declare namespace TopBar {
|
|
7
|
+
var Actions: React.FC<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">>;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -1,19 +1,64 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./Checkbox.scss";
|
|
3
3
|
export interface CheckboxProps {
|
|
4
|
+
/**
|
|
5
|
+
* ID used for semantic targeting, as can be used in attributes like `<label htmlFor="some-id">`.
|
|
6
|
+
*/
|
|
4
7
|
id?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The visible text labeling the checkbox element.
|
|
10
|
+
*/
|
|
5
11
|
text?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Helper text that adds some more information on what the option means, or inform
|
|
14
|
+
* the user about the consequences of the checkbox.
|
|
15
|
+
*
|
|
16
|
+
* Only works if the `renderLabel` prop isn't set.
|
|
17
|
+
*/
|
|
6
18
|
explanation?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Shows a different checkbox variant. `type="switch"` shows a switch-like component
|
|
21
|
+
* without a visual label.
|
|
22
|
+
*/
|
|
7
23
|
type?: "regular" | "switch";
|
|
24
|
+
/**
|
|
25
|
+
* Set the value.
|
|
26
|
+
* Same as `checked` on `<input type="checkbox" />`.
|
|
27
|
+
*/
|
|
8
28
|
isChecked?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Value for when it is not clear if the state of this checkbox
|
|
31
|
+
* is "checked" or not (for hierarchical checkboxes).
|
|
32
|
+
*/
|
|
9
33
|
isIndeterminate?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Disallow the user to change the checkbox value.
|
|
36
|
+
* Same as `disabled` on `<input type="checkbox" />`.
|
|
37
|
+
*/
|
|
10
38
|
isDisabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The name that the value of the checkbox will be associated with.
|
|
41
|
+
* Same as `name` on `<input type="checkbox" />`.
|
|
42
|
+
*/
|
|
11
43
|
name?: string;
|
|
44
|
+
/**
|
|
45
|
+
* This can be used to retrieve the value it is referring to through onChange.
|
|
46
|
+
*/
|
|
12
47
|
value?: string;
|
|
13
48
|
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
14
49
|
className?: string;
|
|
50
|
+
classNameCheckboxLabel?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Visually show that the currently selected value has an issue the user needs to attend to.
|
|
53
|
+
*/
|
|
15
54
|
error?: boolean;
|
|
16
55
|
innerRef?: React.Ref<HTMLInputElement>;
|
|
56
|
+
/**
|
|
57
|
+
* Renders a completely custom label. Can change its contents or
|
|
58
|
+
* appearance based on the props of the checkbox item.
|
|
59
|
+
*
|
|
60
|
+
* Overrides the `text` prop.
|
|
61
|
+
*/
|
|
62
|
+
renderLabel?: (props: CheckboxProps) => JSX.Element | null;
|
|
17
63
|
}
|
|
18
64
|
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
19
|
-
export default Checkbox;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CheckboxGroupProps } from "./CheckboxList.types";
|
|
3
|
-
export declare const CheckboxGroup: ({ title, items, onChange, className,
|
|
3
|
+
export declare const CheckboxGroup: ({ title, items, onChange, className, isCollapsed, collapsible, }: CheckboxGroupProps) => JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CheckboxListProps } from "./CheckboxList.types";
|
|
3
3
|
export { CheckboxListProps };
|
|
4
|
-
export declare const CheckboxList: ({ groups, onChange, className,
|
|
5
|
-
export default CheckboxList;
|
|
4
|
+
export declare const CheckboxList: ({ groups, onChange, className, }: CheckboxListProps) => JSX.Element;
|
|
@@ -4,34 +4,47 @@ export declare enum CheckboxState {
|
|
|
4
4
|
UNCHECKED = "unchecked"
|
|
5
5
|
}
|
|
6
6
|
export interface CheckboxListProps {
|
|
7
|
+
/**
|
|
8
|
+
* An array of items to render as checkboxes. Each item can be a single item or a group. When the
|
|
9
|
+
* title isn't specified, the group will render as a non-collapsible list. This is the way to
|
|
10
|
+
* render a regular list of checkboxes.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* Single list of checkboxes without visual grouping.
|
|
14
|
+
*
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const groups = [{
|
|
17
|
+
* items: [
|
|
18
|
+
* {
|
|
19
|
+
* id: "1",
|
|
20
|
+
* label: "Item 1",
|
|
21
|
+
* },
|
|
22
|
+
* {
|
|
23
|
+
* id: "2",
|
|
24
|
+
* label: "Item 2",
|
|
25
|
+
* },
|
|
26
|
+
* ],
|
|
27
|
+
* }]
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
7
30
|
groups: CheckboxGroup[];
|
|
8
31
|
onChange: (event: CheckboxChangeEvent) => void;
|
|
9
|
-
hasDividers?: boolean;
|
|
10
32
|
className?: string;
|
|
11
33
|
}
|
|
12
34
|
type WithCollapsible = {
|
|
13
35
|
/**
|
|
14
|
-
* When `false
|
|
36
|
+
* When `false` will prevent the checkbox list from being collapsed (also disabling clicking to expand/collapse)
|
|
15
37
|
* in the component and it will be displayed expanded by default.
|
|
16
38
|
* @default true
|
|
17
39
|
*/
|
|
18
40
|
collapsible?: boolean;
|
|
19
41
|
};
|
|
20
|
-
export type CheckboxGroupProps = {
|
|
21
|
-
title?: string;
|
|
22
|
-
items: CheckboxListItem[];
|
|
42
|
+
export type CheckboxGroupProps = CheckboxGroup & {
|
|
23
43
|
onChange: (event: CheckboxChangeEvent) => void;
|
|
24
|
-
hasDividers?: boolean;
|
|
25
44
|
className?: string;
|
|
26
|
-
isCollapsed?: boolean;
|
|
27
45
|
} & WithCollapsible;
|
|
28
|
-
export interface CheckboxGroupItemProps {
|
|
29
|
-
id: string;
|
|
30
|
-
label: string;
|
|
31
|
-
isChecked?: boolean;
|
|
32
|
-
isDisabled?: boolean;
|
|
46
|
+
export interface CheckboxGroupItemProps extends CheckboxListItem {
|
|
33
47
|
onChange: (event: CheckboxChangeEvent) => void;
|
|
34
|
-
className?: string;
|
|
35
48
|
}
|
|
36
49
|
export interface CheckboxListItem {
|
|
37
50
|
id: string;
|
|
@@ -41,8 +54,17 @@ export interface CheckboxListItem {
|
|
|
41
54
|
className?: string;
|
|
42
55
|
}
|
|
43
56
|
export type CheckboxGroup = {
|
|
57
|
+
/**
|
|
58
|
+
* When the title isn't specified, the group will render as a non-collapsible list.
|
|
59
|
+
*/
|
|
44
60
|
title?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The checkbox items to be shown inside of this group.
|
|
63
|
+
*/
|
|
45
64
|
items: CheckboxListItem[];
|
|
65
|
+
/**
|
|
66
|
+
* Whether the group is initially collapsed or not.
|
|
67
|
+
*/
|
|
46
68
|
isCollapsed?: boolean;
|
|
47
69
|
} & WithCollapsible;
|
|
48
70
|
export interface CheckboxChangeEvent {
|
|
@@ -7,12 +7,12 @@ type FlexContainerBase = {
|
|
|
7
7
|
verticalSpacing?: Spacing;
|
|
8
8
|
horizontalSpacing?: Spacing;
|
|
9
9
|
/**
|
|
10
|
-
* Applies the default padding (`"p-4"`) inside the container.
|
|
10
|
+
* Applies the default padding (`"ui-p-4"`) inside the container.
|
|
11
11
|
*/
|
|
12
12
|
hasPadding?: boolean;
|
|
13
13
|
backgroundColor?: string;
|
|
14
14
|
/**
|
|
15
|
-
* If `true`, will make the flexbox full width and not size
|
|
15
|
+
* If `true`, will make the flexbox full width and not size itui-relative to its content.
|
|
16
16
|
* @default true
|
|
17
17
|
*/
|
|
18
18
|
stretch?: boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CategorizedFilters, FilterBarLocalization, OnFilterBarFilterChange } from "./FilterBarProps.type";
|
|
3
|
+
type ActiveFiltersProps = {
|
|
4
|
+
filters: CategorizedFilters;
|
|
5
|
+
onRemoveActiveFilter: OnFilterBarFilterChange;
|
|
6
|
+
localization: Pick<FilterBarLocalization, "filtersLabel">;
|
|
7
|
+
};
|
|
8
|
+
export declare const ActiveFilters: React.FC<ActiveFiltersProps>;
|
|
9
|
+
export {};
|