@czi-sds/mcp 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/zeroheight-cache.json +5195 -0
- package/data/zeroheight-exports/Accordion.md +675 -0
- package/data/zeroheight-exports/Banner.md +576 -0
- package/data/zeroheight-exports/Borders.md +118 -0
- package/data/zeroheight-exports/Buttons.md +2260 -0
- package/data/zeroheight-exports/Callout.md +756 -0
- package/data/zeroheight-exports/Colors.md +633 -0
- package/data/zeroheight-exports/Content-Card.md +162 -0
- package/data/zeroheight-exports/Contributing-to-SDS.md +99 -0
- package/data/zeroheight-exports/Control-Inputs.md +2066 -0
- package/data/zeroheight-exports/Corners.md +112 -0
- package/data/zeroheight-exports/Cover-page.md +4 -0
- package/data/zeroheight-exports/Dialog.md +1133 -0
- package/data/zeroheight-exports/Downloads.md +121 -0
- package/data/zeroheight-exports/Drop-Shadows.md +80 -0
- package/data/zeroheight-exports/Dropdown-Input.md +1149 -0
- package/data/zeroheight-exports/Dropdown-Menu.md +3787 -0
- package/data/zeroheight-exports/Element-Status-Tracker.md +268 -0
- package/data/zeroheight-exports/Field-Inputs.md +965 -0
- package/data/zeroheight-exports/Filters.md +868 -0
- package/data/zeroheight-exports/Getting-Started.md +1296 -0
- package/data/zeroheight-exports/Hero.md +256 -0
- package/data/zeroheight-exports/Icons.md +432 -0
- package/data/zeroheight-exports/Intent.md +47 -0
- package/data/zeroheight-exports/Introduction-to-Bases.md +36 -0
- package/data/zeroheight-exports/Introduction-to-Cells.md +36 -0
- package/data/zeroheight-exports/Introduction-to-DNA.md +36 -0
- package/data/zeroheight-exports/Introduction-to-Genes.md +36 -0
- package/data/zeroheight-exports/Introduction.md +116 -0
- package/data/zeroheight-exports/Link.md +373 -0
- package/data/zeroheight-exports/Lists.md +617 -0
- package/data/zeroheight-exports/Loading-Indicator.md +38 -0
- package/data/zeroheight-exports/Navigation.md +853 -0
- package/data/zeroheight-exports/Notification.md +858 -0
- package/data/zeroheight-exports/Panel.md +862 -0
- package/data/zeroheight-exports/README.md +124 -0
- package/data/zeroheight-exports/Responsive-Design.md +275 -0
- package/data/zeroheight-exports/Search-Input.md +54 -0
- package/data/zeroheight-exports/Search.md +609 -0
- package/data/zeroheight-exports/Segmented-Control.md +561 -0
- package/data/zeroheight-exports/Spacing.md +298 -0
- package/data/zeroheight-exports/Table.md +4832 -0
- package/data/zeroheight-exports/Tabs.md +773 -0
- package/data/zeroheight-exports/Tags.md +1025 -0
- package/data/zeroheight-exports/Text-Link.md +185 -0
- package/data/zeroheight-exports/Theming.md +313 -0
- package/data/zeroheight-exports/Tooltips.md +1564 -0
- package/data/zeroheight-exports/Typography.md +769 -0
- package/dist/stdio.js +188 -0
- package/package.json +4 -3
|
@@ -0,0 +1,868 @@
|
|
|
1
|
+
# Filters
|
|
2
|
+
|
|
3
|
+
Filters are used to narrow down large amounts of data based on specific criteria, helping users hone in on specific datasets within the product.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
| | In Figma | | | Meets Accessibility | | | In napari hub + .org Codebases |
|
|
8
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
9
|
+
|
|
10
|
+
Filters are comprised of a Dropdown Input which serves as a clickable Filter label combined with a Dropdown Menu to show the Filter Input options when the Filter Label is active, and Tags to display which options are currently being filtered on. The Dropdown Menu activated when the Filter Label is clicked displays the Filter Input options available.
|
|
11
|
+
|
|
12
|
+
Users can filter using any combination of Filter options presented to them—see the Filtering Logic section below for an overview of how applied Filters affect the dataset being filtered on.
|
|
13
|
+
|
|
14
|
+
| **Closed** | **Open** | **Active** |
|
|
15
|
+
| --- | --- | --- |
|
|
16
|
+
|
|
17
|
+
### Filter Variants
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
### Filter Example
|
|
22
|
+
|
|
23
|
+
The example below shows Filters being used as part of the plugin search on napari hub.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
### Filter Spacing
|
|
28
|
+
|
|
29
|
+
These rules establish how much margin should exist between and around elements. Follow spacing rules for Dropdown Menus for spacing guidance for the Filter Input.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Filtering Logic
|
|
34
|
+
|
|
35
|
+
Filtering logic is handled at the product level; however, this section offers some suggestions for best practices to consider when establishing filtering logic.
|
|
36
|
+
|
|
37
|
+
## Code
|
|
38
|
+
|
|
39
|
+
## Filter Components
|
|
40
|
+
|
|
41
|
+
| Below you will find an interactive Storybook iframe for Filters. Tabs within each iframe provide a different set of tools: The Controls tab allows you to see and adjust all available props. The Actions tab shows you data displayed by event handler arguments. | | **Jump to component:** FilterComplex |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
>This component appears as it is in the default SDS codebase. Once imported into the napari hub or napari.org codebases, use a theme file to enable the napari visual appearance customization.
|
|
47
|
+
|
|
48
|
+
### FilterComplex
|
|
49
|
+
|
|
50
|
+
Note: the Filter component used in napari hub + .org is using the FilterComplex component from the SDS codebase.
|
|
51
|
+
|
|
52
|
+
Storybook
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
Filters are used to narrow down large amounts of data based on specific criteria, helping users hone in on specific datasets within the product.
|
|
57
|
+
|
|
58
|
+
## Overview
|
|
59
|
+
|
|
60
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
61
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
62
|
+
|
|
63
|
+
Filters are comprised of a Dropdown Input which serves as a clickable Filter label combined with a Dropdown Menu to show the Filter Input options when the Filter Label is active, and Filter Tags to display which options are currently being filtered on.
|
|
64
|
+
|
|
65
|
+
The Dropdown Menu that is activated when the Filter Label is clicked displays the Filter Input options available and, depending on the needs of the dataset, can be Single-select (Radio Lockup), Multi-select (Checkbox Lockup), or a Range (Slider). Users can filter using any combination of Filter options presented to them—see the Filtering Logic section below for an overview of how applied Filters affect the dataset being filtered on.
|
|
66
|
+
|
|
67
|
+
| **Closed** | **Open** | **Active** |
|
|
68
|
+
| --- | --- | --- |
|
|
69
|
+
|
|
70
|
+
### Filter Variants
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### Filter Example
|
|
81
|
+
|
|
82
|
+
The example below shows Complex Filters being used as part of a Basic Panel in CZ GEN EPI.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### Filter Spacing
|
|
87
|
+
|
|
88
|
+
These rules establish how much margin should exist between and around elements. Follow spacing rules for Dropdown Menus for spacing guidance for the Complex Filter Input.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Filtering Logic
|
|
93
|
+
|
|
94
|
+
Filtering logic is handled at the product level, however, this section offers some suggestions for best practices to consider when establishing filtering logic.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Code
|
|
99
|
+
|
|
100
|
+
## Filter Components
|
|
101
|
+
|
|
102
|
+
| Below you will find an interactive Storybook iframe for Filters. Tabs within each iframe provide a different set of tools: The Controls tab allows you to see and adjust all available props. The Actions tab shows you data displayed by event handler arguments. | | **Jump to component:** FilterComplex |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
>This component appears as it is in the default SDS codebase. Once imported into the CZ GEN EPI codebase, use a theme file to enable the CZ GEN EPI visual appearance customization.
|
|
108
|
+
|
|
109
|
+
### FilterComplex
|
|
110
|
+
|
|
111
|
+
Storybook
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
Filters are used to narrow down large amounts of data based on specific criteria, helping users hone in on specific datasets within the product.
|
|
116
|
+
|
|
117
|
+
## Overview
|
|
118
|
+
|
|
119
|
+
## Filter Variants
|
|
120
|
+
|
|
121
|
+
| Filters come in two different variants for designers to use depending on the filtering needs of the dataset the filter applies to. Simple Filters are used when the dataset has few filter options and there is space within the layout to fit them all, whereas Complex Filters are used when there are multiple filters needed to fit into one layout, necessitating a more compact design. Follow the usage criteria accompanying each variant as a guide for selecting the correct Filter for any given use case. | | **Jump to variant:** Simple Complex Filtering Logic |
|
|
122
|
+
| --- | --- | --- |
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Simple Filter
|
|
127
|
+
|
|
128
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
129
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
130
|
+
|
|
131
|
+
Use the Simple Filter when there are only a few options to filter on or there are only a few filter categories needed for a given dataset. Simple Filters are comprised of a Filter Label combined with a Filter Input that is Single-select (Radio Lockup), Multi-select (Checkbox Lockup), or a Range (Slider) depending on the filtering needs of the dataset. In contrast to Complex Filters which keep filter options contained within a Dropdown Menu, Simple Filters have all of the options for each filter exposed in the UI and viewable by the user. Users can filter using any combination of Filter options presented to them—see the Filtering Logic section below for an overview of how applied Filters affect the dataset being filtered.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### Simple Filter Example
|
|
138
|
+
|
|
139
|
+
The example below shows Simple Filters being used as part of a Basic Panel in CZ ID.
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
### Simple Filter Spacing
|
|
146
|
+
|
|
147
|
+
These rules establish how much margin should exist between and around elements.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Complex Filter
|
|
152
|
+
|
|
153
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
154
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
155
|
+
|
|
156
|
+
Use the Complex Filter when there are multiple filters needed to fit into one layout, necessitating a more compact design than a Simple Filter would allow for. Complex Filters are comprised of a Dropdown Input which serves as a clickable Filter Label combined with a Dropdown Menu to show the Filter Input options when the Filter Label is active, and Filter Tags to display which options are currently being filtered on.
|
|
157
|
+
|
|
158
|
+
The Dropdown Menu that is activated when the Filter Label is clicked displays the Filter Input options available and, depending on the needs of the dataset, can be Single-select (Radio Lockup), Multi-select (Checkbox Lockup), or a Range (Slider). Users can filter using any combination of Filter options presented to them—see the Filtering Logic section below for an overview of how applied Filters affect the dataset being filtered on.
|
|
159
|
+
|
|
160
|
+
| **Closed** | **Open** | **Active** |
|
|
161
|
+
| --- | --- | --- |
|
|
162
|
+
|
|
163
|
+
### Complex Filter Variants
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
### Complex Filter Example
|
|
176
|
+
|
|
177
|
+
The example below shows Complex Filters being used as part of a Basic Panel in CZ ID.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
### Complex Filter Spacing
|
|
182
|
+
|
|
183
|
+
These rules establish how much margin should exist between and around elements. Follow spacing rules for Dropdown Menus for spacing guidance for the Complex Filter Input.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Filtering Logic
|
|
188
|
+
|
|
189
|
+
Filtering logic is handled at the product level, however, this section offers some suggestions for best practices to consider when establishing filtering logic.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Code
|
|
194
|
+
|
|
195
|
+
## Filter Components
|
|
196
|
+
|
|
197
|
+
| Below you will find an interactive Storybook iframe for Panels. Tabs within each iframe provide a different set of tools: The Controls tab allows you to see and adjust all available props. The Actions tab shows you data displayed by event handler arguments. | | **Jump to component:** FilterSimple FilterComplex |
|
|
198
|
+
| --- | --- | --- |
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### FilterSimple (coming soon)
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
### FilterComplex
|
|
207
|
+
|
|
208
|
+
Storybook
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
Filters are used to narrow down large amounts of data based on specific criteria, helping users hone in on specific datasets within the product.
|
|
213
|
+
|
|
214
|
+
## Guidelines
|
|
215
|
+
|
|
216
|
+
## Filter Components
|
|
217
|
+
|
|
218
|
+
| There are two Filter components available to use depending on the filtering needs of the dataset. Simple Filter is used when the dataset has few filters and there is space within the layout to fit them all, whereas Complex Filter is used when there are many filters needed to fit into one layout, necessitating a more compact design. | | **Jump to component:** Simple Filter Complex Filter |
|
|
219
|
+
| --- | --- | --- |
|
|
220
|
+
|
|
221
|
+
### Visual Preview
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Simple Filter
|
|
226
|
+
|
|
227
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
228
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
229
|
+
|
|
230
|
+
### Live Instance
|
|
231
|
+
|
|
232
|
+
>**Note:** Live instance for Simple Filter will be added soon.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### Overview
|
|
237
|
+
|
|
238
|
+
Use Simple Filter when there are only a few filter categories or a few options per category needed for a given dataset. Simple Filter is comprised of a label combined with an input that is Single-select (Radio Input), Multi-select (Checkbox Input), or a Range (Slider) depending on the filtering needs of the dataset. It has all of the options for each filter exposed in the UI and viewable by the user. Users can filter using any combination of Filter options presented to them—see the Filtering Logic section below for an overview of how applied Filters affect the dataset being filtered.
|
|
239
|
+
|
|
240
|
+
| Single-select | Multi-select | Range |
|
|
241
|
+
| --- | --- | --- |
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
### Simple Filter example
|
|
246
|
+
|
|
247
|
+
The example below shows Simple Filters being used as part of a Basic Panel (documentation to come) in CZ ID.
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
### Simple Filter Spacing
|
|
252
|
+
|
|
253
|
+
These rules establish how much margin should exist between and around elements.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Complex Filter
|
|
258
|
+
|
|
259
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
260
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
261
|
+
|
|
262
|
+
### Live Instance
|
|
263
|
+
|
|
264
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
265
|
+
|
|
266
|
+
Default
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
### Overview
|
|
271
|
+
|
|
272
|
+
Use Complex Filter when there are many filters needed to fit into one layout, necessitating a more compact design than Simple Filter allows for. Complex Filter is comprised of a Dropdown Input, which serves as a trigger, combined with a Dropdown Menu which displays the available filter options. After the user selects a filter option, Filter Tags are added below the Dropdown Input to display the active filter selections.
|
|
273
|
+
|
|
274
|
+
The Dropdown Menu triggered when the Dropdown Input is clicked can be Single-select, Multi-select, or a Range (Slider) depending on the needs of the dataset. Users can filter using any combination of Filter options presented to them—see the Filtering Logic section below for an overview of how applied Filters affect the dataset being filtered on.
|
|
275
|
+
|
|
276
|
+
| Single-select | Single-select + Search | Multi-select | Multi-select + Search | Range |
|
|
277
|
+
| --- | --- | --- | --- | --- |
|
|
278
|
+
|
|
279
|
+
#### **Complex Filter states**
|
|
280
|
+
|
|
281
|
+
| Closed | Open | Active |
|
|
282
|
+
| --- | --- | --- |
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
### Complex Filter example
|
|
287
|
+
|
|
288
|
+
The example below shows Complex Filters being used as part of a Basic Panel (documentation to come) in CZ ID.
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
### Complex Filter Spacing
|
|
293
|
+
|
|
294
|
+
These rules establish how much margin should exist between and around elements. Follow spacing rules for Dropdown Menus for spacing guidance for the Complex Filter Input.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
### Filtering Logic
|
|
299
|
+
|
|
300
|
+
Filtering logic is handled at the product level, however, this section offers some suggestions for best practices to consider when establishing filtering logic.
|
|
301
|
+
|
|
302
|
+
## Code
|
|
303
|
+
|
|
304
|
+
## Filter Components
|
|
305
|
+
|
|
306
|
+
| There are two `Filter` components available to use depending on the filtering needs of the dataset. `SimpleFilter` is used when the dataset has few filters and there is space within the layout to fit them all, whereas `ComplexFilter` is used when there are many filters needed to fit into one layout, necessitating a more compact design. | | **Jump to component:** SimpleFilter ComplexFilter |
|
|
307
|
+
| --- | --- | --- |
|
|
308
|
+
|
|
309
|
+
### Visual Preview
|
|
310
|
+
|
|
311
|
+
>**Note:** The code examples below must install dependencies before displaying and may take extra time to load
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## SimpleFilter
|
|
316
|
+
|
|
317
|
+
>**Note:** Code details for `SimpleFilter` will be added soon.
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## ComplexFilter
|
|
322
|
+
|
|
323
|
+
### SDS Source Code
|
|
324
|
+
|
|
325
|
+
The component's source code in the SDS codebase can be found here.
|
|
326
|
+
|
|
327
|
+
### SDS vs MUI
|
|
328
|
+
|
|
329
|
+
The `ComplexFilter` is not directly based on any MUI component, but it does use the SDS `Dropdown` component, which in turn is ultimately based on MUI's `Autocomplete` component. As such, props that are available to either SDS's `Dropdown` and / or MUI's `Autocomplete` can be passed to `ComplexFilter` as such:
|
|
330
|
+
|
|
331
|
+
* **`DropdownMenuProps`****:** use this prop to pass MUI`Autocomplete`-specific props to `ComplexFilter`
|
|
332
|
+
* **`InputDropdownProps`****:** use this prop to pass SDS `InputDropdown`-specific props to `ComplexFilter`
|
|
333
|
+
|
|
334
|
+
### Props
|
|
335
|
+
|
|
336
|
+
Any custom SDS props and MUI props required for implementation are found in the table below. See the MUI documentation for additional optional props.
|
|
337
|
+
|
|
338
|
+
| Name | Type | Default | Description |
|
|
339
|
+
| --- | --- | --- | --- |
|
|
340
|
+
| `isTriggerChangeOnOptionClick` | `bool` | `false` | Determines whether changes are triggered in real-time upon clicking an option |
|
|
341
|
+
| `keepSearchOnSelect` | `bool` | | Maintains a search input when a user selects an option (only if multiple selections are allowed via the `multiple` prop; otherwise the dropdown closes upon selection) |
|
|
342
|
+
| `label` | `string` | `""` | Sets the label of filter, shown both when closed and open |
|
|
343
|
+
| `multiple` | `bool` | `false` | Defines whether multiple selections or can be made from the filter simultaneously or only one |
|
|
344
|
+
| `onChange` | `func` | `-` | Function to set what happens when a new value is set via the filter |
|
|
345
|
+
| `search` | `bool` | `false` | Provides a search bar at the top of the filter from which users can narrow the list of menu items |
|
|
346
|
+
|
|
347
|
+
### Code Examples
|
|
348
|
+
|
|
349
|
+
#### Default ComplexFilter
|
|
350
|
+
|
|
351
|
+
This examples demonstrates the minimum props needed to render a `ComplexFilter`.
|
|
352
|
+
|
|
353
|
+
**/styles.css**
|
|
354
|
+
|
|
355
|
+
```css
|
|
356
|
+
body {
|
|
357
|
+
font-size: 13px;
|
|
358
|
+
font-weight: 400;
|
|
359
|
+
letter-spacing: 0.08px;
|
|
360
|
+
line-height: 20px;
|
|
361
|
+
text-transform: none;
|
|
362
|
+
font-family: "Inter", sans-serif;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
h1 {
|
|
366
|
+
font-size: 1.5rem;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.app {
|
|
370
|
+
padding: 20px;
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
**tsconfig.json**
|
|
375
|
+
|
|
376
|
+
```json
|
|
377
|
+
{
|
|
378
|
+
"include": [
|
|
379
|
+
"./**/*"
|
|
380
|
+
],
|
|
381
|
+
"compilerOptions": {
|
|
382
|
+
"strict": true,
|
|
383
|
+
"esModuleInterop": true,
|
|
384
|
+
"lib": [ "dom", "es2015" ],
|
|
385
|
+
"jsx": "react-jsx"
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
**/App.tsx**
|
|
391
|
+
|
|
392
|
+
```tsx
|
|
393
|
+
import { ComplexFilter, DefaultDropdownMenuOption } from "@czi-sds/components";
|
|
394
|
+
import "./styles.css";
|
|
395
|
+
|
|
396
|
+
const MENU_ITEMS: DefaultDropdownMenuOption[] = [
|
|
397
|
+
{
|
|
398
|
+
name: "Fruit: Apple",
|
|
399
|
+
section: "Fruit",
|
|
400
|
+
count: 10
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
name: "Fruit: Cherry",
|
|
404
|
+
section: "Fruit",
|
|
405
|
+
count: 150
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
name: "Fruit: Orange",
|
|
409
|
+
section: "Fruit",
|
|
410
|
+
count: 15
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
name: "Vegetable: Carrot",
|
|
414
|
+
section: "Vegetable",
|
|
415
|
+
count: 34
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
name: "Vegetable: Kale",
|
|
419
|
+
section: "Vegetable"
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
name: "Vegetable: Lettuce",
|
|
423
|
+
section: "Vegetable"
|
|
424
|
+
},
|
|
425
|
+
];
|
|
426
|
+
|
|
427
|
+
function App() {
|
|
428
|
+
|
|
429
|
+
return (
|
|
430
|
+
<div className="app">
|
|
431
|
+
<ComplexFilter
|
|
432
|
+
label="Filter Label"
|
|
433
|
+
onChange={() => {}}
|
|
434
|
+
options={MENU_ITEMS}
|
|
435
|
+
/>
|
|
436
|
+
</div>
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export default App;
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**/index.tsx**
|
|
444
|
+
|
|
445
|
+
```tsx
|
|
446
|
+
import React from "react";
|
|
447
|
+
import { createRoot } from "react-dom/client";
|
|
448
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
449
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
450
|
+
import { Theme } from "@czi-sds/components";
|
|
451
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
452
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
453
|
+
|
|
454
|
+
import App from "./App";
|
|
455
|
+
|
|
456
|
+
const container = document.getElementById("root");
|
|
457
|
+
const root = createRoot(container!);
|
|
458
|
+
|
|
459
|
+
const RootApp = () => {
|
|
460
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
461
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
462
|
+
|
|
463
|
+
return (
|
|
464
|
+
<StyledEngineProvider injectFirst>
|
|
465
|
+
<ThemeProvider theme={theme}>
|
|
466
|
+
<EmotionThemeProvider theme={theme}>
|
|
467
|
+
<CssBaseline />
|
|
468
|
+
<App />
|
|
469
|
+
</EmotionThemeProvider>
|
|
470
|
+
</ThemeProvider>
|
|
471
|
+
</StyledEngineProvider>
|
|
472
|
+
);
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
root.render(
|
|
476
|
+
<React.StrictMode>
|
|
477
|
+
<RootApp />
|
|
478
|
+
</React.StrictMode>
|
|
479
|
+
);
|
|
480
|
+
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
**/public/index.html**
|
|
484
|
+
|
|
485
|
+
```html
|
|
486
|
+
<!DOCTYPE html>
|
|
487
|
+
<html lang="en">
|
|
488
|
+
<head>
|
|
489
|
+
<meta charset="UTF-8" />
|
|
490
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
491
|
+
<title>Filters</title>
|
|
492
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
493
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
494
|
+
<link
|
|
495
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
496
|
+
rel="stylesheet"
|
|
497
|
+
/>
|
|
498
|
+
<link
|
|
499
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
500
|
+
rel="stylesheet"
|
|
501
|
+
/>
|
|
502
|
+
</head>
|
|
503
|
+
<body>
|
|
504
|
+
<div id="root"></div>
|
|
505
|
+
</body>
|
|
506
|
+
</html>
|
|
507
|
+
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
**/package.json**
|
|
511
|
+
|
|
512
|
+
```json
|
|
513
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
---
|
|
517
|
+
|
|
518
|
+
#### Multi select ComplexFilter with Search
|
|
519
|
+
|
|
520
|
+
This example showcases a `ComplexFilter` component featuring `InputSearch` for filtering menu items. Users have the flexibility to select multiple options to refine their selections.
|
|
521
|
+
|
|
522
|
+
**/styles.css**
|
|
523
|
+
|
|
524
|
+
```css
|
|
525
|
+
body {
|
|
526
|
+
font-size: 13px;
|
|
527
|
+
font-weight: 400;
|
|
528
|
+
letter-spacing: 0.08px;
|
|
529
|
+
line-height: 20px;
|
|
530
|
+
text-transform: none;
|
|
531
|
+
font-family: "Inter", sans-serif;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
h1 {
|
|
535
|
+
font-size: 1.5rem;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.app {
|
|
539
|
+
padding: 20px;
|
|
540
|
+
}
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
**tsconfig.json**
|
|
544
|
+
|
|
545
|
+
```json
|
|
546
|
+
{
|
|
547
|
+
"include": [
|
|
548
|
+
"./**/*"
|
|
549
|
+
],
|
|
550
|
+
"compilerOptions": {
|
|
551
|
+
"strict": true,
|
|
552
|
+
"esModuleInterop": true,
|
|
553
|
+
"lib": [ "dom", "es2015" ],
|
|
554
|
+
"jsx": "react-jsx"
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
**/App.tsx**
|
|
560
|
+
|
|
561
|
+
```tsx
|
|
562
|
+
import { ComplexFilter, DefaultDropdownMenuOption } from "@czi-sds/components";
|
|
563
|
+
import "./styles.css";
|
|
564
|
+
|
|
565
|
+
const MENU_ITEMS: DefaultDropdownMenuOption[] = [
|
|
566
|
+
{
|
|
567
|
+
name: "Fruit: Apple",
|
|
568
|
+
section: "Fruit",
|
|
569
|
+
count: 10
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
name: "Fruit: Cherry",
|
|
573
|
+
section: "Fruit",
|
|
574
|
+
count: 150
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
name: "Fruit: Orange",
|
|
578
|
+
section: "Fruit",
|
|
579
|
+
count: 15
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
name: "Vegetable: Carrot",
|
|
583
|
+
section: "Vegetable",
|
|
584
|
+
count: 34
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
name: "Vegetable: Kale",
|
|
588
|
+
section: "Vegetable"
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
name: "Vegetable: Lettuce",
|
|
592
|
+
section: "Vegetable"
|
|
593
|
+
},
|
|
594
|
+
];
|
|
595
|
+
|
|
596
|
+
function App() {
|
|
597
|
+
|
|
598
|
+
return (
|
|
599
|
+
<div className="app">
|
|
600
|
+
<ComplexFilter
|
|
601
|
+
label="Filter Label"
|
|
602
|
+
onChange={() => {}}
|
|
603
|
+
options={MENU_ITEMS}
|
|
604
|
+
DropdownMenuProps={{
|
|
605
|
+
groupBy: (option: DefaultDropdownMenuOption) =>
|
|
606
|
+
option.section as string,
|
|
607
|
+
}}
|
|
608
|
+
multiple
|
|
609
|
+
search
|
|
610
|
+
/>
|
|
611
|
+
</div>
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
export default App;
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
**/index.tsx**
|
|
619
|
+
|
|
620
|
+
```tsx
|
|
621
|
+
import React from "react";
|
|
622
|
+
import { createRoot } from "react-dom/client";
|
|
623
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
624
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
625
|
+
import { Theme } from "@czi-sds/components";
|
|
626
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
627
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
628
|
+
|
|
629
|
+
import App from "./App";
|
|
630
|
+
|
|
631
|
+
const container = document.getElementById("root");
|
|
632
|
+
const root = createRoot(container!);
|
|
633
|
+
|
|
634
|
+
const RootApp = () => {
|
|
635
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
636
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
637
|
+
|
|
638
|
+
return (
|
|
639
|
+
<StyledEngineProvider injectFirst>
|
|
640
|
+
<ThemeProvider theme={theme}>
|
|
641
|
+
<EmotionThemeProvider theme={theme}>
|
|
642
|
+
<CssBaseline />
|
|
643
|
+
<App />
|
|
644
|
+
</EmotionThemeProvider>
|
|
645
|
+
</ThemeProvider>
|
|
646
|
+
</StyledEngineProvider>
|
|
647
|
+
);
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
root.render(
|
|
651
|
+
<React.StrictMode>
|
|
652
|
+
<RootApp />
|
|
653
|
+
</React.StrictMode>
|
|
654
|
+
);
|
|
655
|
+
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
**/public/index.html**
|
|
659
|
+
|
|
660
|
+
```html
|
|
661
|
+
<!DOCTYPE html>
|
|
662
|
+
<html lang="en">
|
|
663
|
+
<head>
|
|
664
|
+
<meta charset="UTF-8" />
|
|
665
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
666
|
+
<title>Filters</title>
|
|
667
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
668
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
669
|
+
<link
|
|
670
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
671
|
+
rel="stylesheet"
|
|
672
|
+
/>
|
|
673
|
+
<link
|
|
674
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
675
|
+
rel="stylesheet"
|
|
676
|
+
/>
|
|
677
|
+
</head>
|
|
678
|
+
<body>
|
|
679
|
+
<div id="root"></div>
|
|
680
|
+
</body>
|
|
681
|
+
</html>
|
|
682
|
+
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
**/package.json**
|
|
686
|
+
|
|
687
|
+
```json
|
|
688
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
---
|
|
692
|
+
|
|
693
|
+
#### ComplexFilter with realtime selection changes
|
|
694
|
+
|
|
695
|
+
This example showcases the functionality that enables the dropdown selections to be instantly reflected in the tags in real-time. This is achieved by utilizing the `isTriggerChangeOnOptionClick` prop.
|
|
696
|
+
|
|
697
|
+
**/styles.css**
|
|
698
|
+
|
|
699
|
+
```css
|
|
700
|
+
body {
|
|
701
|
+
font-size: 13px;
|
|
702
|
+
font-weight: 400;
|
|
703
|
+
letter-spacing: 0.08px;
|
|
704
|
+
line-height: 20px;
|
|
705
|
+
text-transform: none;
|
|
706
|
+
font-family: "Inter", sans-serif;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
h1 {
|
|
710
|
+
font-size: 1.5rem;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
.app {
|
|
714
|
+
padding: 20px;
|
|
715
|
+
}
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
**tsconfig.json**
|
|
719
|
+
|
|
720
|
+
```json
|
|
721
|
+
{
|
|
722
|
+
"include": [
|
|
723
|
+
"./**/*"
|
|
724
|
+
],
|
|
725
|
+
"compilerOptions": {
|
|
726
|
+
"strict": true,
|
|
727
|
+
"esModuleInterop": true,
|
|
728
|
+
"lib": [ "dom", "es2015" ],
|
|
729
|
+
"jsx": "react-jsx"
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
**/App.tsx**
|
|
735
|
+
|
|
736
|
+
```tsx
|
|
737
|
+
import { ComplexFilter, DefaultDropdownMenuOption } from "@czi-sds/components";
|
|
738
|
+
import "./styles.css";
|
|
739
|
+
|
|
740
|
+
const MENU_ITEMS: DefaultDropdownMenuOption[] = [
|
|
741
|
+
{
|
|
742
|
+
name: "Fruit: Apple",
|
|
743
|
+
section: "Fruit",
|
|
744
|
+
count: 10
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
name: "Fruit: Cherry",
|
|
748
|
+
section: "Fruit",
|
|
749
|
+
count: 150
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
name: "Fruit: Orange",
|
|
753
|
+
section: "Fruit",
|
|
754
|
+
count: 15
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
name: "Vegetable: Carrot",
|
|
758
|
+
section: "Vegetable",
|
|
759
|
+
count: 34
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
name: "Vegetable: Kale",
|
|
763
|
+
section: "Vegetable"
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
name: "Vegetable: Lettuce",
|
|
767
|
+
section: "Vegetable"
|
|
768
|
+
},
|
|
769
|
+
];
|
|
770
|
+
|
|
771
|
+
function App() {
|
|
772
|
+
|
|
773
|
+
return (
|
|
774
|
+
<div className="app">
|
|
775
|
+
<ComplexFilter
|
|
776
|
+
label="Filter Label"
|
|
777
|
+
onChange={() => {}}
|
|
778
|
+
options={MENU_ITEMS}
|
|
779
|
+
DropdownMenuProps={{
|
|
780
|
+
groupBy: (option: DefaultDropdownMenuOption) =>
|
|
781
|
+
option.section as string,
|
|
782
|
+
}}
|
|
783
|
+
multiple
|
|
784
|
+
search
|
|
785
|
+
isTriggerChangeOnOptionClick
|
|
786
|
+
/>
|
|
787
|
+
</div>
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
export default App;
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
**/index.tsx**
|
|
795
|
+
|
|
796
|
+
```tsx
|
|
797
|
+
import React from "react";
|
|
798
|
+
import { createRoot } from "react-dom/client";
|
|
799
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
800
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
801
|
+
import { Theme } from "@czi-sds/components";
|
|
802
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
803
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
804
|
+
|
|
805
|
+
import App from "./App";
|
|
806
|
+
|
|
807
|
+
const container = document.getElementById("root");
|
|
808
|
+
const root = createRoot(container!);
|
|
809
|
+
|
|
810
|
+
const RootApp = () => {
|
|
811
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
812
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
813
|
+
|
|
814
|
+
return (
|
|
815
|
+
<StyledEngineProvider injectFirst>
|
|
816
|
+
<ThemeProvider theme={theme}>
|
|
817
|
+
<EmotionThemeProvider theme={theme}>
|
|
818
|
+
<CssBaseline />
|
|
819
|
+
<App />
|
|
820
|
+
</EmotionThemeProvider>
|
|
821
|
+
</ThemeProvider>
|
|
822
|
+
</StyledEngineProvider>
|
|
823
|
+
);
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
root.render(
|
|
827
|
+
<React.StrictMode>
|
|
828
|
+
<RootApp />
|
|
829
|
+
</React.StrictMode>
|
|
830
|
+
);
|
|
831
|
+
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
**/public/index.html**
|
|
835
|
+
|
|
836
|
+
```html
|
|
837
|
+
<!DOCTYPE html>
|
|
838
|
+
<html lang="en">
|
|
839
|
+
<head>
|
|
840
|
+
<meta charset="UTF-8" />
|
|
841
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
842
|
+
<title>Filters</title>
|
|
843
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
844
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
845
|
+
<link
|
|
846
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
847
|
+
rel="stylesheet"
|
|
848
|
+
/>
|
|
849
|
+
<link
|
|
850
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
851
|
+
rel="stylesheet"
|
|
852
|
+
/>
|
|
853
|
+
</head>
|
|
854
|
+
<body>
|
|
855
|
+
<div id="root"></div>
|
|
856
|
+
</body>
|
|
857
|
+
</html>
|
|
858
|
+
|
|
859
|
+
```
|
|
860
|
+
|
|
861
|
+
**/package.json**
|
|
862
|
+
|
|
863
|
+
```json
|
|
864
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
---
|
|
868
|
+
|