@czi-sds/mcp 0.16.0 → 0.17.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 (164) 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/SegmentedControl.md +396 -0
  44. package/data/component-docs/StackedBarChart.md +475 -0
  45. package/data/component-docs/Table.md +2000 -0
  46. package/data/component-docs/TableHeader.md +53 -0
  47. package/data/component-docs/TableRow.md +74 -0
  48. package/data/component-docs/Tabs.md +455 -0
  49. package/data/component-docs/Tag.md +647 -0
  50. package/data/component-docs/TagFilter.md +131 -0
  51. package/data/component-docs/Tooltip.md +561 -0
  52. package/data/component-docs/TooltipCondensed.md +203 -0
  53. package/data/component-docs/TooltipTable.md +145 -0
  54. package/data/component-docs/index.json +262 -0
  55. package/data/component-list.json +2 -5
  56. package/data/component-props/Accordion.json +31 -11
  57. package/data/component-props/Alert.json +3 -3
  58. package/data/component-props/Autocomplete.json +150 -15
  59. package/data/component-props/Banner.json +31 -17
  60. package/data/component-props/Button.json +45 -20
  61. package/data/component-props/ButtonDropdown.json +36 -17
  62. package/data/component-props/ButtonDropdownLegacy.json +11 -11
  63. package/data/component-props/ButtonGroup.json +32 -11
  64. package/data/component-props/ButtonIcon.json +10 -10
  65. package/data/component-props/ButtonLegacy.json +19 -19
  66. package/data/component-props/ButtonToggle.json +32 -19
  67. package/data/component-props/ButtonToggleLegacy.json +11 -11
  68. package/data/component-props/Callout.json +58 -17
  69. package/data/component-props/CellBasic.json +94 -41
  70. package/data/component-props/CellComponent.json +23 -7
  71. package/data/component-props/CellHeader.json +62 -19
  72. package/data/component-props/ComplexFilter.json +52 -21
  73. package/data/component-props/ContentCard.json +70 -47
  74. package/data/component-props/Dialog.json +47 -14
  75. package/data/component-props/Dropdown.json +68 -31
  76. package/data/component-props/DropdownMenu.json +128 -23
  77. package/data/component-props/HeatmapChart.json +88 -12
  78. package/data/component-props/Hero.json +80 -39
  79. package/data/component-props/Icon.json +20 -9
  80. package/data/component-props/InputCheckbox.json +36 -14
  81. package/data/component-props/InputDropdown.json +75 -27
  82. package/data/component-props/InputRadio.json +31 -13
  83. package/data/component-props/InputSearch.json +41 -18
  84. package/data/component-props/InputSlider.json +46 -19
  85. package/data/component-props/InputText.json +26 -19
  86. package/data/component-props/InputToggle.json +26 -9
  87. package/data/component-props/IntentMessage.json +38 -9
  88. package/data/component-props/Link.json +13 -7
  89. package/data/component-props/LoadingIndicator.json +11 -3
  90. package/data/component-props/MenuItem.json +38 -19
  91. package/data/component-props/MenuSelect.json +8 -8
  92. package/data/component-props/NavigationFooter.json +49 -19
  93. package/data/component-props/NavigationHeader.json +150 -37
  94. package/data/component-props/NavigationJumpTo.json +33 -7
  95. package/data/component-props/Notification.json +39 -21
  96. package/data/component-props/Pagination.json +39 -11
  97. package/data/component-props/Panel.json +62 -9
  98. package/data/component-props/Popover.json +80 -7
  99. package/data/component-props/PreComposedTable.json +99 -27
  100. package/data/component-props/SegmentedControl.json +42 -3
  101. package/data/component-props/StackedBarChart.json +116 -42
  102. package/data/component-props/TableRow.json +38 -19
  103. package/data/component-props/Tabs.json +66 -9
  104. package/data/component-props/Tag.json +34 -17
  105. package/data/component-props/TagFilter.json +10 -3
  106. package/data/component-props/Tooltip.json +49 -18
  107. package/data/component-props/TooltipCondensed.json +18 -9
  108. package/data/component-props/TooltipTable.json +17 -7
  109. package/data/resources/{zeroheight-rules.md → documentation-rules.md} +43 -30
  110. package/data/resources/figma-rules.md +2 -2
  111. package/dist/stdio.js +112 -208
  112. package/package.json +9 -5
  113. package/data/component-props/ButtonDropdownV2.json +0 -34
  114. package/data/component-props/ButtonNew.json +0 -47
  115. package/data/component-props/ButtonToggleV2.json +0 -44
  116. package/data/component-props/ButtonV2.json +0 -43
  117. package/data/zeroheight-cache.json +0 -10259
  118. package/data/zeroheight-exports/Accordion.md +0 -774
  119. package/data/zeroheight-exports/Banner.md +0 -691
  120. package/data/zeroheight-exports/Borders.md +0 -117
  121. package/data/zeroheight-exports/Buttons.md +0 -1854
  122. package/data/zeroheight-exports/Callout.md +0 -931
  123. package/data/zeroheight-exports/Colors.md +0 -1755
  124. package/data/zeroheight-exports/Content-Card.md +0 -309
  125. package/data/zeroheight-exports/Contributing-to-SDS.md +0 -98
  126. package/data/zeroheight-exports/Control-Inputs.md +0 -2818
  127. package/data/zeroheight-exports/Corners.md +0 -104
  128. package/data/zeroheight-exports/Cover-page.md +0 -3
  129. package/data/zeroheight-exports/Dialog.md +0 -1367
  130. package/data/zeroheight-exports/Downloads.md +0 -236
  131. package/data/zeroheight-exports/Drop-Shadows.md +0 -79
  132. package/data/zeroheight-exports/Dropdown-Input.md +0 -1776
  133. package/data/zeroheight-exports/Dropdown-Menus.md +0 -913
  134. package/data/zeroheight-exports/Element-Status-Tracker.md +0 -267
  135. package/data/zeroheight-exports/Field-Inputs.md +0 -1405
  136. package/data/zeroheight-exports/Filters.md +0 -1111
  137. package/data/zeroheight-exports/Getting-Started.md +0 -1157
  138. package/data/zeroheight-exports/Hero.md +0 -414
  139. package/data/zeroheight-exports/Icons.md +0 -2067
  140. package/data/zeroheight-exports/Intent.md +0 -86
  141. package/data/zeroheight-exports/Introduction-to-Bases.md +0 -35
  142. package/data/zeroheight-exports/Introduction-to-Cells.md +0 -35
  143. package/data/zeroheight-exports/Introduction-to-DNA.md +0 -35
  144. package/data/zeroheight-exports/Introduction-to-Genes.md +0 -35
  145. package/data/zeroheight-exports/Introduction.md +0 -115
  146. package/data/zeroheight-exports/Link.md +0 -432
  147. package/data/zeroheight-exports/Lists.md +0 -986
  148. package/data/zeroheight-exports/Loading-Indicator.md +0 -41
  149. package/data/zeroheight-exports/Navigation.md +0 -1190
  150. package/data/zeroheight-exports/Notification.md +0 -1038
  151. package/data/zeroheight-exports/Panel.md +0 -1030
  152. package/data/zeroheight-exports/README.md +0 -122
  153. package/data/zeroheight-exports/Responsive-Design.md +0 -330
  154. package/data/zeroheight-exports/Search-Input.md +0 -91
  155. package/data/zeroheight-exports/Search.md +0 -822
  156. package/data/zeroheight-exports/Segmented-Control.md +0 -609
  157. package/data/zeroheight-exports/Spacing.md +0 -297
  158. package/data/zeroheight-exports/Table.md +0 -5345
  159. package/data/zeroheight-exports/Tabs.md +0 -1324
  160. package/data/zeroheight-exports/Tags.md +0 -1545
  161. package/data/zeroheight-exports/Text-Link.md +0 -268
  162. package/data/zeroheight-exports/Theming.md +0 -362
  163. package/data/zeroheight-exports/Tooltips.md +0 -2015
  164. package/data/zeroheight-exports/Typography.md +0 -800
@@ -0,0 +1,293 @@
1
+ # IntentMessage
2
+
3
+ ## Source Code
4
+
5
+ The IntentMessage component's source code in the SDS codebase can be found [here](https://github.com/chanzuckerberg/sci-components/blob/main/packages/components/src/core/IntentMessage/index.tsx).
6
+
7
+ ## Import
8
+
9
+ **React TypeScript**
10
+
11
+ ```tsx
12
+ import { IntentMessage } from "@czi-sds/components";
13
+ ```
14
+
15
+ ## Code examples
16
+
17
+ ### Default Intent Message
18
+
19
+ The usual shape: the Input as `children`, one message, and the border turned on. The Input carries the same intent so its own styling matches.
20
+
21
+ **Example: DefaultIntentMessage**
22
+
23
+ ```tsx
24
+ // IntentMessage wraps the input it describes: children render first, then the
25
+ // messages. Set the input's own intent to match the message.
26
+
27
+ import { InputText, IntentMessage } from "@czi-sds/components";
28
+
29
+ function App() {
30
+ return (
31
+ <div className="app" style={{ width: "400px" }}>
32
+ <IntentMessage
33
+ border
34
+ messages={[
35
+ { intent: "negative", text: "Enter a valid email address." },
36
+ ]}
37
+ >
38
+ <InputText
39
+ id="default-intent-input"
40
+ label="Email"
41
+ placeholder="name@example.org"
42
+ intent="negative"
43
+ />
44
+ </IntentMessage>
45
+ </div>
46
+ );
47
+ }
48
+
49
+ export default App;
50
+ ```
51
+
52
+ ### The Three Intents
53
+
54
+ Each intent has its own color and default icon. These are rendered without children to show the message row on its own.
55
+
56
+ **Example: IntentMessageIntents**
57
+
58
+ ```tsx
59
+ // The three intents each come with a default icon: CheckCircle for positive,
60
+ // ExclamationMarkCircle for negative and notice. The text and the icon take the
61
+ // intent's foreground color, and the border takes its border color.
62
+
63
+ import { IntentMessage } from "@czi-sds/components";
64
+
65
+ const INTENTS = [
66
+ { intent: "negative", text: "This is a negative message" },
67
+ { intent: "notice", text: "This is a notice message" },
68
+ { intent: "positive", text: "This is a positive message" },
69
+ ] as const;
70
+
71
+ function App() {
72
+ return (
73
+ <div
74
+ className="app"
75
+ style={{ display: "flex", flexDirection: "column", gap: "24px" }}
76
+ >
77
+ {INTENTS.map(({ intent, text }) => (
78
+ <IntentMessage key={intent} border messages={[{ intent, text }]} />
79
+ ))}
80
+ </div>
81
+ );
82
+ }
83
+
84
+ export default App;
85
+ ```
86
+
87
+ ### Stacked Messages
88
+
89
+ Several messages can describe one Input. Both of these are given the same array; the first sorts by severity, the second has `autoOrder` off and keeps the order as written.
90
+
91
+ **Example: StackedIntentMessages**
92
+
93
+ ```tsx
94
+ // Messages are sorted by severity by default, so the array order does not
95
+ // matter. Turn autoOrder off to keep the order you passed. The border takes the
96
+ // color of the most severe intent in the list either way.
97
+
98
+ import { IntentMessage, IntentMessageItem } from "@czi-sds/components";
99
+
100
+ const MESSAGES: IntentMessageItem[] = [
101
+ { intent: "positive", text: "Password is at least 12 characters long" },
102
+ { intent: "negative", text: "Password needs one number" },
103
+ { intent: "notice", text: "Avoid reusing a password from another site" },
104
+ ];
105
+
106
+ function App() {
107
+ return (
108
+ <div
109
+ className="app"
110
+ style={{ display: "flex", flexDirection: "column", gap: "32px" }}
111
+ >
112
+ <IntentMessage border messages={MESSAGES} />
113
+ <IntentMessage border autoOrder={false} messages={MESSAGES} />
114
+ </div>
115
+ );
116
+ }
117
+
118
+ export default App;
119
+ ```
120
+
121
+ ### Custom Ordering
122
+
123
+ `orderBy` changes the ranking. Reversing it here moves the positive message to the top and switches the border to the positive color.
124
+
125
+ **Example: IntentMessageOrderBy**
126
+
127
+ ```tsx
128
+ // orderBy replaces the default severity ranking. It also decides which intent
129
+ // colors the border, since that is the first intent in the ranking that is
130
+ // present, so it applies even when autoOrder is off.
131
+
132
+ import { IntentMessage, IntentMessageItem } from "@czi-sds/components";
133
+
134
+ const MESSAGES: IntentMessageItem[] = [
135
+ { intent: "negative", text: "Two samples failed to upload" },
136
+ { intent: "notice", text: "Three samples are still processing" },
137
+ { intent: "positive", text: "Twelve samples uploaded" },
138
+ ];
139
+
140
+ function App() {
141
+ return (
142
+ <div
143
+ className="app"
144
+ style={{ display: "flex", flexDirection: "column", gap: "32px" }}
145
+ >
146
+ <IntentMessage border messages={MESSAGES} />
147
+ <IntentMessage
148
+ border
149
+ orderBy={["positive", "notice", "negative"]}
150
+ messages={MESSAGES}
151
+ />
152
+ </div>
153
+ );
154
+ }
155
+
156
+ export default App;
157
+ ```
158
+
159
+ ### Custom Icons
160
+
161
+ An icon can be given by name or as an element. Names are rendered at xs, so pass an element when you need a different size.
162
+
163
+ **Example: IntentMessageCustomIcons**
164
+
165
+ ```tsx
166
+ // icon takes either an SDS icon name or an element. A name is always rendered at
167
+ // xs, so it has to be an icon that offers that size. Either way the fill is
168
+ // forced to the intent color.
169
+
170
+ import { Icon, IntentMessage, IntentMessageItem } from "@czi-sds/components";
171
+
172
+ const MESSAGES: IntentMessageItem[] = [
173
+ { icon: "Github", intent: "notice", text: "Named SDS icon, rendered at xs" },
174
+ {
175
+ icon: <Icon sdsIcon="Sparkle" sdsSize="s" />,
176
+ intent: "positive",
177
+ text: "An Icon element, so you choose the size",
178
+ },
179
+ {
180
+ icon: <Icon sdsIcon="Lock" sdsSize="xs" />,
181
+ intent: "negative",
182
+ text: "The icon color follows the intent, not the Icon color prop",
183
+ },
184
+ ];
185
+
186
+ function App() {
187
+ return (
188
+ <div className="app">
189
+ <IntentMessage border messages={MESSAGES} />
190
+ </div>
191
+ );
192
+ }
193
+
194
+ export default App;
195
+ ```
196
+
197
+ ### Announcing the Message
198
+
199
+ To connect the message to the Input for assistive technology, keep them as siblings and reference the message container from the Input's `aria-describedby`.
200
+
201
+ **Example: AccessibleIntentMessage**
202
+
203
+ ```tsx
204
+ // The messages are plain text with no programmatic link to the input. To have
205
+ // them announced, render IntentMessage next to the input and point the input's
206
+ // aria-describedby at it. IntentMessageProps takes no id, so the id goes on a
207
+ // wrapper element, and the ARIA attributes go through slotProps.htmlInput so
208
+ // they land on the input rather than on the field wrapper.
209
+
210
+ import { InputText, IntentMessage } from "@czi-sds/components";
211
+
212
+ function App() {
213
+ return (
214
+ <div
215
+ className="app"
216
+ style={{
217
+ display: "flex",
218
+ flexDirection: "column",
219
+ gap: "8px",
220
+ width: "400px",
221
+ }}
222
+ >
223
+ <InputText
224
+ id="accessible-intent-input"
225
+ label="Sample ID"
226
+ placeholder="SAMP-0001"
227
+ intent="negative"
228
+ slotProps={{
229
+ htmlInput: {
230
+ "aria-describedby": "sample-id-messages",
231
+ "aria-invalid": true,
232
+ },
233
+ }}
234
+ />
235
+ <div id="sample-id-messages">
236
+ <IntentMessage
237
+ messages={[{ intent: "negative", text: "Use the format SAMP-0000." }]}
238
+ />
239
+ </div>
240
+ </div>
241
+ );
242
+ }
243
+
244
+ export default App;
245
+ ```
246
+
247
+ ## How it differs from Figma
248
+
249
+ The guidelines above describe two Figma constructs: an Intent Message built into every Input, and a standalone Intent Indicator that wraps an Input. In code both are the same component, **IntentMessage**, and no Input has an `intentMessage` prop:
250
+
251
+ - Wrap the Input in IntentMessage and pass the copy through the `messages` prop. The children render first, then the messages below them.
252
+
253
+ - The Intent Indicator is the `border` prop. Because it stretches the full height of the wrapper, wrapping a group of Checkboxes or Radios gives you one border across the whole group.
254
+
255
+ - IntentMessage does not color the Input itself. Set the Input's own `intent` prop to the matching value so the two agree.
256
+
257
+ ## Behavior notes
258
+
259
+ - There are three intents, `"negative"`, `"notice"`, and `"positive"`. There is no neutral or informational intent.
260
+
261
+ - Messages are sorted by severity by default, so the order of the array does not matter unless you turn `autoOrder` off.
262
+
263
+ - The border takes its color from the most severe intent present, which is the first intent in the ranking that appears in `messages`. With no messages the border renders transparent, so `border` does nothing on a wrapper that only has children.
264
+
265
+ - The border is drawn just outside the wrapper, 8px to the left of its edge. Leave room for it, or a parent with no left padding will clip it.
266
+
267
+ - An icon passed by name always renders at the xs size, so it has to be an icon that offers xs. A name that does not logs an error and renders nothing. Pass an Icon element instead when you need another size.
268
+
269
+ - The icon fill is forced to the intent color, so the `color` prop on an Icon element you pass in has no effect.
270
+
271
+ - The messages are plain text with no ARIA wiring, so assistive technology does not connect them to the Input. When a message needs to be announced, render IntentMessage beside the Input and point the Input's `aria-describedby` at a wrapper around it, as in the last example below.
272
+
273
+ ## Props
274
+
275
+ ### IntentMessage Props
276
+
277
+ | Name | Type | Default | Description |
278
+ | ----------- | --------------------------------------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
279
+ | `messages` | `IntentMessageItem[]` | `[]` | The messages to display, each with its own intent. See the table below for the shape of an item. |
280
+ | `children` | `ReactNode` | - | Rendered above the messages, inside the same wrapper. This is where the Input, or a group of Inputs, goes. |
281
+ | `border` | `boolean` | `false` | Draws a 2px vertical bar to the left of the wrapper, colored by the most severe intent in `messages`. This is the Intent Indicator from the guidelines. |
282
+ | `autoOrder` | `boolean` | `true` | Sorts the messages by intent rather than using the order of the array. Set it to `false` to preserve your order. |
283
+ | `orderBy` | `Array<"negative" \| "notice" \| "positive">` | `["negative", "notice", "positive"]` | Replaces the default severity ranking. It affects the sort order and, because it defines what counts as most severe, the border color as well, which means it still applies when `autoOrder` is `false`. |
284
+
285
+ That is the whole prop surface. `IntentMessageProps` does not extend the DOM attributes, so `id`, `className`, and `style` are all type errors even though the component would spread them onto its wrapper. Put them on an element of your own around it instead.
286
+
287
+ ### IntentMessageItem
288
+
289
+ | Name | Type | Default | Description |
290
+ | -------- | --------------------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
291
+ | `intent` | `"negative" \| "notice" \| "positive"` | - | Required. Sets the text color, the icon color, and this message's place in the ranking. |
292
+ | `text` | `string` | - | Required. The message copy. Long text wraps. |
293
+ | `icon` | `keyof IconNameToSizes \| ReactElement` | `"CheckCircle"` for `"positive"`, `"ExclamationMarkCircle"` otherwise | Replaces the default icon. A name renders at xs; an element is rendered as given, though its fill is still overridden by the intent color. |