@czi-sds/mcp 0.2.1 → 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 +515 -12
- package/package.json +4 -3
|
@@ -0,0 +1,1133 @@
|
|
|
1
|
+
# Dialogs
|
|
2
|
+
|
|
3
|
+
A Dialog is a window element that appears on top of content to provide information or prompt the user for an action. When a Dialog is active, it disables all functionality of the page below and remains on the screen until it is either dismissed or action has been taken.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
| | In Figma | | | Meets Accessibility | | | In napari hub + .org Codebases |
|
|
8
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
9
|
+
|
|
10
|
+
Dialogs are highly customizable and designed to accommodate a range of product needs and can optionally include overline text above the title, subtitle text below the title, or both. The interior of a Dialog can be filled with any content needed, whether that is to communicate information to the user or collect data from them via a form.
|
|
11
|
+
|
|
12
|
+
There are five size options, each with a fixed width and minimum height (except for `xs` and `xxs` which have no minimum height):
|
|
13
|
+
|
|
14
|
+
* `xxs` — `width: 270px`
|
|
15
|
+
* `xs` —`width: 400px`
|
|
16
|
+
* `s` —`width: 600px`, `min-height: 400px`
|
|
17
|
+
* `m` —`width: 900px`, `min-height: 480px`
|
|
18
|
+
* `l` —`width: 1200px`, `min-height: 600px`
|
|
19
|
+
|
|
20
|
+
Dialogs are dismissible in a few different ways. Regardless of how a Dialog is dismissed, it will result in any selections the user has made within it being lost.
|
|
21
|
+
|
|
22
|
+
Dialogs may be dismissed by:
|
|
23
|
+
|
|
24
|
+
* Clicking an action Button that is configured to close, cancel, or complete an action occurring in the Dialog
|
|
25
|
+
* Pressing the keyboard Esc key
|
|
26
|
+
* Clicking the close Icon Button
|
|
27
|
+
* Clicking outside of the Dialog. Doing this will result in any selections the user has made being lost, so it is recommended that the `canOutsideClickClose` prop remain set to `false` (the default setting) in instances where losing entered information would be a significant burden to the user
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### Dialog Spacing
|
|
32
|
+
|
|
33
|
+
In instances where the length of content contained in the Dialog results in the Dialog filling the entire height of the screen, there must be a minimum of `spaceXxl` margin above and below the Dialog window. The Dialog content scrolls when it exceeds the max-height of the dialog window; the title and any action Buttons are anchored to the top and bottom during scrolling.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
### Dialog Backdrop
|
|
38
|
+
|
|
39
|
+
A backdrop appears behind the active Dialog to bring emphasis to it as well as indicate to users that they cannot interact with the content on the page behind it.
|
|
40
|
+
|
|
41
|
+
## Code
|
|
42
|
+
|
|
43
|
+
## Dialog Component
|
|
44
|
+
|
|
45
|
+
| Below you will find an interactive Storybook iframe for Dialogs. 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:** Dialog |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
>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.
|
|
51
|
+
|
|
52
|
+
### Dialog
|
|
53
|
+
|
|
54
|
+
Storybook
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
A Dialog is a window element that appears on top of content to provide information or prompt the user for an action. When a Dialog is active, it disables all functionality of the page below and remains on the screen until it is either dismissed or action has been taken.
|
|
59
|
+
|
|
60
|
+
## Overview
|
|
61
|
+
|
|
62
|
+
## Dialog Variants
|
|
63
|
+
|
|
64
|
+
| The interior of a Dialog can be filled with any content needed, whether that is to communicate information to the user or collect data from them via a form. They come in four different sizes, each of which can optionally include a close Tertiary Icon Button in the top right corner, artwork above the title, and action Button(s) if the Dialog is prompting the user to take an action. In addition to their title, Dialogs can include overline text above the title, a subtitle below the title, or both. Follow the usage criteria accompanying each variant as a guide for selecting the correct Dialog for any given use case. | | **Jump to variant:** Persistent Dismissible Use Cases |
|
|
65
|
+
| --- | --- | --- |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Dialog
|
|
70
|
+
|
|
71
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
72
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
73
|
+
|
|
74
|
+
Dialogs are highly customizable and designed to accommodate a range of product needs; any combination of the following properties can be used:
|
|
75
|
+
|
|
76
|
+
* Overline text above the title, subtitle text below the title, or both
|
|
77
|
+
* Artwork above the title, whether a logo, icon, or illustration
|
|
78
|
+
|
|
79
|
+
There are four size options, each with a fixed width and minimum height (except for `xs` which has no minimum height):
|
|
80
|
+
|
|
81
|
+
* `xs` —`width: 400px`
|
|
82
|
+
* `s` —`width: 600px`, `min-height: 400px`
|
|
83
|
+
* `m` —`width: 900px`, `min-height: 480px`
|
|
84
|
+
* `l` —`width: 1200px`, `min-height: 600px`
|
|
85
|
+
|
|
86
|
+
Dialogs may be dismissed by:
|
|
87
|
+
|
|
88
|
+
* Clicking an action Button that is configured to close, cancel, or complete a multi-step workflow occurring in the Dialog
|
|
89
|
+
* Pressing the keyboard Esc key
|
|
90
|
+
* Clicking the close Tertiary Icon Button on Dismissible Dialogs
|
|
91
|
+
* Clicking outside of the Dialog. Doing this will result in any selections the user has made being lost, so it is recommended that the `canOutsideClickClose` prop remain set to `false` (the default setting) in instances where losing entered information would be a significant burden to the user
|
|
92
|
+
|
|
93
|
+
### Persistent Dialog
|
|
94
|
+
|
|
95
|
+
Use this variant when the user is unable to dismiss the Dialog without making a selection from one of the action Button(s). Because there is no way for the user to manually dismiss the Dialog, this variant must contain at least one action Button.
|
|
96
|
+
|
|
97
|
+
Persistent Dialogs are generally used in multi-step workflows where dismissing the Dialog would result in a loss of progress or when there is a need for users to confirm they have read the content on the Dialog before proceeding, such as when they are being directed to an external site (see Dialog Use Cases section below for details).
|
|
98
|
+
|
|
99
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### Dismissible Dialog
|
|
110
|
+
|
|
111
|
+
Use this variant to allow the user the ability to manually dismiss the Dialog by clicking the close Tertiary Icon Button in the Dialog's upper right corner. Dismissing the Dialog will result in any selections the user has made being lost. Dismissible Dialogs should not be used in multi-step workflows where closing the Dialog would result in a loss of progress.
|
|
112
|
+
|
|
113
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### Dialog Spacing
|
|
126
|
+
|
|
127
|
+
In instances where the length of content contained in the Dialog results in the Dialog filling the entire height of the screen, there must be a minimum of `spaceXxl` margin above and below the Dialog window. The Dialog content scrolls when it exceeds the max-height of the dialog window; title, overline, subtitle, and any action Buttons are anchored to the top and bottom during scrolling.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### Dialog Backdrop
|
|
132
|
+
|
|
133
|
+
A backdrop appears behind the active Dialog to bring emphasis to it as well as indicate to users that they cannot interact with the content on the page behind it.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Dialog Use Cases
|
|
138
|
+
|
|
139
|
+
Details and guidelines around complex Dialog use cases, such as nested Dialogs and multi-step Dialog workflows.
|
|
140
|
+
|
|
141
|
+
### Nested Dialogs
|
|
142
|
+
|
|
143
|
+
Nested Dialogs should only be used in specific scenarios, most notably when a user is being directed to an external site and a final confirmation is needed.
|
|
144
|
+
|
|
145
|
+
Avoid using nested dialogs when possible because it introduces layers of complexity to pages and may make it more difficult for users to anticipate the results of their actions. It may also impede usability by making it more difficult for users to quickly exit a flow. Instead, explore utilizing a multi-step Dialog workflow (see below).
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
### Multi-step Dialog Workflow
|
|
150
|
+
|
|
151
|
+
Dialog workflows should contain no more than three steps. Workflows that are more than three steps should be designed as a full-page experience.
|
|
152
|
+
|
|
153
|
+
For a flow that takes place inside a Dialog, all steps within that workflow should take place within the same size Dialog for a consistent user experience. Each step of the workflow should also be clearly communicated within the Dialog using the overline text.
|
|
154
|
+
|
|
155
|
+
The Dialog should not be dismissible and the `canOutsideClickClose` prop should be set to `false` to prevent any accidental loss of progress.
|
|
156
|
+
|
|
157
|
+
## Code
|
|
158
|
+
|
|
159
|
+
## Dialog Component
|
|
160
|
+
|
|
161
|
+
| Below you will find an interactive Storybook iframe for Dialogs. 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:** Dialog |
|
|
162
|
+
| --- | --- | --- |
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
>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.
|
|
167
|
+
|
|
168
|
+
### Dialog
|
|
169
|
+
|
|
170
|
+
Storybook
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
A Dialog is a window element that appears on top of content to provide information or prompt the user for an action. When a Dialog is active, it disables all functionality of the page below and remains on the screen until it is either dismissed or action has been taken.
|
|
175
|
+
|
|
176
|
+
## Overview
|
|
177
|
+
|
|
178
|
+
## Dialog Variants
|
|
179
|
+
|
|
180
|
+
| The interior of a Dialog can be filled with any content needed, whether that is to communicate information to the user or collect data from them via a form. They come in four different sizes, each of which can optionally include a close Tertiary Icon Button in the top right corner, artwork above the title, and action Button(s) if the Dialog is prompting the user to take an action. In addition to their title, Dialogs can include overline text above the title, a subtitle below the title, or both. Follow the usage criteria accompanying each variant as a guide for selecting the correct Dialog for any given use case. | | **Jump to variant:** Persistent Dismissible Use Cases |
|
|
181
|
+
| --- | --- | --- |
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Dialog
|
|
186
|
+
|
|
187
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
188
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
189
|
+
|
|
190
|
+
Dialogs are highly customizable and designed to accommodate a range of product needs; any combination of the following properties can be used:
|
|
191
|
+
|
|
192
|
+
* Overline text above the title, subtitle text below the title, or both
|
|
193
|
+
* Artwork above the title, whether a logo, icon, or illustration
|
|
194
|
+
|
|
195
|
+
There are four size options, each with a fixed width and minimum height (except for `xs` which has no minimum height):
|
|
196
|
+
|
|
197
|
+
* `xs` —`width: 400px`
|
|
198
|
+
* `s` —`width: 600px`, `min-height: 400px`
|
|
199
|
+
* `m` —`width: 900px`, `min-height: 480px`
|
|
200
|
+
* `l` —`width: 1200px`, `min-height: 600px`
|
|
201
|
+
|
|
202
|
+
Dialogs may be dismissed by:
|
|
203
|
+
|
|
204
|
+
* Clicking an action Button that is configured to close, cancel, or complete a multi-step workflow occurring in the Dialog
|
|
205
|
+
* Pressing the keyboard Esc key
|
|
206
|
+
* Clicking the close Tertiary Icon Button on Dismissible Dialogs
|
|
207
|
+
* Clicking outside of the Dialog. Doing this will result in any selections the user has made being lost, so it is recommended that the `canOutsideClickClose` prop remain set to `false` (the default setting) in instances where losing entered information would be a significant burden to the user
|
|
208
|
+
|
|
209
|
+
### Persistent Dialog
|
|
210
|
+
|
|
211
|
+
Use this variant when the user is unable to dismiss the Dialog without making a selection from one of the action Button(s). Because there is no way for the user to manually dismiss the Dialog, this variant must contain at least one action Button.
|
|
212
|
+
|
|
213
|
+
Persistent Dialogs are generally used in multi-step workflows where dismissing the Dialog would result in a loss of progress or when there is a need for users to confirm they have read the content on the Dialog before proceeding, such as when they are being directed to an external site (see Dialog Use Cases section below for details).
|
|
214
|
+
|
|
215
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
### Dismissible Dialog
|
|
226
|
+
|
|
227
|
+
Use this variant to allow the user the ability to manually dismiss the Dialog by clicking the close Tertiary Icon Button in the Dialog's upper right corner. Dismissing the Dialog will result in any selections the user has made being lost. Dismissible Dialogs should not be used in multi-step workflows where closing the Dialog would result in a loss of progress.
|
|
228
|
+
|
|
229
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
### Dialog Spacing
|
|
242
|
+
|
|
243
|
+
In instances where the length of content contained in the Dialog results in the Dialog filling the entire height of the screen, there must be a minimum of `spaceXxl` margin above and below the Dialog window. The Dialog content scrolls when it exceeds the max-height of the dialog window; title, overline, subtitle, and any action Buttons are anchored to the top and bottom during scrolling.
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
### Dialog Backdrop
|
|
250
|
+
|
|
251
|
+
A backdrop appears behind the active Dialog to bring emphasis to it as well as indicate to users that they cannot interact with the content on the page behind it.
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Dialog Use Cases
|
|
256
|
+
|
|
257
|
+
Details and guidelines around complex Dialog use cases, such as nested Dialogs and multi-step Dialog workflows.
|
|
258
|
+
|
|
259
|
+
### Nested Dialogs
|
|
260
|
+
|
|
261
|
+
Nested Dialogs should only be used in specific scenarios, most notably when a user is being directed to an external site and a final confirmation is needed.
|
|
262
|
+
|
|
263
|
+
Avoid using nested dialogs when possible because it introduces layers of complexity to pages and may make it more difficult for users to anticipate the results of their actions. It may also impede usability by making it more difficult for users to quickly exit a flow. Instead, explore utilizing a multi-step Dialog workflow (see below).
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
### Multi-step Dialog Workflow
|
|
268
|
+
|
|
269
|
+
Dialog workflows should contain no more than three steps. Workflows that are more than three steps should be designed as a full-page experience.
|
|
270
|
+
|
|
271
|
+
For a flow that takes place inside a Dialog, all steps within that workflow should take place within the same size Dialog for a consistent user experience. Each step of the workflow should also be clearly communicated within the Dialog using the overline text.
|
|
272
|
+
|
|
273
|
+
The Dialog should not be dismissible and the `canOutsideClickClose` prop should be set to `false` to prevent any accidental loss of progress.
|
|
274
|
+
|
|
275
|
+
## Code
|
|
276
|
+
|
|
277
|
+
## Dialog Component
|
|
278
|
+
|
|
279
|
+
| Below you will find an interactive Storybook iframe for Dialogs. 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:** Dialog |
|
|
280
|
+
| --- | --- | --- |
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
### Dialog
|
|
285
|
+
|
|
286
|
+
Storybook
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
A Dialog is a window element that appears on top of content to provide information or prompt the user for an action. When a Dialog is active, it disables all functionality of the page below and remains on the screen until it is either dismissed or an action has been taken.
|
|
293
|
+
|
|
294
|
+
## Guidelines
|
|
295
|
+
|
|
296
|
+
## Overview
|
|
297
|
+
|
|
298
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
299
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
300
|
+
|
|
301
|
+
### Dialog Variants
|
|
302
|
+
|
|
303
|
+
The interior of a Dialog can be filled with any content needed, whether that is to communicate information to the user or collect data from them via a form.
|
|
304
|
+
|
|
305
|
+
There are two Dialog variants available—Persistent and Dismissible. They are highly customizable and designed to accommodate a range of product needs.
|
|
306
|
+
|
|
307
|
+
Any combination of the following properties can be used:
|
|
308
|
+
|
|
309
|
+
* One or two Button(s), positioned to the right or left side of the dialog (positioned right by default)
|
|
310
|
+
* Overline text above the title
|
|
311
|
+
* Subtitle text below the title
|
|
312
|
+
* Artwork above the title (logo, icon, or illustration)
|
|
313
|
+
|
|
314
|
+
There are four size options, each with a fixed width and minimum height (except for `xs` which has no minimum height):
|
|
315
|
+
|
|
316
|
+
* `xs` —`width: 400px`
|
|
317
|
+
* `s` —`width: 600px`, `min-height: 400px`
|
|
318
|
+
* `m` —`width: 900px`, `min-height: 480px`
|
|
319
|
+
* `l` —`width: 1200px`, `min-height: 600px`
|
|
320
|
+
|
|
321
|
+
Users can dismiss them by:
|
|
322
|
+
|
|
323
|
+
* Clicking an action Button that is configured to close, cancel, or complete a multi-step workflow occurring in the Dialog
|
|
324
|
+
* Pressing the keyboard `Esc` key
|
|
325
|
+
* Clicking the close Tertiary Icon Button (Dismissible variant only)
|
|
326
|
+
* Clicking outside of the Dialog. Doing this will result in any selections the user has made being lost, so it is recommended that this be disabled in instances where losing entered information would be a significant burden to the user
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
### Live Instance
|
|
331
|
+
|
|
332
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
333
|
+
|
|
334
|
+
Default
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
### Dialog – Persistent
|
|
339
|
+
|
|
340
|
+
Use this variant when the user is unable to dismiss the Dialog without making a selection from one of the action Button(s). Because there is no way for the user to manually dismiss the Dialog, **this variant must contain at least one action Button**.
|
|
341
|
+
|
|
342
|
+
Persistent Dialogs are generally used:
|
|
343
|
+
|
|
344
|
+
* In multi-step workflows where dismissing the Dialog would result in a loss of progress
|
|
345
|
+
* When there is a need for users to confirm they have read the content on the Dialog before proceeding, such as when they are being directed to an external site (see Dialog Use Cases section below for details).
|
|
346
|
+
|
|
347
|
+
| 1 Button | 2 Buttons | 2 Buttons, left-aligned |
|
|
348
|
+
| --- | --- | --- |
|
|
349
|
+
|
|
350
|
+
| 2 Buttons, rounded | 2 Buttons + Overline + Subtitle | 2 Buttons + Artwork |
|
|
351
|
+
| --- | --- | --- |
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
### Dialog – Dismissible
|
|
356
|
+
|
|
357
|
+
Use this variant to allow the user the ability to manually dismiss the Dialog by clicking the close Tertiary Icon Button in the Dialog's upper right corner. Dismissing the Dialog will result in any selections the user has made being lost. Dismissible Dialogs should not be used in multi-step workflows where closing the Dialog would result in a loss of progress (see Dialog Use Cases section below for details).
|
|
358
|
+
|
|
359
|
+
| 0 Buttons | 1 Button | 2 Buttons | 2 Buttons, left-aligned |
|
|
360
|
+
| --- | --- | --- | --- |
|
|
361
|
+
|
|
362
|
+
| 2 Buttons, rounded | 2 Buttons + Overline + Subtitle | 2 Buttons + Artwork |
|
|
363
|
+
| --- | --- | --- |
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
### Dialog Spacing
|
|
368
|
+
|
|
369
|
+
In instances where the length of content contained in the Dialog results in the Dialog filling the entire height of the screen, there must be a minimum of `spaceXxl` margin above and below the Dialog window. The Dialog content scrolls when it exceeds the max-height of the dialog window; title, overline, subtitle, and any action Buttons are anchored to the top and bottom during scrolling.
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
### Dialog Backdrop
|
|
374
|
+
|
|
375
|
+
A backdrop appears behind the active Dialog to bring emphasis to it as well as indicate to users that they cannot interact with the content on the page behind it.
|
|
376
|
+
|
|
377
|
+
The default backdrop is dark and customizable at the product level.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
### Dialog Use Cases
|
|
382
|
+
|
|
383
|
+
Details and guidelines around complex Dialog use cases, such as nested Dialogs and multi-step Dialog workflows.
|
|
384
|
+
|
|
385
|
+
#### Nested Dialogs
|
|
386
|
+
|
|
387
|
+
Nested Dialogs should only be used in specific scenarios, most notably when a user is being directed to an external site and a final confirmation is needed.
|
|
388
|
+
|
|
389
|
+
Avoid using nested dialogs when possible because it introduces layers of complexity to pages and may make it more difficult for users to anticipate the results of their actions. It may also impede usability by making it more difficult for users to quickly exit a flow. Instead, explore utilizing a multi-step Dialog workflow (see below).
|
|
390
|
+
|
|
391
|
+
#### Multi-step Dialog Workflow
|
|
392
|
+
|
|
393
|
+
Dialog workflows should contain no more than three steps. Workflows that are more than three steps should be designed as a full-page experience.
|
|
394
|
+
|
|
395
|
+
For a flow that takes place inside a Dialog, all steps within that workflow should take place within the same size Dialog for a consistent user experience. Each step of the workflow should also be clearly communicated within the Dialog using the overline text.
|
|
396
|
+
|
|
397
|
+
The Dialog should not be dismissible to prevent any accidental loss of progress.
|
|
398
|
+
|
|
399
|
+
## Code
|
|
400
|
+
|
|
401
|
+
>**Note:** The code examples below must install dependencies before displaying and may take extra time to load
|
|
402
|
+
|
|
403
|
+
## Dialog
|
|
404
|
+
|
|
405
|
+
### SDS Source Code
|
|
406
|
+
|
|
407
|
+
The `Dialog` component's source code in the SDS codebase can be found here.
|
|
408
|
+
|
|
409
|
+
The `Dialog` component is accompanied by a number of other accessory components that can be used to help compose dialogs, but they are not required:
|
|
410
|
+
|
|
411
|
+
* Main `Dialog` component source code
|
|
412
|
+
* `DialogActions` source code
|
|
413
|
+
* `DialogContent` source code
|
|
414
|
+
* `DialogPaper` source code
|
|
415
|
+
* `DialogTitle` source code
|
|
416
|
+
|
|
417
|
+
### SDS vs MUI
|
|
418
|
+
|
|
419
|
+
The SDS `Dialog` component is built on top of MUI's `Dialog` component. SDS's `Dialog` passes a styled version of the `Paper` component (`DialogPaper`) to the `PaperComponent` prop. You can further style this `DialogPaper` component and pass it to your SDS `Dialog` via the `PaperComponent` prop (a prop of SDS `Dialog`) if needed.
|
|
420
|
+
|
|
421
|
+
The SDS `Dialog` does **not** support the `fullScreen` prop that the MUI component has (which allows dialogs to overtake the full screen).
|
|
422
|
+
|
|
423
|
+
### MUI Documentation
|
|
424
|
+
|
|
425
|
+
Documentation for the underlying MUI component can be found here.
|
|
426
|
+
|
|
427
|
+
### Props
|
|
428
|
+
|
|
429
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
430
|
+
|
|
431
|
+
#### Dialog Props
|
|
432
|
+
|
|
433
|
+
Props table for the Dialog component.
|
|
434
|
+
|
|
435
|
+
| Name | Type | Default | Description |
|
|
436
|
+
| --- | --- | --- | --- |
|
|
437
|
+
| `canClickOutsideClose` | `bool` | `false` | A boolean prop that determines whether clicking outside of the Dialog should trigger its closure. |
|
|
438
|
+
| `onClose` | `func` | `function(event: object, reason: string) => void` | A callback function that is invoked when the Dialog is closed. It receives two parameters: `event`. The event source of the callback. `reason`. Can be: .`escapeKeyDown`., .`backdropClick`. |
|
|
439
|
+
| `sdsSize` | `"xs"` `| "s"` `| "m"` `| "l"` | `m` | Controls the size of the Dialog component. |
|
|
440
|
+
|
|
441
|
+
#### DialogTitle Props
|
|
442
|
+
|
|
443
|
+
Props table for the DialogTitle component.
|
|
444
|
+
|
|
445
|
+
| Name | Type | Default | Description |
|
|
446
|
+
| --- | --- | --- | --- |
|
|
447
|
+
| `title` | `string` | `-` | This prop represents the title text to be displayed in the Dialog component. |
|
|
448
|
+
| `subtitle` | `string` | `-` | The subtitle prop allows you to include additional descriptive text beneath the title within the Dialog. |
|
|
449
|
+
| `onClose` | `func` | `function(event: object, reason: string) => void` | When the `onClose` prop is set, it results in the appearance of a small `x` icon in the top-right corner of the Dialog. This `x` icon provides users with a visual cue to close the Dialog, and clicking on it invokes the specified `onClose` function. |
|
|
450
|
+
| `open` | `bool` | `false` | If `true`, the component is shown. |
|
|
451
|
+
|
|
452
|
+
#### DialogActions Props
|
|
453
|
+
|
|
454
|
+
Props table for the DialogActions component.
|
|
455
|
+
|
|
456
|
+
| Name | Type | Default | Description |
|
|
457
|
+
| --- | --- | --- | --- |
|
|
458
|
+
| `buttonPosition` | `"left" | "right"` | `left` | Specifies the position of action buttons within the Dialog component. It can be set to either `left` or `right` , allowing you to control the alignment of these buttons. |
|
|
459
|
+
|
|
460
|
+
### Code examples
|
|
461
|
+
|
|
462
|
+
#### Default Dialog
|
|
463
|
+
|
|
464
|
+
This example has the minimum props needed for the `Dialog` component.
|
|
465
|
+
|
|
466
|
+
**/styles.css**
|
|
467
|
+
|
|
468
|
+
```css
|
|
469
|
+
body {
|
|
470
|
+
font-size: 13px;
|
|
471
|
+
font-weight: 400;
|
|
472
|
+
letter-spacing: 0.08px;
|
|
473
|
+
line-height: 20px;
|
|
474
|
+
text-transform: none;
|
|
475
|
+
font-family: "Inter", sans-serif;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
h1 {
|
|
479
|
+
font-size: 1.5rem;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.app {
|
|
483
|
+
padding: 20px;
|
|
484
|
+
}
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
**tsconfig.json**
|
|
488
|
+
|
|
489
|
+
```json
|
|
490
|
+
{
|
|
491
|
+
"include": [
|
|
492
|
+
"./**/*"
|
|
493
|
+
],
|
|
494
|
+
"compilerOptions": {
|
|
495
|
+
"strict": true,
|
|
496
|
+
"esModuleInterop": true,
|
|
497
|
+
"lib": [ "dom", "es2015" ],
|
|
498
|
+
"jsx": "react-jsx"
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
**/App.tsx**
|
|
504
|
+
|
|
505
|
+
```tsx
|
|
506
|
+
// Most minimal Dialog (just has the basic requirements)
|
|
507
|
+
|
|
508
|
+
import {useState} from "react";
|
|
509
|
+
import { Button, Dialog, DialogTitle, DialogContent, DialogActions } from "@czi-sds/components";
|
|
510
|
+
import "./styles.css";
|
|
511
|
+
|
|
512
|
+
function App() {
|
|
513
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
514
|
+
|
|
515
|
+
function handleClick() {
|
|
516
|
+
setIsOpen(true);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
function handleClose() {
|
|
520
|
+
setIsOpen(false);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
return (
|
|
524
|
+
<div className="app">
|
|
525
|
+
<Button sdsStyle="minimal" sdsType="primary" onClick={handleClick}>
|
|
526
|
+
Open Dialog
|
|
527
|
+
</Button>
|
|
528
|
+
<Dialog onClose={handleClose} open={isOpen} sdsSize="xs">
|
|
529
|
+
<DialogTitle
|
|
530
|
+
title="Learning"
|
|
531
|
+
subtitle="Learning Resources"
|
|
532
|
+
onClose={handleClose}
|
|
533
|
+
/>
|
|
534
|
+
<DialogContent>
|
|
535
|
+
Embark on a journey of continuous improvement with our treasure trove of learning
|
|
536
|
+
materials. This section hosts an array of tutorials, guides, and insightful
|
|
537
|
+
articles designed to enhance your skills and deepen your understanding.
|
|
538
|
+
</DialogContent>
|
|
539
|
+
</Dialog>
|
|
540
|
+
</div>
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export default App;
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
**/index.tsx**
|
|
548
|
+
|
|
549
|
+
```tsx
|
|
550
|
+
import React from "react";
|
|
551
|
+
import { createRoot } from "react-dom/client";
|
|
552
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
553
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
554
|
+
import { Theme } from "@czi-sds/components";
|
|
555
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
556
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
557
|
+
|
|
558
|
+
import App from "./App";
|
|
559
|
+
|
|
560
|
+
const container = document.getElementById("root");
|
|
561
|
+
const root = createRoot(container!);
|
|
562
|
+
|
|
563
|
+
const RootApp = () => {
|
|
564
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
565
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
566
|
+
|
|
567
|
+
return (
|
|
568
|
+
<StyledEngineProvider injectFirst>
|
|
569
|
+
<ThemeProvider theme={theme}>
|
|
570
|
+
<EmotionThemeProvider theme={theme}>
|
|
571
|
+
<CssBaseline />
|
|
572
|
+
<App />
|
|
573
|
+
</EmotionThemeProvider>
|
|
574
|
+
</ThemeProvider>
|
|
575
|
+
</StyledEngineProvider>
|
|
576
|
+
);
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
root.render(
|
|
580
|
+
<React.StrictMode>
|
|
581
|
+
<RootApp />
|
|
582
|
+
</React.StrictMode>
|
|
583
|
+
);
|
|
584
|
+
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
**/public/index.html**
|
|
588
|
+
|
|
589
|
+
```html
|
|
590
|
+
<!DOCTYPE html>
|
|
591
|
+
<html lang="en">
|
|
592
|
+
<head>
|
|
593
|
+
<meta charset="UTF-8" />
|
|
594
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
595
|
+
<title>Dialog</title>
|
|
596
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
597
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
598
|
+
<link
|
|
599
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
600
|
+
rel="stylesheet"
|
|
601
|
+
/>
|
|
602
|
+
<link
|
|
603
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
604
|
+
rel="stylesheet"
|
|
605
|
+
/>
|
|
606
|
+
</head>
|
|
607
|
+
<body>
|
|
608
|
+
<div id="root"></div>
|
|
609
|
+
</body>
|
|
610
|
+
</html>
|
|
611
|
+
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
**/package.json**
|
|
615
|
+
|
|
616
|
+
```json
|
|
617
|
+
{"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"}
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
---
|
|
621
|
+
|
|
622
|
+
#### Dialog with `canclickOutsideClose` set as `false`
|
|
623
|
+
|
|
624
|
+
This example demonstrates a `Dialog` component that remains open even when clicked outside of the `Dialog`.
|
|
625
|
+
|
|
626
|
+
**/styles.css**
|
|
627
|
+
|
|
628
|
+
```css
|
|
629
|
+
body {
|
|
630
|
+
font-size: 13px;
|
|
631
|
+
font-weight: 400;
|
|
632
|
+
letter-spacing: 0.08px;
|
|
633
|
+
line-height: 20px;
|
|
634
|
+
text-transform: none;
|
|
635
|
+
font-family: "Inter", sans-serif;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
h1 {
|
|
639
|
+
font-size: 1.5rem;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
.app {
|
|
643
|
+
padding: 20px;
|
|
644
|
+
}
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
**tsconfig.json**
|
|
648
|
+
|
|
649
|
+
```json
|
|
650
|
+
{
|
|
651
|
+
"include": [
|
|
652
|
+
"./**/*"
|
|
653
|
+
],
|
|
654
|
+
"compilerOptions": {
|
|
655
|
+
"strict": true,
|
|
656
|
+
"esModuleInterop": true,
|
|
657
|
+
"lib": [ "dom", "es2015" ],
|
|
658
|
+
"jsx": "react-jsx"
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
**/App.tsx**
|
|
664
|
+
|
|
665
|
+
```tsx
|
|
666
|
+
import {useState} from "react";
|
|
667
|
+
import { Button, Dialog, DialogTitle, DialogContent, DialogActions } from "@czi-sds/components";
|
|
668
|
+
import "./styles.css";
|
|
669
|
+
|
|
670
|
+
function App() {
|
|
671
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
672
|
+
|
|
673
|
+
function handleClick() {
|
|
674
|
+
setIsOpen(true);
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
function handleClose() {
|
|
678
|
+
setIsOpen(false);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
return (
|
|
682
|
+
<div className="app">
|
|
683
|
+
<Button sdsStyle="minimal" sdsType="primary" onClick={handleClick}>
|
|
684
|
+
Open Dialog
|
|
685
|
+
</Button>
|
|
686
|
+
<Dialog onClose={handleClose} open={isOpen} sdsSize="xs" canClickOutsideClose={false}>
|
|
687
|
+
<DialogTitle
|
|
688
|
+
title="Welcome"
|
|
689
|
+
subtitle="New features showcase"
|
|
690
|
+
onClose={handleClose}
|
|
691
|
+
/>
|
|
692
|
+
<DialogContent>
|
|
693
|
+
We are thrilled to introduce you to our latest enhancements and features.
|
|
694
|
+
In this interactive showcase, you'll have the opportunity to explore a
|
|
695
|
+
wide range of improvements designed to elevate your user experience.
|
|
696
|
+
Whether it's streamlined navigation, enhanced performance, or delightful
|
|
697
|
+
visual enhancements, we've got something for everyone. Dive in and
|
|
698
|
+
discover what's new!
|
|
699
|
+
</DialogContent>
|
|
700
|
+
</Dialog>
|
|
701
|
+
</div>
|
|
702
|
+
);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
export default App;
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
**/index.tsx**
|
|
709
|
+
|
|
710
|
+
```tsx
|
|
711
|
+
import React from "react";
|
|
712
|
+
import { createRoot } from "react-dom/client";
|
|
713
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
714
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
715
|
+
import { Theme } from "@czi-sds/components";
|
|
716
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
717
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
718
|
+
|
|
719
|
+
import App from "./App";
|
|
720
|
+
|
|
721
|
+
const container = document.getElementById("root");
|
|
722
|
+
const root = createRoot(container!);
|
|
723
|
+
|
|
724
|
+
const RootApp = () => {
|
|
725
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
726
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
727
|
+
|
|
728
|
+
return (
|
|
729
|
+
<StyledEngineProvider injectFirst>
|
|
730
|
+
<ThemeProvider theme={theme}>
|
|
731
|
+
<EmotionThemeProvider theme={theme}>
|
|
732
|
+
<CssBaseline />
|
|
733
|
+
<App />
|
|
734
|
+
</EmotionThemeProvider>
|
|
735
|
+
</ThemeProvider>
|
|
736
|
+
</StyledEngineProvider>
|
|
737
|
+
);
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
root.render(
|
|
741
|
+
<React.StrictMode>
|
|
742
|
+
<RootApp />
|
|
743
|
+
</React.StrictMode>
|
|
744
|
+
);
|
|
745
|
+
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
**/public/index.html**
|
|
749
|
+
|
|
750
|
+
```html
|
|
751
|
+
<!DOCTYPE html>
|
|
752
|
+
<html lang="en">
|
|
753
|
+
<head>
|
|
754
|
+
<meta charset="UTF-8" />
|
|
755
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
756
|
+
<title>Dialog</title>
|
|
757
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
758
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
759
|
+
<link
|
|
760
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
761
|
+
rel="stylesheet"
|
|
762
|
+
/>
|
|
763
|
+
<link
|
|
764
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
765
|
+
rel="stylesheet"
|
|
766
|
+
/>
|
|
767
|
+
</head>
|
|
768
|
+
<body>
|
|
769
|
+
<div id="root"></div>
|
|
770
|
+
</body>
|
|
771
|
+
</html>
|
|
772
|
+
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
**/package.json**
|
|
776
|
+
|
|
777
|
+
```json
|
|
778
|
+
{"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"}
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
---
|
|
782
|
+
|
|
783
|
+
#### Dialog with Action Buttons
|
|
784
|
+
|
|
785
|
+
This example demonstrates a `Dialog` component that features action `Buttons` located in the dialog's footer.
|
|
786
|
+
|
|
787
|
+
**/styles.css**
|
|
788
|
+
|
|
789
|
+
```css
|
|
790
|
+
body {
|
|
791
|
+
font-size: 13px;
|
|
792
|
+
font-weight: 400;
|
|
793
|
+
letter-spacing: 0.08px;
|
|
794
|
+
line-height: 20px;
|
|
795
|
+
text-transform: none;
|
|
796
|
+
font-family: "Inter", sans-serif;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
h1 {
|
|
800
|
+
font-size: 1.5rem;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
.app {
|
|
804
|
+
padding: 20px;
|
|
805
|
+
}
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
**tsconfig.json**
|
|
809
|
+
|
|
810
|
+
```json
|
|
811
|
+
{
|
|
812
|
+
"include": [
|
|
813
|
+
"./**/*"
|
|
814
|
+
],
|
|
815
|
+
"compilerOptions": {
|
|
816
|
+
"strict": true,
|
|
817
|
+
"esModuleInterop": true,
|
|
818
|
+
"lib": [ "dom", "es2015" ],
|
|
819
|
+
"jsx": "react-jsx"
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
```
|
|
823
|
+
|
|
824
|
+
**/App.tsx**
|
|
825
|
+
|
|
826
|
+
```tsx
|
|
827
|
+
import {useState} from "react";
|
|
828
|
+
import { Button, Dialog, DialogTitle, DialogContent, DialogActions } from "@czi-sds/components";
|
|
829
|
+
import "./styles.css";
|
|
830
|
+
|
|
831
|
+
function App() {
|
|
832
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
833
|
+
|
|
834
|
+
function handleClick() {
|
|
835
|
+
setIsOpen(true);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
function handleClose() {
|
|
839
|
+
setIsOpen(false);
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
return (
|
|
843
|
+
<div className="app">
|
|
844
|
+
<Button sdsStyle="minimal" sdsType="primary" onClick={handleClick}>
|
|
845
|
+
Open Dialog
|
|
846
|
+
</Button>
|
|
847
|
+
<Dialog onClose={handleClose} open={isOpen} sdsSize="xs">
|
|
848
|
+
<DialogTitle
|
|
849
|
+
title="Learning"
|
|
850
|
+
subtitle="Learning Resources"
|
|
851
|
+
onClose={handleClose}
|
|
852
|
+
/>
|
|
853
|
+
<DialogContent>
|
|
854
|
+
Embark on a journey of continuous improvement with our treasure trove of learning
|
|
855
|
+
materials. This section hosts an array of tutorials, guides, and insightful
|
|
856
|
+
articles designed to enhance your skills and deepen your understanding.
|
|
857
|
+
</DialogContent>
|
|
858
|
+
<DialogActions
|
|
859
|
+
buttonPosition="right"
|
|
860
|
+
>
|
|
861
|
+
<Button sdsStyle="square" sdsType="secondary" onClick={handleClose}>
|
|
862
|
+
Secondary Action
|
|
863
|
+
</Button>
|
|
864
|
+
<Button sdsStyle="square" sdsType="primary" onClick={handleClose}>
|
|
865
|
+
Primary Action
|
|
866
|
+
</Button>
|
|
867
|
+
</DialogActions>
|
|
868
|
+
</Dialog>
|
|
869
|
+
</div>
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
export default App;
|
|
874
|
+
```
|
|
875
|
+
|
|
876
|
+
**/index.tsx**
|
|
877
|
+
|
|
878
|
+
```tsx
|
|
879
|
+
import React from "react";
|
|
880
|
+
import { createRoot } from "react-dom/client";
|
|
881
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
882
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
883
|
+
import { Theme } from "@czi-sds/components";
|
|
884
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
885
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
886
|
+
|
|
887
|
+
import App from "./App";
|
|
888
|
+
|
|
889
|
+
const container = document.getElementById("root");
|
|
890
|
+
const root = createRoot(container!);
|
|
891
|
+
|
|
892
|
+
const RootApp = () => {
|
|
893
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
894
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
895
|
+
|
|
896
|
+
return (
|
|
897
|
+
<StyledEngineProvider injectFirst>
|
|
898
|
+
<ThemeProvider theme={theme}>
|
|
899
|
+
<EmotionThemeProvider theme={theme}>
|
|
900
|
+
<CssBaseline />
|
|
901
|
+
<App />
|
|
902
|
+
</EmotionThemeProvider>
|
|
903
|
+
</ThemeProvider>
|
|
904
|
+
</StyledEngineProvider>
|
|
905
|
+
);
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
root.render(
|
|
909
|
+
<React.StrictMode>
|
|
910
|
+
<RootApp />
|
|
911
|
+
</React.StrictMode>
|
|
912
|
+
);
|
|
913
|
+
|
|
914
|
+
```
|
|
915
|
+
|
|
916
|
+
**/public/index.html**
|
|
917
|
+
|
|
918
|
+
```html
|
|
919
|
+
<!DOCTYPE html>
|
|
920
|
+
<html lang="en">
|
|
921
|
+
<head>
|
|
922
|
+
<meta charset="UTF-8" />
|
|
923
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
924
|
+
<title>Dialog</title>
|
|
925
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
926
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
927
|
+
<link
|
|
928
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
929
|
+
rel="stylesheet"
|
|
930
|
+
/>
|
|
931
|
+
<link
|
|
932
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
933
|
+
rel="stylesheet"
|
|
934
|
+
/>
|
|
935
|
+
</head>
|
|
936
|
+
<body>
|
|
937
|
+
<div id="root"></div>
|
|
938
|
+
</body>
|
|
939
|
+
</html>
|
|
940
|
+
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
**/package.json**
|
|
944
|
+
|
|
945
|
+
```json
|
|
946
|
+
{"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"}
|
|
947
|
+
```
|
|
948
|
+
|
|
949
|
+
---
|
|
950
|
+
|
|
951
|
+
#### Dialog with a long content
|
|
952
|
+
|
|
953
|
+
This example showcases a `Dialog` component with lengthy content. To manage the display of this extended content, SDS intelligently adds scroll functionality to the `dialogContent` area. This ensures that users can easily access any `Dialog` action buttons that may be present.
|
|
954
|
+
|
|
955
|
+
**/styles.css**
|
|
956
|
+
|
|
957
|
+
```css
|
|
958
|
+
body {
|
|
959
|
+
font-size: 13px;
|
|
960
|
+
font-weight: 400;
|
|
961
|
+
letter-spacing: 0.08px;
|
|
962
|
+
line-height: 20px;
|
|
963
|
+
text-transform: none;
|
|
964
|
+
font-family: "Inter", sans-serif;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
h1 {
|
|
968
|
+
font-size: 1.5rem;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
.app {
|
|
972
|
+
padding: 20px;
|
|
973
|
+
}
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
**tsconfig.json**
|
|
977
|
+
|
|
978
|
+
```json
|
|
979
|
+
{
|
|
980
|
+
"include": [
|
|
981
|
+
"./**/*"
|
|
982
|
+
],
|
|
983
|
+
"compilerOptions": {
|
|
984
|
+
"strict": true,
|
|
985
|
+
"esModuleInterop": true,
|
|
986
|
+
"lib": [ "dom", "es2015" ],
|
|
987
|
+
"jsx": "react-jsx"
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
```
|
|
991
|
+
|
|
992
|
+
**/App.tsx**
|
|
993
|
+
|
|
994
|
+
```tsx
|
|
995
|
+
// Most minimal Dialog (just has the basic requirements)
|
|
996
|
+
|
|
997
|
+
import {useState} from "react";
|
|
998
|
+
import { Button, Dialog, DialogTitle, DialogContent, DialogActions } from "@czi-sds/components";
|
|
999
|
+
import "./styles.css";
|
|
1000
|
+
|
|
1001
|
+
function App() {
|
|
1002
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
1003
|
+
|
|
1004
|
+
function handleClick() {
|
|
1005
|
+
setIsOpen(true);
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
function handleClose() {
|
|
1009
|
+
setIsOpen(false);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
return (
|
|
1013
|
+
<div className="app">
|
|
1014
|
+
<Button sdsStyle="minimal" sdsType="primary" onClick={handleClick}>
|
|
1015
|
+
Open Dialog
|
|
1016
|
+
</Button>
|
|
1017
|
+
<Dialog onClose={handleClose} open={isOpen} sdsSize="xs">
|
|
1018
|
+
<DialogTitle
|
|
1019
|
+
title="Learning"
|
|
1020
|
+
subtitle="Learning Resources"
|
|
1021
|
+
onClose={handleClose}
|
|
1022
|
+
/>
|
|
1023
|
+
<DialogContent>
|
|
1024
|
+
Embark on a fulfilling journey of continuous improvement with our vast
|
|
1025
|
+
repository of valuable learning resources. Within this dedicated section,
|
|
1026
|
+
you'll find an extensive collection of meticulously crafted tutorials,
|
|
1027
|
+
comprehensive guides, and thought-provoking articles meticulously designed
|
|
1028
|
+
to enrich your skill set and provide profound insights into your field of interest.
|
|
1029
|
+
|
|
1030
|
+
Explore a diverse range of topics, from fundamental principles to advanced techniques,
|
|
1031
|
+
as we aim to empower you with knowledge that transcends boundaries. Whether
|
|
1032
|
+
you're a novice eager to build a strong foundation or a seasoned professional
|
|
1033
|
+
seeking to stay at the forefront of your industry, our treasure trove of educational
|
|
1034
|
+
materials is your gateway to honing your expertise.
|
|
1035
|
+
|
|
1036
|
+
Unlock your potential, expand your horizons, and stay ahead of the curve by immersing
|
|
1037
|
+
yourself in this wealth of knowledge. We believe that continuous learning is the key
|
|
1038
|
+
to personal and professional growth, and we're excited to accompany you on this
|
|
1039
|
+
educational journey, every step of the way.
|
|
1040
|
+
</DialogContent>
|
|
1041
|
+
<DialogActions
|
|
1042
|
+
buttonPosition="left"
|
|
1043
|
+
>
|
|
1044
|
+
<Button sdsStyle="square" sdsType="primary" onClick={handleClose}>
|
|
1045
|
+
Primary Action
|
|
1046
|
+
</Button>
|
|
1047
|
+
<Button sdsStyle="square" sdsType="secondary" onClick={handleClose}>
|
|
1048
|
+
Secondary Action
|
|
1049
|
+
</Button>
|
|
1050
|
+
</DialogActions>
|
|
1051
|
+
</Dialog>
|
|
1052
|
+
</div>
|
|
1053
|
+
);
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
export default App;
|
|
1057
|
+
```
|
|
1058
|
+
|
|
1059
|
+
**/index.tsx**
|
|
1060
|
+
|
|
1061
|
+
```tsx
|
|
1062
|
+
import React from "react";
|
|
1063
|
+
import { createRoot } from "react-dom/client";
|
|
1064
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1065
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
1066
|
+
import { Theme } from "@czi-sds/components";
|
|
1067
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
1068
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
1069
|
+
|
|
1070
|
+
import App from "./App";
|
|
1071
|
+
|
|
1072
|
+
const container = document.getElementById("root");
|
|
1073
|
+
const root = createRoot(container!);
|
|
1074
|
+
|
|
1075
|
+
const RootApp = () => {
|
|
1076
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
1077
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
1078
|
+
|
|
1079
|
+
return (
|
|
1080
|
+
<StyledEngineProvider injectFirst>
|
|
1081
|
+
<ThemeProvider theme={theme}>
|
|
1082
|
+
<EmotionThemeProvider theme={theme}>
|
|
1083
|
+
<CssBaseline />
|
|
1084
|
+
<App />
|
|
1085
|
+
</EmotionThemeProvider>
|
|
1086
|
+
</ThemeProvider>
|
|
1087
|
+
</StyledEngineProvider>
|
|
1088
|
+
);
|
|
1089
|
+
};
|
|
1090
|
+
|
|
1091
|
+
root.render(
|
|
1092
|
+
<React.StrictMode>
|
|
1093
|
+
<RootApp />
|
|
1094
|
+
</React.StrictMode>
|
|
1095
|
+
);
|
|
1096
|
+
|
|
1097
|
+
```
|
|
1098
|
+
|
|
1099
|
+
**/public/index.html**
|
|
1100
|
+
|
|
1101
|
+
```html
|
|
1102
|
+
<!DOCTYPE html>
|
|
1103
|
+
<html lang="en">
|
|
1104
|
+
<head>
|
|
1105
|
+
<meta charset="UTF-8" />
|
|
1106
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1107
|
+
<title>Dialog</title>
|
|
1108
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1109
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1110
|
+
<link
|
|
1111
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
1112
|
+
rel="stylesheet"
|
|
1113
|
+
/>
|
|
1114
|
+
<link
|
|
1115
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
1116
|
+
rel="stylesheet"
|
|
1117
|
+
/>
|
|
1118
|
+
</head>
|
|
1119
|
+
<body>
|
|
1120
|
+
<div id="root"></div>
|
|
1121
|
+
</body>
|
|
1122
|
+
</html>
|
|
1123
|
+
|
|
1124
|
+
```
|
|
1125
|
+
|
|
1126
|
+
**/package.json**
|
|
1127
|
+
|
|
1128
|
+
```json
|
|
1129
|
+
{"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"}
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
---
|
|
1133
|
+
|