@czi-sds/mcp 0.16.0 → 0.18.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.
Files changed (167) hide show
  1. package/README.md +2 -1
  2. package/data/component-docs/Accordion.md +291 -0
  3. package/data/component-docs/Autocomplete.md +525 -0
  4. package/data/component-docs/Banner.md +231 -0
  5. package/data/component-docs/Button.md +224 -0
  6. package/data/component-docs/ButtonDropdown.md +256 -0
  7. package/data/component-docs/ButtonGroup.md +320 -0
  8. package/data/component-docs/ButtonToggle.md +397 -0
  9. package/data/component-docs/Callout.md +268 -0
  10. package/data/component-docs/CellBasic.md +122 -0
  11. package/data/component-docs/CellComponent.md +63 -0
  12. package/data/component-docs/CellHeader.md +128 -0
  13. package/data/component-docs/ComplexFilter.md +294 -0
  14. package/data/component-docs/ContentCard.md +406 -0
  15. package/data/component-docs/Dialog.md +651 -0
  16. package/data/component-docs/Dropdown.md +155 -0
  17. package/data/component-docs/DropdownMenu.md +949 -0
  18. package/data/component-docs/HeatmapChart.md +782 -0
  19. package/data/component-docs/Hero.md +363 -0
  20. package/data/component-docs/Icon.md +283 -0
  21. package/data/component-docs/InputCheckbox.md +205 -0
  22. package/data/component-docs/InputDropdown.md +482 -0
  23. package/data/component-docs/InputRadio.md +173 -0
  24. package/data/component-docs/InputSearch.md +81 -0
  25. package/data/component-docs/InputSlider.md +189 -0
  26. package/data/component-docs/InputText.md +110 -0
  27. package/data/component-docs/InputToggle.md +141 -0
  28. package/data/component-docs/IntentMessage.md +293 -0
  29. package/data/component-docs/Legend.md +442 -0
  30. package/data/component-docs/Link.md +23 -0
  31. package/data/component-docs/List.md +300 -0
  32. package/data/component-docs/LoadingIndicator.md +198 -0
  33. package/data/component-docs/Menu.md +298 -0
  34. package/data/component-docs/MenuItem.md +100 -0
  35. package/data/component-docs/NavigationFooter.md +165 -0
  36. package/data/component-docs/NavigationHeader.md +500 -0
  37. package/data/component-docs/NavigationJumpTo.md +414 -0
  38. package/data/component-docs/Notification.md +288 -0
  39. package/data/component-docs/Pagination.md +67 -0
  40. package/data/component-docs/Panel.md +636 -0
  41. package/data/component-docs/Popover.md +448 -0
  42. package/data/component-docs/PreComposedTable.md +2947 -0
  43. package/data/component-docs/ProteinStructureViewer.md +1044 -0
  44. package/data/component-docs/SegmentedControl.md +396 -0
  45. package/data/component-docs/StackedBarChart.md +475 -0
  46. package/data/component-docs/Table.md +2000 -0
  47. package/data/component-docs/TableHeader.md +53 -0
  48. package/data/component-docs/TableRow.md +74 -0
  49. package/data/component-docs/Tabs.md +455 -0
  50. package/data/component-docs/Tag.md +647 -0
  51. package/data/component-docs/TagFilter.md +131 -0
  52. package/data/component-docs/Tooltip.md +561 -0
  53. package/data/component-docs/TooltipCondensed.md +203 -0
  54. package/data/component-docs/TooltipTable.md +145 -0
  55. package/data/component-docs/index.json +267 -0
  56. package/data/component-list.json +2 -5
  57. package/data/component-props/Accordion.json +31 -11
  58. package/data/component-props/Alert.json +3 -3
  59. package/data/component-props/Autocomplete.json +150 -15
  60. package/data/component-props/Banner.json +31 -17
  61. package/data/component-props/Button.json +45 -20
  62. package/data/component-props/ButtonDropdown.json +36 -17
  63. package/data/component-props/ButtonDropdownLegacy.json +11 -11
  64. package/data/component-props/ButtonGroup.json +32 -11
  65. package/data/component-props/ButtonIcon.json +10 -10
  66. package/data/component-props/ButtonLegacy.json +19 -19
  67. package/data/component-props/ButtonToggle.json +32 -19
  68. package/data/component-props/ButtonToggleLegacy.json +11 -11
  69. package/data/component-props/Callout.json +58 -17
  70. package/data/component-props/CellBasic.json +94 -41
  71. package/data/component-props/CellComponent.json +23 -7
  72. package/data/component-props/CellHeader.json +62 -19
  73. package/data/component-props/ComplexFilter.json +52 -21
  74. package/data/component-props/ContentCard.json +70 -47
  75. package/data/component-props/Dialog.json +47 -14
  76. package/data/component-props/Dropdown.json +68 -31
  77. package/data/component-props/DropdownMenu.json +128 -23
  78. package/data/component-props/HeatmapChart.json +88 -12
  79. package/data/component-props/Hero.json +80 -39
  80. package/data/component-props/Icon.json +20 -9
  81. package/data/component-props/InputCheckbox.json +36 -14
  82. package/data/component-props/InputDropdown.json +75 -27
  83. package/data/component-props/InputRadio.json +31 -13
  84. package/data/component-props/InputSearch.json +41 -18
  85. package/data/component-props/InputSlider.json +46 -19
  86. package/data/component-props/InputText.json +26 -19
  87. package/data/component-props/InputToggle.json +26 -9
  88. package/data/component-props/IntentMessage.json +38 -9
  89. package/data/component-props/Link.json +13 -7
  90. package/data/component-props/LoadingIndicator.json +11 -3
  91. package/data/component-props/MenuItem.json +38 -19
  92. package/data/component-props/MenuSelect.json +8 -8
  93. package/data/component-props/NavigationFooter.json +49 -19
  94. package/data/component-props/NavigationHeader.json +150 -37
  95. package/data/component-props/NavigationJumpTo.json +33 -7
  96. package/data/component-props/Notification.json +39 -21
  97. package/data/component-props/Pagination.json +39 -11
  98. package/data/component-props/Panel.json +62 -9
  99. package/data/component-props/Popover.json +80 -7
  100. package/data/component-props/PreComposedTable.json +99 -27
  101. package/data/component-props/ProteinStructureViewer.json +117 -0
  102. package/data/component-props/SegmentedControl.json +42 -3
  103. package/data/component-props/StackedBarChart.json +116 -42
  104. package/data/component-props/TableRow.json +38 -19
  105. package/data/component-props/Tabs.json +66 -9
  106. package/data/component-props/Tag.json +34 -17
  107. package/data/component-props/TagFilter.json +10 -3
  108. package/data/component-props/Tooltip.json +49 -18
  109. package/data/component-props/TooltipCondensed.json +18 -9
  110. package/data/component-props/TooltipTable.json +17 -7
  111. package/data/resources/{zeroheight-rules.md → documentation-rules.md} +43 -30
  112. package/data/resources/figma-rules.md +2 -2
  113. package/data/tailwind.json +20 -14
  114. package/dist/stdio.js +112 -208
  115. package/package.json +9 -5
  116. package/data/component-props/ButtonDropdownV2.json +0 -34
  117. package/data/component-props/ButtonNew.json +0 -47
  118. package/data/component-props/ButtonToggleV2.json +0 -44
  119. package/data/component-props/ButtonV2.json +0 -43
  120. package/data/zeroheight-cache.json +0 -10259
  121. package/data/zeroheight-exports/Accordion.md +0 -774
  122. package/data/zeroheight-exports/Banner.md +0 -691
  123. package/data/zeroheight-exports/Borders.md +0 -117
  124. package/data/zeroheight-exports/Buttons.md +0 -1854
  125. package/data/zeroheight-exports/Callout.md +0 -931
  126. package/data/zeroheight-exports/Colors.md +0 -1755
  127. package/data/zeroheight-exports/Content-Card.md +0 -309
  128. package/data/zeroheight-exports/Contributing-to-SDS.md +0 -98
  129. package/data/zeroheight-exports/Control-Inputs.md +0 -2818
  130. package/data/zeroheight-exports/Corners.md +0 -104
  131. package/data/zeroheight-exports/Cover-page.md +0 -3
  132. package/data/zeroheight-exports/Dialog.md +0 -1367
  133. package/data/zeroheight-exports/Downloads.md +0 -236
  134. package/data/zeroheight-exports/Drop-Shadows.md +0 -79
  135. package/data/zeroheight-exports/Dropdown-Input.md +0 -1776
  136. package/data/zeroheight-exports/Dropdown-Menus.md +0 -913
  137. package/data/zeroheight-exports/Element-Status-Tracker.md +0 -267
  138. package/data/zeroheight-exports/Field-Inputs.md +0 -1405
  139. package/data/zeroheight-exports/Filters.md +0 -1111
  140. package/data/zeroheight-exports/Getting-Started.md +0 -1157
  141. package/data/zeroheight-exports/Hero.md +0 -414
  142. package/data/zeroheight-exports/Icons.md +0 -2067
  143. package/data/zeroheight-exports/Intent.md +0 -86
  144. package/data/zeroheight-exports/Introduction-to-Bases.md +0 -35
  145. package/data/zeroheight-exports/Introduction-to-Cells.md +0 -35
  146. package/data/zeroheight-exports/Introduction-to-DNA.md +0 -35
  147. package/data/zeroheight-exports/Introduction-to-Genes.md +0 -35
  148. package/data/zeroheight-exports/Introduction.md +0 -115
  149. package/data/zeroheight-exports/Link.md +0 -432
  150. package/data/zeroheight-exports/Lists.md +0 -986
  151. package/data/zeroheight-exports/Loading-Indicator.md +0 -41
  152. package/data/zeroheight-exports/Navigation.md +0 -1190
  153. package/data/zeroheight-exports/Notification.md +0 -1038
  154. package/data/zeroheight-exports/Panel.md +0 -1030
  155. package/data/zeroheight-exports/README.md +0 -122
  156. package/data/zeroheight-exports/Responsive-Design.md +0 -330
  157. package/data/zeroheight-exports/Search-Input.md +0 -91
  158. package/data/zeroheight-exports/Search.md +0 -822
  159. package/data/zeroheight-exports/Segmented-Control.md +0 -609
  160. package/data/zeroheight-exports/Spacing.md +0 -297
  161. package/data/zeroheight-exports/Table.md +0 -5345
  162. package/data/zeroheight-exports/Tabs.md +0 -1324
  163. package/data/zeroheight-exports/Tags.md +0 -1545
  164. package/data/zeroheight-exports/Text-Link.md +0 -268
  165. package/data/zeroheight-exports/Theming.md +0 -362
  166. package/data/zeroheight-exports/Tooltips.md +0 -2015
  167. package/data/zeroheight-exports/Typography.md +0 -800
@@ -1,1367 +0,0 @@
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
- **Dialog**
30
-
31
- ---
32
-
33
- ---
34
-
35
- ### Dialog Spacing
36
-
37
- 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.
38
-
39
- **Dialog Spacing (napari hub + .org)**
40
-
41
- ---
42
-
43
- ---
44
-
45
- ### Dialog Backdrop
46
-
47
- 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.
48
-
49
- **Dialog Backdrop (napari hub + .org)**
50
-
51
- ---
52
-
53
- ## Code
54
-
55
- ## Dialog Component
56
-
57
- | 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 |
58
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --- | ----------------------------- |
59
-
60
- ---
61
-
62
- > 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.
63
-
64
- ### Dialog
65
-
66
- Storybook
67
-
68
- ---
69
-
70
- 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.
71
-
72
- ## Overview
73
-
74
- ## Dialog Variants
75
-
76
- | 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 |
77
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ----------------------------------------------------- |
78
-
79
- ---
80
-
81
- ## Dialog
82
-
83
- | | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
84
- | --- | -------- | --- | --- | ------------------- | --- | --- | ---------------------- |
85
-
86
- Dialogs are highly customizable and designed to accommodate a range of product needs; any combination of the following properties can be used:
87
-
88
- - Overline text above the title, subtitle text below the title, or both
89
- - Artwork above the title, whether a logo, icon, or illustration
90
-
91
- There are four size options, each with a fixed width and minimum height (except for `xs` which has no minimum height):
92
-
93
- - `xs` —`width: 400px`
94
- - `s` —`width: 600px`, `min-height: 400px`
95
- - `m` —`width: 900px`, `min-height: 480px`
96
- - `l` —`width: 1200px`, `min-height: 600px`
97
-
98
- Dialogs may be dismissed by:
99
-
100
- - Clicking an action Button that is configured to close, cancel, or complete a multi-step workflow occurring in the Dialog
101
- - Pressing the keyboard Esc key
102
- - Clicking the close Tertiary Icon Button on Dismissible Dialogs
103
- - 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
104
-
105
- ### Persistent Dialog
106
-
107
- 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.
108
-
109
- 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).
110
-
111
- Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
112
-
113
- **Default (1 button)**
114
-
115
- ---
116
-
117
- ---
118
-
119
- **Default (2 buttons)**
120
-
121
- ---
122
-
123
- ---
124
-
125
- **Default (2 buttons) + Overline + Subtitle**
126
-
127
- ---
128
-
129
- ---
130
-
131
- **Default (2 buttons) + Child Node (artwork)**
132
-
133
- ---
134
-
135
- ### Dismissible Dialog
136
-
137
- 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.
138
-
139
- Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
140
-
141
- **Default**
142
-
143
- ---
144
-
145
- ---
146
-
147
- **Default (1 button)**
148
-
149
- ---
150
-
151
- ---
152
-
153
- **Default (2 buttons)**
154
-
155
- ---
156
-
157
- ---
158
-
159
- **Default (2 buttons) + Overline + Subtitle**
160
-
161
- ---
162
-
163
- ---
164
-
165
- **Default (2 buttons) + Child Node (artwork)**
166
-
167
- ---
168
-
169
- ---
170
-
171
- ### Dialog Spacing
172
-
173
- 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.
174
-
175
- **Dialog Spacing (CZ GE)**
176
-
177
- ---
178
-
179
- ---
180
-
181
- ### Dialog Backdrop
182
-
183
- 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.
184
-
185
- **Dialog Backdrop (CZ GE)**
186
-
187
- ---
188
-
189
- ---
190
-
191
- ## Dialog Use Cases
192
-
193
- Details and guidelines around complex Dialog use cases, such as nested Dialogs and multi-step Dialog workflows.
194
-
195
- ### Nested Dialogs
196
-
197
- 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.
198
-
199
- 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).
200
-
201
- **Nested Dialogs (CZ GE)**
202
-
203
- ---
204
-
205
- ### Multi-step Dialog Workflow
206
-
207
- Dialog workflows should contain no more than three steps. Workflows that are more than three steps should be designed as a full-page experience.
208
-
209
- 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.
210
-
211
- The Dialog should not be dismissible and the `canOutsideClickClose` prop should be set to `false` to prevent any accidental loss of progress.
212
-
213
- **Multi-step Workflow (CZ GE)**
214
-
215
- ---
216
-
217
- ## Code
218
-
219
- ## Dialog Component
220
-
221
- | 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 |
222
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --- | ----------------------------- |
223
-
224
- ---
225
-
226
- > 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.
227
-
228
- ### Dialog
229
-
230
- Storybook
231
-
232
- ---
233
-
234
- 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.
235
-
236
- ## Overview
237
-
238
- ## Dialog Variants
239
-
240
- | 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 |
241
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ----------------------------------------------------- |
242
-
243
- ---
244
-
245
- ## Dialog
246
-
247
- | | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
248
- | --- | -------- | --- | --- | ------------------- | --- | --- | ----------------- |
249
-
250
- Dialogs are highly customizable and designed to accommodate a range of product needs; any combination of the following properties can be used:
251
-
252
- - Overline text above the title, subtitle text below the title, or both
253
- - Artwork above the title, whether a logo, icon, or illustration
254
-
255
- There are four size options, each with a fixed width and minimum height (except for `xs` which has no minimum height):
256
-
257
- - `xs` —`width: 400px`
258
- - `s` —`width: 600px`, `min-height: 400px`
259
- - `m` —`width: 900px`, `min-height: 480px`
260
- - `l` —`width: 1200px`, `min-height: 600px`
261
-
262
- Dialogs may be dismissed by:
263
-
264
- - Clicking an action Button that is configured to close, cancel, or complete a multi-step workflow occurring in the Dialog
265
- - Pressing the keyboard Esc key
266
- - Clicking the close Tertiary Icon Button on Dismissible Dialogs
267
- - 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
268
-
269
- ### Persistent Dialog
270
-
271
- 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.
272
-
273
- 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).
274
-
275
- Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
276
-
277
- **Default (1 button)**
278
-
279
- ---
280
-
281
- ---
282
-
283
- **Default (2 buttons)**
284
-
285
- ---
286
-
287
- ---
288
-
289
- **Default (2 buttons) + Overline + Subtitle**
290
-
291
- ---
292
-
293
- ---
294
-
295
- **Default (2 buttons) + Child Node (artwork)**
296
-
297
- ---
298
-
299
- ### Dismissible Dialog
300
-
301
- 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.
302
-
303
- Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
304
-
305
- **Default**
306
-
307
- ---
308
-
309
- ---
310
-
311
- **Default (1 button)**
312
-
313
- ---
314
-
315
- ---
316
-
317
- **Default (2 buttons)**
318
-
319
- ---
320
-
321
- ---
322
-
323
- **Default (2 buttons) + Overline + Subtitle**
324
-
325
- ---
326
-
327
- ---
328
-
329
- **Default (2 buttons) + Child Node (artwork)**
330
-
331
- ---
332
-
333
- ---
334
-
335
- ### Dialog Spacing
336
-
337
- 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.
338
-
339
- **Dialog Spacing (CZ ID)**
340
-
341
- ---
342
-
343
- ---
344
-
345
- ### Dialog Backdrop
346
-
347
- 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.
348
-
349
- **Dialog Backdrop (CZ ID)**
350
-
351
- ---
352
-
353
- ---
354
-
355
- ## Dialog Use Cases
356
-
357
- Details and guidelines around complex Dialog use cases, such as nested Dialogs and multi-step Dialog workflows.
358
-
359
- ### Nested Dialogs
360
-
361
- 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.
362
-
363
- 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).
364
-
365
- **Nested Dialogs (SDS + CZ ID)**
366
-
367
- ---
368
-
369
- ### Multi-step Dialog Workflow
370
-
371
- Dialog workflows should contain no more than three steps. Workflows that are more than three steps should be designed as a full-page experience.
372
-
373
- 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.
374
-
375
- The Dialog should not be dismissible and the `canOutsideClickClose` prop should be set to `false` to prevent any accidental loss of progress.
376
-
377
- **Multi-step Workflow (CZ ID)**
378
-
379
- ---
380
-
381
- ## Code
382
-
383
- ## Dialog Component
384
-
385
- | 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 |
386
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --- | ----------------------------- |
387
-
388
- ---
389
-
390
- ### Dialog
391
-
392
- Storybook
393
-
394
- ---
395
-
396
- 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.
397
-
398
- ## Guidelines
399
-
400
- ## Overview
401
-
402
- | | In Figma | | | Meets Accessibility | | | In Code |
403
- | --- | -------- | --- | --- | ------------------- | --- | --- | ------- |
404
-
405
- ### Dialog Variants
406
-
407
- 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.
408
-
409
- There are two Dialog variants available—Persistent and Dismissible. They are highly customizable and designed to accommodate a range of product needs.
410
-
411
- Any combination of the following properties can be used:
412
-
413
- - One or two Button(s), positioned to the right or left side of the dialog (positioned right by default)
414
- - Overline text above the title
415
- - Subtitle text below the title
416
- - Artwork above the title (logo, icon, or illustration)
417
-
418
- There are four size options, each with a fixed width and minimum height (except for `xs` which has no minimum height):
419
-
420
- - `xs` —`width: 400px`
421
- - `s` —`width: 600px`, `min-height: 400px`
422
- - `m` —`width: 900px`, `min-height: 480px`
423
- - `l` —`width: 1200px`, `min-height: 600px`
424
-
425
- Users can dismiss them by:
426
-
427
- - Clicking an action Button that is configured to close, cancel, or complete a multi-step workflow occurring in the Dialog
428
- - Pressing the keyboard `Esc` key
429
- - Clicking the close Tertiary Icon Button (Dismissible variant only)
430
- - 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
431
-
432
- **Preview_Guidelines_Dialog_persistent**
433
-
434
- ---
435
-
436
- **Preview_Guidelines_Dialog_dismissible**
437
-
438
- ---
439
-
440
- ---
441
-
442
- ### Live Instance
443
-
444
- Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
445
-
446
- Default
447
-
448
- ---
449
-
450
- ### Dialog – Persistent
451
-
452
- 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**.
453
-
454
- Persistent Dialogs are generally used:
455
-
456
- - In multi-step workflows where dismissing the Dialog would result in a loss of progress
457
- - 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).
458
-
459
- | 1 Button | 2 Buttons | 2 Buttons, left-aligned |
460
- | -------- | --------- | ----------------------- |
461
-
462
- **Dialog_Persistent_1 button**
463
-
464
- ---
465
-
466
- **Dialog_Persistent_2 buttons**
467
-
468
- ---
469
-
470
- **Dialog_Persistent_2 buttons, left**
471
-
472
- ---
473
-
474
- | 2 Buttons, rounded | 2 Buttons + Overline + Subtitle | 2 Buttons + Artwork |
475
- | ------------------ | ------------------------------- | ------------------- |
476
-
477
- **Dialog_Persistent_2 buttons, rounded**
478
-
479
- ---
480
-
481
- **Dialog_Persistent_overline, subtitle**
482
-
483
- ---
484
-
485
- **Dialog_Persistent_artwork**
486
-
487
- ---
488
-
489
- ---
490
-
491
- ### Dialog – Dismissible
492
-
493
- 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).
494
-
495
- | 0 Buttons | 1 Button | 2 Buttons | 2 Buttons, left-aligned |
496
- | --------- | -------- | --------- | ----------------------- |
497
-
498
- **Dialog_Dismissible_0 buttons**
499
-
500
- ---
501
-
502
- **Dialog_Dismissible_1 button**
503
-
504
- ---
505
-
506
- **Dialog_Dismissible_2 buttons**
507
-
508
- ---
509
-
510
- **Dialog_Dismissible_2 buttons, left**
511
-
512
- ---
513
-
514
- | 2 Buttons, rounded | 2 Buttons + Overline + Subtitle | 2 Buttons + Artwork |
515
- | ------------------ | ------------------------------- | ------------------- |
516
-
517
- **Dialog_Dismissible_2 buttons, rounded**
518
-
519
- ---
520
-
521
- **Dialog_Dismissible_overline, subtitle**
522
-
523
- ---
524
-
525
- **Dialog_Dismissible_artwork**
526
-
527
- ---
528
-
529
- ---
530
-
531
- ### Dialog Spacing
532
-
533
- 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.
534
-
535
- **Dialog Spacing (SDS)**
536
-
537
- ---
538
-
539
- ---
540
-
541
- ### Dialog Backdrop
542
-
543
- 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.
544
-
545
- The default backdrop is dark and customizable at the product level.
546
-
547
- **Dialog Backdrop (SDS)**
548
-
549
- ---
550
-
551
- ---
552
-
553
- ### Dialog Use Cases
554
-
555
- Details and guidelines around complex Dialog use cases, such as nested Dialogs and multi-step Dialog workflows.
556
-
557
- #### Nested Dialogs
558
-
559
- 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.
560
-
561
- 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).
562
-
563
- **Nested Dialogs (SDS + CZ ID)**
564
-
565
- ---
566
-
567
- #### Multi-step Dialog Workflow
568
-
569
- Dialog workflows should contain no more than three steps. Workflows that are more than three steps should be designed as a full-page experience.
570
-
571
- 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.
572
-
573
- The Dialog should not be dismissible to prevent any accidental loss of progress.
574
-
575
- **Multi-step Workflow (SDS)**
576
-
577
- ---
578
-
579
- ## Code
580
-
581
- > **Note:** The code examples below must install dependencies before displaying and may take extra time to load
582
-
583
- ## Dialog
584
-
585
- ### SDS Source Code
586
-
587
- The `Dialog` component's source code in the SDS codebase can be found here.
588
-
589
- 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:
590
-
591
- - Main `Dialog` component source code
592
- - `DialogActions` source code
593
- - `DialogContent` source code
594
- - `DialogPaper` source code
595
- - `DialogTitle` source code
596
-
597
- ### SDS vs MUI
598
-
599
- 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.
600
-
601
- The SDS `Dialog` does **not** support the `fullScreen` prop that the MUI component has (which allows dialogs to overtake the full screen).
602
-
603
- ### MUI Documentation
604
-
605
- Documentation for the underlying MUI component can be found here.
606
-
607
- ### Props
608
-
609
- Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
610
-
611
- #### Dialog Props
612
-
613
- Props table for the Dialog component.
614
-
615
- | Name | Type | Default | Description |
616
- | ---------------------- | -------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | --- | ------------------------------------------ |
617
- | `canClickOutsideClose` | `bool` | `false` | A boolean prop that determines whether clicking outside of the Dialog should trigger its closure. |
618
- | `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`. |
619
- | `sdsSize` | `"xs"` ` | "s"` ` | "m"` ` | "l"` | `m` | Controls the size of the Dialog component. |
620
-
621
- #### DialogTitle Props
622
-
623
- Props table for the DialogTitle component.
624
-
625
- | Name | Type | Default | Description |
626
- | ---------- | -------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
627
- | `title` | `string` | `-` | This prop represents the title text to be displayed in the Dialog component. |
628
- | `subtitle` | `string` | `-` | The subtitle prop allows you to include additional descriptive text beneath the title within the Dialog. |
629
- | `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. |
630
- | `open` | `bool` | `false` | If `true`, the component is shown. |
631
-
632
- #### DialogActions Props
633
-
634
- Props table for the DialogActions component.
635
-
636
- | Name | Type | Default | Description |
637
- | ---------------- | ------- | -------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
638
- | `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. |
639
-
640
- ### Code examples
641
-
642
- #### Default Dialog
643
-
644
- This example has the minimum props needed for the `Dialog` component.
645
-
646
- **/styles.css**
647
-
648
- ```css
649
- body {
650
- font-size: 13px;
651
- font-weight: 400;
652
- letter-spacing: 0.08px;
653
- line-height: 20px;
654
- text-transform: none;
655
- font-family: "Inter", sans-serif;
656
- }
657
-
658
- h1 {
659
- font-size: 1.5rem;
660
- }
661
-
662
- .app {
663
- padding: 20px;
664
- }
665
- ```
666
-
667
- **tsconfig.json**
668
-
669
- ```json
670
- {
671
- "include": ["./**/*"],
672
- "compilerOptions": {
673
- "strict": true,
674
- "esModuleInterop": true,
675
- "lib": ["dom", "es2015"],
676
- "jsx": "react-jsx"
677
- }
678
- }
679
- ```
680
-
681
- **/App.tsx**
682
-
683
- ```tsx
684
- // Most minimal Dialog (just has the basic requirements)
685
-
686
- import { useState } from "react";
687
- import {
688
- Button,
689
- Dialog,
690
- DialogTitle,
691
- DialogContent,
692
- DialogActions,
693
- } from "@czi-sds/components";
694
- import "./styles.css";
695
-
696
- function App() {
697
- const [isOpen, setIsOpen] = useState(true);
698
-
699
- function handleClick() {
700
- setIsOpen(true);
701
- }
702
-
703
- function handleClose() {
704
- setIsOpen(false);
705
- }
706
-
707
- return (
708
- <div className="app">
709
- <Button sdsStyle="minimal" sdsType="primary" onClick={handleClick}>
710
- Open Dialog
711
- </Button>
712
- <Dialog onClose={handleClose} open={isOpen} sdsSize="xs">
713
- <DialogTitle
714
- title="Learning"
715
- subtitle="Learning Resources"
716
- onClose={handleClose}
717
- />
718
- <DialogContent>
719
- Embark on a journey of continuous improvement with our treasure trove
720
- of learning materials. This section hosts an array of tutorials,
721
- guides, and insightful articles designed to enhance your skills and
722
- deepen your understanding.
723
- </DialogContent>
724
- </Dialog>
725
- </div>
726
- );
727
- }
728
-
729
- export default App;
730
- ```
731
-
732
- **/index.tsx**
733
-
734
- ```tsx
735
- import React from "react";
736
- import { createRoot } from "react-dom/client";
737
- import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
738
- import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
739
- import { Theme } from "@czi-sds/components";
740
- import CssBaseline from "@mui/material/CssBaseline";
741
- import useMediaQuery from "@mui/material/useMediaQuery";
742
-
743
- import App from "./App";
744
-
745
- const container = document.getElementById("root");
746
- const root = createRoot(container!);
747
-
748
- const RootApp = () => {
749
- const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
750
- const theme = prefersDarkMode ? Theme("dark") : Theme("light");
751
-
752
- return (
753
- <StyledEngineProvider injectFirst>
754
- <ThemeProvider theme={theme}>
755
- <EmotionThemeProvider theme={theme}>
756
- <CssBaseline />
757
- <App />
758
- </EmotionThemeProvider>
759
- </ThemeProvider>
760
- </StyledEngineProvider>
761
- );
762
- };
763
-
764
- root.render(
765
- <React.StrictMode>
766
- <RootApp />
767
- </React.StrictMode>
768
- );
769
- ```
770
-
771
- **/public/index.html**
772
-
773
- ```html
774
- <!doctype html>
775
- <html lang="en">
776
- <head>
777
- <meta charset="UTF-8" />
778
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
779
- <link rel="preconnect" href="https://fonts.googleapis.com" />
780
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
781
- <link
782
- href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
783
- rel="stylesheet"
784
- />
785
- <link
786
- href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap"
787
- rel="stylesheet"
788
- />
789
- </head>
790
- <body>
791
- <div id="root"></div>
792
- </body>
793
- </html>
794
- ```
795
-
796
- **/package.json**
797
-
798
- ```json
799
- {
800
- "dependencies": {
801
- "react": "^18.0.0",
802
- "react-dom": "^18.0.0",
803
- "react-scripts": "^4.0.0"
804
- },
805
- "devDependencies": {
806
- "@types/react": "^18.0.0",
807
- "@types/react-dom": "^18.0.0",
808
- "typescript": "^4.0.0"
809
- },
810
- "main": "/index.tsx"
811
- }
812
- ```
813
-
814
- ---
815
-
816
- #### Dialog with `canclickOutsideClose` set as `false`
817
-
818
- This example demonstrates a `Dialog` component that remains open even when clicked outside of the `Dialog`.
819
-
820
- **/styles.css**
821
-
822
- ```css
823
- body {
824
- font-size: 13px;
825
- font-weight: 400;
826
- letter-spacing: 0.08px;
827
- line-height: 20px;
828
- text-transform: none;
829
- font-family: "Inter", sans-serif;
830
- }
831
-
832
- h1 {
833
- font-size: 1.5rem;
834
- }
835
-
836
- .app {
837
- padding: 20px;
838
- }
839
- ```
840
-
841
- **tsconfig.json**
842
-
843
- ```json
844
- {
845
- "include": ["./**/*"],
846
- "compilerOptions": {
847
- "strict": true,
848
- "esModuleInterop": true,
849
- "lib": ["dom", "es2015"],
850
- "jsx": "react-jsx"
851
- }
852
- }
853
- ```
854
-
855
- **/App.tsx**
856
-
857
- ```tsx
858
- import { useState } from "react";
859
- import {
860
- Button,
861
- Dialog,
862
- DialogTitle,
863
- DialogContent,
864
- DialogActions,
865
- } from "@czi-sds/components";
866
- import "./styles.css";
867
-
868
- function App() {
869
- const [isOpen, setIsOpen] = useState(true);
870
-
871
- function handleClick() {
872
- setIsOpen(true);
873
- }
874
-
875
- function handleClose() {
876
- setIsOpen(false);
877
- }
878
-
879
- return (
880
- <div className="app">
881
- <Button sdsStyle="minimal" sdsType="primary" onClick={handleClick}>
882
- Open Dialog
883
- </Button>
884
- <Dialog
885
- onClose={handleClose}
886
- open={isOpen}
887
- sdsSize="xs"
888
- canClickOutsideClose={false}
889
- >
890
- <DialogTitle
891
- title="Welcome"
892
- subtitle="New features showcase"
893
- onClose={handleClose}
894
- />
895
- <DialogContent>
896
- We are thrilled to introduce you to our latest enhancements and
897
- features. In this interactive showcase, you'll have the opportunity to
898
- explore a wide range of improvements designed to elevate your user
899
- experience. Whether it's streamlined navigation, enhanced performance,
900
- or delightful visual enhancements, we've got something for everyone.
901
- Dive in and discover what's new!
902
- </DialogContent>
903
- </Dialog>
904
- </div>
905
- );
906
- }
907
-
908
- export default App;
909
- ```
910
-
911
- **/index.tsx**
912
-
913
- ```tsx
914
- import React from "react";
915
- import { createRoot } from "react-dom/client";
916
- import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
917
- import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
918
- import { Theme } from "@czi-sds/components";
919
- import CssBaseline from "@mui/material/CssBaseline";
920
- import useMediaQuery from "@mui/material/useMediaQuery";
921
-
922
- import App from "./App";
923
-
924
- const container = document.getElementById("root");
925
- const root = createRoot(container!);
926
-
927
- const RootApp = () => {
928
- const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
929
- const theme = prefersDarkMode ? Theme("dark") : Theme("light");
930
-
931
- return (
932
- <StyledEngineProvider injectFirst>
933
- <ThemeProvider theme={theme}>
934
- <EmotionThemeProvider theme={theme}>
935
- <CssBaseline />
936
- <App />
937
- </EmotionThemeProvider>
938
- </ThemeProvider>
939
- </StyledEngineProvider>
940
- );
941
- };
942
-
943
- root.render(
944
- <React.StrictMode>
945
- <RootApp />
946
- </React.StrictMode>
947
- );
948
- ```
949
-
950
- **/public/index.html**
951
-
952
- ```html
953
- <!doctype html>
954
- <html lang="en">
955
- <head>
956
- <meta charset="UTF-8" />
957
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
958
- <link rel="preconnect" href="https://fonts.googleapis.com" />
959
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
960
- <link
961
- href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
962
- rel="stylesheet"
963
- />
964
- <link
965
- href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap"
966
- rel="stylesheet"
967
- />
968
- </head>
969
- <body>
970
- <div id="root"></div>
971
- </body>
972
- </html>
973
- ```
974
-
975
- **/package.json**
976
-
977
- ```json
978
- {
979
- "dependencies": {
980
- "react": "^18.0.0",
981
- "react-dom": "^18.0.0",
982
- "react-scripts": "^4.0.0"
983
- },
984
- "devDependencies": {
985
- "@types/react": "^18.0.0",
986
- "@types/react-dom": "^18.0.0",
987
- "typescript": "^4.0.0"
988
- },
989
- "main": "/index.tsx"
990
- }
991
- ```
992
-
993
- ---
994
-
995
- #### Dialog with Action Buttons
996
-
997
- This example demonstrates a `Dialog` component that features action `Buttons` located in the dialog's footer.
998
-
999
- **/styles.css**
1000
-
1001
- ```css
1002
- body {
1003
- font-size: 13px;
1004
- font-weight: 400;
1005
- letter-spacing: 0.08px;
1006
- line-height: 20px;
1007
- text-transform: none;
1008
- font-family: "Inter", sans-serif;
1009
- }
1010
-
1011
- h1 {
1012
- font-size: 1.5rem;
1013
- }
1014
-
1015
- .app {
1016
- padding: 20px;
1017
- }
1018
- ```
1019
-
1020
- **tsconfig.json**
1021
-
1022
- ```json
1023
- {
1024
- "include": ["./**/*"],
1025
- "compilerOptions": {
1026
- "strict": true,
1027
- "esModuleInterop": true,
1028
- "lib": ["dom", "es2015"],
1029
- "jsx": "react-jsx"
1030
- }
1031
- }
1032
- ```
1033
-
1034
- **/App.tsx**
1035
-
1036
- ```tsx
1037
- import { useState } from "react";
1038
- import {
1039
- Button,
1040
- Dialog,
1041
- DialogTitle,
1042
- DialogContent,
1043
- DialogActions,
1044
- } from "@czi-sds/components";
1045
- import "./styles.css";
1046
-
1047
- function App() {
1048
- const [isOpen, setIsOpen] = useState(true);
1049
-
1050
- function handleClick() {
1051
- setIsOpen(true);
1052
- }
1053
-
1054
- function handleClose() {
1055
- setIsOpen(false);
1056
- }
1057
-
1058
- return (
1059
- <div className="app">
1060
- <Button sdsStyle="minimal" sdsType="primary" onClick={handleClick}>
1061
- Open Dialog
1062
- </Button>
1063
- <Dialog onClose={handleClose} open={isOpen} sdsSize="xs">
1064
- <DialogTitle
1065
- title="Learning"
1066
- subtitle="Learning Resources"
1067
- onClose={handleClose}
1068
- />
1069
- <DialogContent>
1070
- Embark on a journey of continuous improvement with our treasure trove
1071
- of learning materials. This section hosts an array of tutorials,
1072
- guides, and insightful articles designed to enhance your skills and
1073
- deepen your understanding.
1074
- </DialogContent>
1075
- <DialogActions buttonPosition="right">
1076
- <Button sdsStyle="square" sdsType="secondary" onClick={handleClose}>
1077
- Secondary Action
1078
- </Button>
1079
- <Button sdsStyle="square" sdsType="primary" onClick={handleClose}>
1080
- Primary Action
1081
- </Button>
1082
- </DialogActions>
1083
- </Dialog>
1084
- </div>
1085
- );
1086
- }
1087
-
1088
- export default App;
1089
- ```
1090
-
1091
- **/index.tsx**
1092
-
1093
- ```tsx
1094
- import React from "react";
1095
- import { createRoot } from "react-dom/client";
1096
- import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
1097
- import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
1098
- import { Theme } from "@czi-sds/components";
1099
- import CssBaseline from "@mui/material/CssBaseline";
1100
- import useMediaQuery from "@mui/material/useMediaQuery";
1101
-
1102
- import App from "./App";
1103
-
1104
- const container = document.getElementById("root");
1105
- const root = createRoot(container!);
1106
-
1107
- const RootApp = () => {
1108
- const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
1109
- const theme = prefersDarkMode ? Theme("dark") : Theme("light");
1110
-
1111
- return (
1112
- <StyledEngineProvider injectFirst>
1113
- <ThemeProvider theme={theme}>
1114
- <EmotionThemeProvider theme={theme}>
1115
- <CssBaseline />
1116
- <App />
1117
- </EmotionThemeProvider>
1118
- </ThemeProvider>
1119
- </StyledEngineProvider>
1120
- );
1121
- };
1122
-
1123
- root.render(
1124
- <React.StrictMode>
1125
- <RootApp />
1126
- </React.StrictMode>
1127
- );
1128
- ```
1129
-
1130
- **/public/index.html**
1131
-
1132
- ```html
1133
- <!doctype html>
1134
- <html lang="en">
1135
- <head>
1136
- <meta charset="UTF-8" />
1137
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
1138
- <link rel="preconnect" href="https://fonts.googleapis.com" />
1139
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1140
- <link
1141
- href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
1142
- rel="stylesheet"
1143
- />
1144
- <link
1145
- href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap"
1146
- rel="stylesheet"
1147
- />
1148
- </head>
1149
- <body>
1150
- <div id="root"></div>
1151
- </body>
1152
- </html>
1153
- ```
1154
-
1155
- **/package.json**
1156
-
1157
- ```json
1158
- {
1159
- "dependencies": {
1160
- "react": "^18.0.0",
1161
- "react-dom": "^18.0.0",
1162
- "react-scripts": "^4.0.0"
1163
- },
1164
- "devDependencies": {
1165
- "@types/react": "^18.0.0",
1166
- "@types/react-dom": "^18.0.0",
1167
- "typescript": "^4.0.0"
1168
- },
1169
- "main": "/index.tsx"
1170
- }
1171
- ```
1172
-
1173
- ---
1174
-
1175
- #### Dialog with a long content
1176
-
1177
- 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.
1178
-
1179
- **/styles.css**
1180
-
1181
- ```css
1182
- body {
1183
- font-size: 13px;
1184
- font-weight: 400;
1185
- letter-spacing: 0.08px;
1186
- line-height: 20px;
1187
- text-transform: none;
1188
- font-family: "Inter", sans-serif;
1189
- }
1190
-
1191
- h1 {
1192
- font-size: 1.5rem;
1193
- }
1194
-
1195
- .app {
1196
- padding: 20px;
1197
- }
1198
- ```
1199
-
1200
- **tsconfig.json**
1201
-
1202
- ```json
1203
- {
1204
- "include": ["./**/*"],
1205
- "compilerOptions": {
1206
- "strict": true,
1207
- "esModuleInterop": true,
1208
- "lib": ["dom", "es2015"],
1209
- "jsx": "react-jsx"
1210
- }
1211
- }
1212
- ```
1213
-
1214
- **/App.tsx**
1215
-
1216
- ```tsx
1217
- // Most minimal Dialog (just has the basic requirements)
1218
-
1219
- import { useState } from "react";
1220
- import {
1221
- Button,
1222
- Dialog,
1223
- DialogTitle,
1224
- DialogContent,
1225
- DialogActions,
1226
- } from "@czi-sds/components";
1227
- import "./styles.css";
1228
-
1229
- function App() {
1230
- const [isOpen, setIsOpen] = useState(true);
1231
-
1232
- function handleClick() {
1233
- setIsOpen(true);
1234
- }
1235
-
1236
- function handleClose() {
1237
- setIsOpen(false);
1238
- }
1239
-
1240
- return (
1241
- <div className="app">
1242
- <Button sdsStyle="minimal" sdsType="primary" onClick={handleClick}>
1243
- Open Dialog
1244
- </Button>
1245
- <Dialog onClose={handleClose} open={isOpen} sdsSize="xs">
1246
- <DialogTitle
1247
- title="Learning"
1248
- subtitle="Learning Resources"
1249
- onClose={handleClose}
1250
- />
1251
- <DialogContent>
1252
- Embark on a fulfilling journey of continuous improvement with our vast
1253
- repository of valuable learning resources. Within this dedicated
1254
- section, you'll find an extensive collection of meticulously crafted
1255
- tutorials, comprehensive guides, and thought-provoking articles
1256
- meticulously designed to enrich your skill set and provide profound
1257
- insights into your field of interest. Explore a diverse range of
1258
- topics, from fundamental principles to advanced techniques, as we aim
1259
- to empower you with knowledge that transcends boundaries. Whether
1260
- you're a novice eager to build a strong foundation or a seasoned
1261
- professional seeking to stay at the forefront of your industry, our
1262
- treasure trove of educational materials is your gateway to honing your
1263
- expertise. Unlock your potential, expand your horizons, and stay ahead
1264
- of the curve by immersing yourself in this wealth of knowledge. We
1265
- believe that continuous learning is the key to personal and
1266
- professional growth, and we're excited to accompany you on this
1267
- educational journey, every step of the way.
1268
- </DialogContent>
1269
- <DialogActions buttonPosition="left">
1270
- <Button sdsStyle="square" sdsType="primary" onClick={handleClose}>
1271
- Primary Action
1272
- </Button>
1273
- <Button sdsStyle="square" sdsType="secondary" onClick={handleClose}>
1274
- Secondary Action
1275
- </Button>
1276
- </DialogActions>
1277
- </Dialog>
1278
- </div>
1279
- );
1280
- }
1281
-
1282
- export default App;
1283
- ```
1284
-
1285
- **/index.tsx**
1286
-
1287
- ```tsx
1288
- import React from "react";
1289
- import { createRoot } from "react-dom/client";
1290
- import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
1291
- import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
1292
- import { Theme } from "@czi-sds/components";
1293
- import CssBaseline from "@mui/material/CssBaseline";
1294
- import useMediaQuery from "@mui/material/useMediaQuery";
1295
-
1296
- import App from "./App";
1297
-
1298
- const container = document.getElementById("root");
1299
- const root = createRoot(container!);
1300
-
1301
- const RootApp = () => {
1302
- const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
1303
- const theme = prefersDarkMode ? Theme("dark") : Theme("light");
1304
-
1305
- return (
1306
- <StyledEngineProvider injectFirst>
1307
- <ThemeProvider theme={theme}>
1308
- <EmotionThemeProvider theme={theme}>
1309
- <CssBaseline />
1310
- <App />
1311
- </EmotionThemeProvider>
1312
- </ThemeProvider>
1313
- </StyledEngineProvider>
1314
- );
1315
- };
1316
-
1317
- root.render(
1318
- <React.StrictMode>
1319
- <RootApp />
1320
- </React.StrictMode>
1321
- );
1322
- ```
1323
-
1324
- **/public/index.html**
1325
-
1326
- ```html
1327
- <!doctype html>
1328
- <html lang="en">
1329
- <head>
1330
- <meta charset="UTF-8" />
1331
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
1332
- <link rel="preconnect" href="https://fonts.googleapis.com" />
1333
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1334
- <link
1335
- href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
1336
- rel="stylesheet"
1337
- />
1338
- <link
1339
- href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap"
1340
- rel="stylesheet"
1341
- />
1342
- </head>
1343
- <body>
1344
- <div id="root"></div>
1345
- </body>
1346
- </html>
1347
- ```
1348
-
1349
- **/package.json**
1350
-
1351
- ```json
1352
- {
1353
- "dependencies": {
1354
- "react": "^18.0.0",
1355
- "react-dom": "^18.0.0",
1356
- "react-scripts": "^4.0.0"
1357
- },
1358
- "devDependencies": {
1359
- "@types/react": "^18.0.0",
1360
- "@types/react-dom": "^18.0.0",
1361
- "typescript": "^4.0.0"
1362
- },
1363
- "main": "/index.tsx"
1364
- }
1365
- ```
1366
-
1367
- ---