@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
@@ -0,0 +1,300 @@
1
+ # List
2
+
3
+ A list is three components: **List** for the `ul` or `ol` element, **ListItem** for each entry, and **ListSubheader** for the optional heading above them. All three wrap their MUI counterparts, so any MUI prop passes straight through.
4
+
5
+ ## Import
6
+
7
+ **React TypeScript**
8
+
9
+ ```tsx
10
+ import {
11
+ List,
12
+ ListItem,
13
+ ListItemLabel,
14
+ ListSubheader,
15
+ } from "@czi-sds/components";
16
+ ```
17
+
18
+ ## Code examples
19
+
20
+ ### Unordered list
21
+
22
+ An unordered list with a subheader. Neither the List nor the items need any props for this shape.
23
+
24
+ **Example: UnorderedList**
25
+
26
+ ```tsx
27
+ // An unordered list is the default: no props needed on List or ListItem. The
28
+ // subheader goes through MUI's subheader prop, with disableSticky so it scrolls
29
+ // with the content.
30
+
31
+ import { List, ListItem, ListSubheader } from "@czi-sds/components";
32
+
33
+ function App() {
34
+ return (
35
+ <div className="app" style={{ maxWidth: "460px" }}>
36
+ <List
37
+ subheader={
38
+ <ListSubheader disableSticky>Before you upload</ListSubheader>
39
+ }
40
+ >
41
+ <ListItem>Files must be gzipped FASTQ or BAM.</ListItem>
42
+ <ListItem>Every sample needs a unique identifier.</ListItem>
43
+ <ListItem>
44
+ Reads shorter than 30 bases are dropped during processing, so trim
45
+ them beforehand if you want to keep them.
46
+ </ListItem>
47
+ </List>
48
+ </div>
49
+ );
50
+ }
51
+
52
+ export default App;
53
+ ```
54
+
55
+ ### Ordered list
56
+
57
+ The same list numbered, with `ordered` on the List and on every item.
58
+
59
+ **Example: OrderedList**
60
+
61
+ ```tsx
62
+ // ordered has to go on both the List and every ListItem: the List switches the
63
+ // element to ol and starts the counter, and each item increments it and draws
64
+ // its own number.
65
+
66
+ import { List, ListItem, ListSubheader } from "@czi-sds/components";
67
+
68
+ function App() {
69
+ return (
70
+ <div className="app" style={{ maxWidth: "460px" }}>
71
+ <List
72
+ ordered
73
+ subheader={
74
+ <ListSubheader disableSticky>Running an analysis</ListSubheader>
75
+ }
76
+ >
77
+ <ListItem ordered>Pick the samples you want to include.</ListItem>
78
+ <ListItem ordered>Choose a reference genome.</ListItem>
79
+ <ListItem ordered>Start the run and wait for the report.</ListItem>
80
+ </List>
81
+ </div>
82
+ );
83
+ }
84
+
85
+ export default App;
86
+ ```
87
+
88
+ ### Nested ordered list
89
+
90
+ Nesting a List inside an ordered item numbers the sub-items against their parent, so they read 1.1. and 1.2.
91
+
92
+ **Example: NestedOrderedList**
93
+
94
+ ```tsx
95
+ // Nested numbering comes from a CSS counter, so sub-items read 1.1., 1.2., and
96
+ // so on. The nested List has to live inside a single wrapper element, otherwise
97
+ // it becomes a sibling of the item's text instead of a child of it.
98
+
99
+ import { List, ListItem } from "@czi-sds/components";
100
+
101
+ function App() {
102
+ return (
103
+ <div className="app" style={{ maxWidth: "460px" }}>
104
+ <List ordered>
105
+ <ListItem ordered marginBottom="s">
106
+ <span>
107
+ Prepare your data
108
+ <List ordered>
109
+ <ListItem ordered>Upload the raw reads.</ListItem>
110
+ <ListItem ordered>Attach the sample metadata.</ListItem>
111
+ </List>
112
+ </span>
113
+ </ListItem>
114
+ <ListItem ordered marginBottom="s">
115
+ <span>
116
+ Configure the pipeline
117
+ <List ordered>
118
+ <ListItem ordered>Choose a reference genome.</ListItem>
119
+ <ListItem ordered>Set the quality thresholds.</ListItem>
120
+ </List>
121
+ </span>
122
+ </ListItem>
123
+ <ListItem ordered>Start the run.</ListItem>
124
+ </List>
125
+ </div>
126
+ );
127
+ }
128
+
129
+ export default App;
130
+ ```
131
+
132
+ ### Sizes and spacing
133
+
134
+ The type scale, each size with the item spacing it pairs with. Both props sit on the items, so one list can mix sizes.
135
+
136
+ **Example: ListSizes**
137
+
138
+ ```tsx
139
+ // fontSize sets the body type scale on each item, and marginBottom sets the gap
140
+ // below it. Both live on ListItem, not on List, so a list can mix sizes.
141
+
142
+ import { List, ListItem } from "@czi-sds/components";
143
+
144
+ function App() {
145
+ return (
146
+ <div className="app">
147
+ <List>
148
+ <ListItem fontSize="l" marginBottom="s">
149
+ fontSize=&quot;l&quot;, marginBottom=&quot;s&quot;
150
+ </ListItem>
151
+ <ListItem fontSize="m" marginBottom="s">
152
+ fontSize=&quot;m&quot;, marginBottom=&quot;s&quot;
153
+ </ListItem>
154
+ <ListItem fontSize="s" marginBottom="xs">
155
+ fontSize=&quot;s&quot;, marginBottom=&quot;xs&quot; (the defaults)
156
+ </ListItem>
157
+ <ListItem fontSize="xs" marginBottom="xs">
158
+ fontSize=&quot;xs&quot;, marginBottom=&quot;xs&quot;
159
+ </ListItem>
160
+ <ListItem fontSize="xxs" marginBottom="xs">
161
+ fontSize=&quot;xxs&quot;, marginBottom=&quot;xs&quot;
162
+ </ListItem>
163
+ <ListItem fontSize="xxxs" marginBottom="xxs">
164
+ fontSize=&quot;xxxs&quot;, marginBottom=&quot;xxs&quot;
165
+ </ListItem>
166
+ </List>
167
+ </div>
168
+ );
169
+ }
170
+
171
+ export default App;
172
+ ```
173
+
174
+ ### Items with labels
175
+
176
+ ListItemLabel makes the leading term semibold, which suits lists that define or name things.
177
+
178
+ **Example: ListWithLabels**
179
+
180
+ ```tsx
181
+ // ListItemLabel is a semibold span for the term at the start of an item, so
182
+ // definition-style lists stay readable without hand-rolled font weights.
183
+
184
+ import { List, ListItem, ListItemLabel } from "@czi-sds/components";
185
+
186
+ function App() {
187
+ return (
188
+ <div className="app" style={{ maxWidth: "460px" }}>
189
+ <List>
190
+ <ListItem fontSize="s">
191
+ <span>
192
+ <ListItemLabel>Draft</ListItemLabel> Only you can see the dataset.
193
+ </span>
194
+ </ListItem>
195
+ <ListItem fontSize="s">
196
+ <span>
197
+ <ListItemLabel>Private</ListItemLabel> Everyone in your collection
198
+ can see the dataset.
199
+ </span>
200
+ </ListItem>
201
+ <ListItem fontSize="s">
202
+ <span>
203
+ <ListItemLabel>Published</ListItemLabel> The dataset is visible to
204
+ anyone with the link, and the version is frozen.
205
+ </span>
206
+ </ListItem>
207
+ </List>
208
+ </div>
209
+ );
210
+ }
211
+
212
+ export default App;
213
+ ```
214
+
215
+ ## How the pieces fit together
216
+
217
+ - `ordered` belongs on both the List and every ListItem. On the List it swaps the element to `ol` and starts the counter; on each item it increments the counter and draws the number. An `ol` whose items are missing the prop still renders bullets.
218
+
219
+ - Markers are drawn by the item's `::before` pseudo-element rather than the browser's own list marker, and are always semibold. Bullets sit 8px from the text, numbers 6px.
220
+
221
+ - Numbers come from a CSS counter, so a list nested inside an ordered item numbers itself 1.1., 1.2., and so on, to any depth.
222
+
223
+ - Nested lists have to sit inside a single wrapper element together with the parent item's text. A ListItem is a flex row, so a bare _text plus List_ pair would lay the two out side by side.
224
+
225
+ - Items align their marker to the top of the text, so wrapped copy keeps the bullet or number on the first line.
226
+
227
+ - The List carries no padding of its own, so items line up flush with the surrounding text instead of the browser's default indent.
228
+
229
+ - A subheader renders as an `li` without a marker, in `fontHeaderM`, 16px above the first item. That gap is effectively fixed; see `marginBottom` in the List table below.
230
+
231
+ - Sizing and spacing live on ListItem, not on List, so nothing is inherited down. A list of six items at `fontSize` `"m"` needs the prop on all six.
232
+
233
+ - Because the markers are CSS content and the browser's own list style is turned off, Safari and VoiceOver stop treating the element as a list. Add `role="list"` to the List when that matters.
234
+
235
+ ## Sizes and spacing
236
+
237
+ The pairing below is the one the designs use, and the one the [Storybook story](https://chanzuckerberg.github.io/sci-components/?path=/story/components-list--default) demonstrates. Set both props on each item.
238
+
239
+ | fontSize | Type | marginBottom | Gap below the item |
240
+ | -------- | ---------------------------------- | ------------ | ------------------ |
241
+ | `"l"` | `fontBodyL`, 18px / 16px narrow | `"s"` | 8px |
242
+ | `"m"` | `fontBodyM`, 16px / 14px narrow | `"s"` | 8px |
243
+ | `"s"` | `fontBodyS`, 14px | `"xs"` | 6px |
244
+ | `"xs"` | `fontBodyXs`, 13px | `"xs"` | 6px |
245
+ | `"xxs"` | `fontBodyXxs`, 12px | `"xs"` | 6px |
246
+ | `"xxxs"` | `fontBodyXxxs`, 11px / 12px narrow | `"xxs"` | 4px |
247
+
248
+ ## List
249
+
250
+ ### Source Code
251
+
252
+ The component's source code in the SDS codebase can be found [here](https://github.com/chanzuckerberg/sci-components/blob/main/packages/components/src/core/List/index.tsx).
253
+
254
+ ### Props
255
+
256
+ Any custom SDS props and MUI props required for implementation are found on the table below. See the [MUI documentation](https://mui.com/material-ui/api/list/) for additional optional props.
257
+
258
+ | Name | Type | Default | Description |
259
+ | ---------------- | -------------------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
260
+ | `ordered` | `boolean` | `false` | Renders an `"ol"` element and starts the numbering counter. `false` renders a `"ul"`. Pass it to each ListItem as well, otherwise the items still draw bullets. |
261
+ | `subheader` | `ReactNode` | `undefined` | The heading rendered above the items, normally a ListSubheader. Comes from MUI. |
262
+ | `marginBottom` | `"xxxs"` \| `"xxs"` \| `"xs"` \| `"s"` \| `"m"` \| `"l"` | `"s"` | Sets the gap below the subheader, not below the list: 8px for `"xxxs"`, 12px through `"xxs"` to `"s"`, 16px for `"m"` and `"l"`. It collides with the 16px margin ListSubheader sets on itself at the same specificity, so the winner comes down to the order the styles were inserted and the prop is not dependable. Space the list itself with its container instead. |
263
+ | `component` | `ElementType` | `"ul"` or `"ol"` | Overrides the element the list renders as, taking precedence over `ordered`. Reach for it only when the markup has to differ from the semantics. |
264
+ | `disablePadding` | `boolean` | `true` | MUI's vertical padding is off by default. Pass `false` to bring back its 8px top and bottom padding. |
265
+
266
+ ## ListItem
267
+
268
+ ### Source Code
269
+
270
+ The component's source code in the SDS codebase can be found [here](https://github.com/chanzuckerberg/sci-components/blob/main/packages/components/src/core/List/components/ListItem/index.tsx).
271
+
272
+ ### Props
273
+
274
+ Any custom SDS props and MUI props required for implementation are found on the table below. See the [MUI documentation](https://mui.com/material-ui/api/list-item/) for additional optional props.
275
+
276
+ | Name | Type | Default | Description |
277
+ | -------------- | -------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
278
+ | `fontSize` | `"xxxs"` \| `"xxs"` \| `"xs"` \| `"s"` \| `"m"` \| `"l"` | `"s"` | The body type scale for this item. Set it on every item; it is not inherited from the List. |
279
+ | `marginBottom` | `"s"` \| `"xs"` \| `"xxs"` | `"xs"` | The gap below this item: `"s"` is 8px, `"xs"` is 6px, `"xxs"` is 4px. It applies to the last item too, so drop the default when the list sits right above something else. |
280
+ | `ordered` | `boolean` | `false` | Draws a counter-based number instead of a bullet. It has to match the `ordered` prop on the parent List. |
281
+ | `children` | `ReactNode` | `undefined` | The item's content. Wrap it in a single element when the item holds more than a string, since the item lays its children out in a row. |
282
+
283
+ ### ListItemLabel
284
+
285
+ ListItemLabel, exported alongside ListItem, is a semibold span for the term at the start of an item. It adds 5px of space after itself, but keep an ordinary space in the copy as well, otherwise a screen reader reads the label and the sentence after it as one word.
286
+
287
+ ## ListSubheader
288
+
289
+ ### Source Code
290
+
291
+ The component's source code in the SDS codebase can be found [here](https://github.com/chanzuckerberg/sci-components/blob/main/packages/components/src/core/List/components/ListSubheader/index.tsx).
292
+
293
+ ### Props
294
+
295
+ ListSubheader adds no SDS props: it takes `fontHeaderM`, a 16px bottom margin, and the surrounding text color, then passes everything through to [MUI's ListSubheader](https://mui.com/material-ui/api/list-subheader/). The two props worth knowing are below.
296
+
297
+ | Name | Type | Default | Description |
298
+ | ---------------- | --------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
299
+ | `disableSticky` | `boolean` | `false` | MUI pins the subheader to the top of a scrolling container. Pass it so the heading scrolls away with the list, which is what the designs show. |
300
+ | `disableGutters` | `boolean` | `true` | MUI's horizontal padding is off by default, keeping the heading flush with the items. |
@@ -0,0 +1,198 @@
1
+ # LoadingIndicator
2
+
3
+ ## Source Code
4
+
5
+ The component's source code in the SDS codebase can be found [here](https://github.com/chanzuckerberg/sci-components/blob/main/packages/components/src/core/LoadingIndicator/index.tsx).
6
+
7
+ ## Import
8
+
9
+ **React TypeScript**
10
+
11
+ ```tsx
12
+ import { LoadingIndicator } from "@czi-sds/components";
13
+ ```
14
+
15
+ ## Code examples
16
+
17
+ ### LoadingIndicator – Minimal
18
+
19
+ Use the minimal variant when part of a page is still filling in, such as the body of an Accordion or the rows of a Table.
20
+
21
+ **Example: LoadingIndicatorMinimal**
22
+
23
+ ```tsx
24
+ // The minimal variant is body-sized text in secondary grey, for a region of a
25
+ // page that is still filling in. sdsStyle is required; there is no default.
26
+
27
+ import { LoadingIndicator } from "@czi-sds/components";
28
+
29
+ function App() {
30
+ return (
31
+ <div className="app">
32
+ <LoadingIndicator sdsStyle="minimal" />
33
+ </div>
34
+ );
35
+ }
36
+
37
+ export default App;
38
+ ```
39
+
40
+ ### LoadingIndicator – Tag
41
+
42
+ Use the tag variant when a whole page or view has not arrived yet.
43
+
44
+ **Example: LoadingIndicatorTag**
45
+
46
+ ```tsx
47
+ // The tag variant is an accent-colored pill with all-caps text, for a whole
48
+ // page or view that has not arrived yet.
49
+
50
+ import { LoadingIndicator } from "@czi-sds/components";
51
+
52
+ function App() {
53
+ return (
54
+ <div className="app">
55
+ <LoadingIndicator sdsStyle="tag" />
56
+ </div>
57
+ );
58
+ }
59
+
60
+ export default App;
61
+ ```
62
+
63
+ ### Naming what is loading
64
+
65
+ The two indicators below look identical, but the second announces "Loading cell types" instead of "Loading". Name the thing being loaded whenever more than one wait can be in flight.
66
+
67
+ **Example: LoadingIndicatorAriaLabel**
68
+
69
+ ```tsx
70
+ // aria-label changes only what a screen reader announces. The visible word
71
+ // stays "Loading" either way, so use the label to name what is loading.
72
+
73
+ import { LoadingIndicator } from "@czi-sds/components";
74
+
75
+ function App() {
76
+ return (
77
+ <div
78
+ className="app"
79
+ style={{
80
+ alignItems: "flex-start",
81
+ display: "flex",
82
+ flexDirection: "column",
83
+ gap: "8px",
84
+ }}
85
+ >
86
+ <LoadingIndicator sdsStyle="minimal" />
87
+ <LoadingIndicator sdsStyle="minimal" aria-label="Loading cell types" />
88
+ </div>
89
+ );
90
+ }
91
+
92
+ export default App;
93
+ ```
94
+
95
+ ### Loading a region on demand
96
+
97
+ Swapping the indicator in for the content it is standing in for, which is what gives the status region something to announce, and what gives the wait a visible end.
98
+
99
+ **Example: LoadingIndicatorInContext**
100
+
101
+ ```tsx
102
+ // Mount the indicator when the wait starts and unmount it when the content
103
+ // arrives: the status region announces itself on mount. Removing it announces
104
+ // nothing, so the content that replaces it carries the news.
105
+ //
106
+ // The component accepts no className or style, so any layout, centering
107
+ // included, belongs on a wrapper around it.
108
+
109
+ import {
110
+ Button,
111
+ fontBodyS,
112
+ getSemanticColors,
113
+ LoadingIndicator,
114
+ type CommonThemeProps,
115
+ } from "@czi-sds/components";
116
+ import styled from "@emotion/styled";
117
+ import { useEffect, useRef, useState } from "react";
118
+
119
+ const Surface = styled.div<CommonThemeProps>`
120
+ ${fontBodyS}
121
+
122
+ ${(props) => {
123
+ const semanticColors = getSemanticColors(props);
124
+
125
+ return `
126
+ border: 1px solid ${semanticColors?.base?.divider};
127
+ border-radius: 4px;
128
+ color: ${semanticColors?.base?.textPrimary};
129
+ display: flex;
130
+ align-items: center;
131
+ justify-content: center;
132
+ height: 96px;
133
+ margin-bottom: 12px;
134
+ width: 320px;
135
+ `;
136
+ }}
137
+ `;
138
+
139
+ function App() {
140
+ const [loading, setLoading] = useState(false);
141
+ const timeout = useRef<ReturnType<typeof setTimeout>>();
142
+
143
+ useEffect(() => () => clearTimeout(timeout.current), []);
144
+
145
+ const load = () => {
146
+ setLoading(true);
147
+ timeout.current = setTimeout(() => setLoading(false), 2000);
148
+ };
149
+
150
+ return (
151
+ <div className="app">
152
+ <Surface>
153
+ {loading ? (
154
+ <LoadingIndicator sdsStyle="minimal" aria-label="Loading samples" />
155
+ ) : (
156
+ <span>4 samples ready</span>
157
+ )}
158
+ </Surface>
159
+
160
+ <Button sdsStyle="outline" sdsType="primary" onClick={load}>
161
+ Reload samples
162
+ </Button>
163
+ </div>
164
+ );
165
+ }
166
+
167
+ export default App;
168
+ ```
169
+
170
+ ## Behavior notes
171
+
172
+ - The component reads exactly two props, `sdsStyle` and `aria-label`, and ignores everything else. There is no `className`, `style`, `id`, `children`, or data attribute to pass, and no ref to take, so wrap it in an element of your own for layout, spacing, or centering.
173
+
174
+ - The visible label is the hard-coded word _Loading_. It cannot be changed or translated, so a wait that needs different copy needs a line of your own text beside the indicator.
175
+
176
+ - Both variants stand 32px tall and sit `inline-flex`, so they line up with adjacent text rather than filling their container.
177
+
178
+ - Internally there is 4px of padding and nothing more. The 16px of clearance the spacing guideline above asks for is yours to add on the surrounding element.
179
+
180
+ - The spinner is animated inside the SVG itself, not with CSS, so it keeps spinning under `prefers-reduced-motion` and there is no prop to stop it.
181
+
182
+ - The label sits in a `role="status"`, `aria-live="polite"` region, so it announces itself when it mounts. Render it when the wait starts and unmount it when the wait ends: nothing is announced on removal, so the content that replaces it has to carry the result.
183
+
184
+ ## The two variants
185
+
186
+ | sdsStyle | Type | Color | Spinner |
187
+ | ----------- | -------------------------- | ------------------------------------------------------------------------- | ------- |
188
+ | `"minimal"` | `fontBodyS`, sentence case | Text `base.textSecondary`, spinner `base.ornamentSecondary`, no fill | 16px |
189
+ | `"tag"` | `fontCapsXxxxs`, all caps | Text and spinner `accent.foreground` on an `accent.surfaceSecondary` pill | 24px |
190
+
191
+ ## Props
192
+
193
+ The component takes no MUI props. Its full surface is the table below; any other prop is a type error.
194
+
195
+ | Name | Type | Default | Description |
196
+ | ------------ | ---------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
197
+ | `sdsStyle` | `"minimal"` \| `"tag"` | - (required) | Chooses between the two variants above. It has no default: leaving it out is a type error, and an indicator built without it renders unstyled. |
198
+ | `aria-label` | `string` | `undefined` | Replaces what a screen reader announces for the status region, for example "Loading cell types". The visible text still reads "Loading". Without it, assistive technology announces the visible word. |