@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.
- package/README.md +2 -1
- package/data/component-docs/Accordion.md +291 -0
- package/data/component-docs/Autocomplete.md +525 -0
- package/data/component-docs/Banner.md +231 -0
- package/data/component-docs/Button.md +224 -0
- package/data/component-docs/ButtonDropdown.md +256 -0
- package/data/component-docs/ButtonGroup.md +320 -0
- package/data/component-docs/ButtonToggle.md +397 -0
- package/data/component-docs/Callout.md +268 -0
- package/data/component-docs/CellBasic.md +122 -0
- package/data/component-docs/CellComponent.md +63 -0
- package/data/component-docs/CellHeader.md +128 -0
- package/data/component-docs/ComplexFilter.md +294 -0
- package/data/component-docs/ContentCard.md +406 -0
- package/data/component-docs/Dialog.md +651 -0
- package/data/component-docs/Dropdown.md +155 -0
- package/data/component-docs/DropdownMenu.md +949 -0
- package/data/component-docs/HeatmapChart.md +782 -0
- package/data/component-docs/Hero.md +363 -0
- package/data/component-docs/Icon.md +283 -0
- package/data/component-docs/InputCheckbox.md +205 -0
- package/data/component-docs/InputDropdown.md +482 -0
- package/data/component-docs/InputRadio.md +173 -0
- package/data/component-docs/InputSearch.md +81 -0
- package/data/component-docs/InputSlider.md +189 -0
- package/data/component-docs/InputText.md +110 -0
- package/data/component-docs/InputToggle.md +141 -0
- package/data/component-docs/IntentMessage.md +293 -0
- package/data/component-docs/Legend.md +442 -0
- package/data/component-docs/Link.md +23 -0
- package/data/component-docs/List.md +300 -0
- package/data/component-docs/LoadingIndicator.md +198 -0
- package/data/component-docs/Menu.md +298 -0
- package/data/component-docs/MenuItem.md +100 -0
- package/data/component-docs/NavigationFooter.md +165 -0
- package/data/component-docs/NavigationHeader.md +500 -0
- package/data/component-docs/NavigationJumpTo.md +414 -0
- package/data/component-docs/Notification.md +288 -0
- package/data/component-docs/Pagination.md +67 -0
- package/data/component-docs/Panel.md +636 -0
- package/data/component-docs/Popover.md +448 -0
- package/data/component-docs/PreComposedTable.md +2947 -0
- package/data/component-docs/ProteinStructureViewer.md +1044 -0
- package/data/component-docs/SegmentedControl.md +396 -0
- package/data/component-docs/StackedBarChart.md +475 -0
- package/data/component-docs/Table.md +2000 -0
- package/data/component-docs/TableHeader.md +53 -0
- package/data/component-docs/TableRow.md +74 -0
- package/data/component-docs/Tabs.md +455 -0
- package/data/component-docs/Tag.md +647 -0
- package/data/component-docs/TagFilter.md +131 -0
- package/data/component-docs/Tooltip.md +561 -0
- package/data/component-docs/TooltipCondensed.md +203 -0
- package/data/component-docs/TooltipTable.md +145 -0
- package/data/component-docs/index.json +267 -0
- package/data/component-list.json +2 -5
- package/data/component-props/Accordion.json +31 -11
- package/data/component-props/Alert.json +3 -3
- package/data/component-props/Autocomplete.json +150 -15
- package/data/component-props/Banner.json +31 -17
- package/data/component-props/Button.json +45 -20
- package/data/component-props/ButtonDropdown.json +36 -17
- package/data/component-props/ButtonDropdownLegacy.json +11 -11
- package/data/component-props/ButtonGroup.json +32 -11
- package/data/component-props/ButtonIcon.json +10 -10
- package/data/component-props/ButtonLegacy.json +19 -19
- package/data/component-props/ButtonToggle.json +32 -19
- package/data/component-props/ButtonToggleLegacy.json +11 -11
- package/data/component-props/Callout.json +58 -17
- package/data/component-props/CellBasic.json +94 -41
- package/data/component-props/CellComponent.json +23 -7
- package/data/component-props/CellHeader.json +62 -19
- package/data/component-props/ComplexFilter.json +52 -21
- package/data/component-props/ContentCard.json +70 -47
- package/data/component-props/Dialog.json +47 -14
- package/data/component-props/Dropdown.json +68 -31
- package/data/component-props/DropdownMenu.json +128 -23
- package/data/component-props/HeatmapChart.json +88 -12
- package/data/component-props/Hero.json +80 -39
- package/data/component-props/Icon.json +20 -9
- package/data/component-props/InputCheckbox.json +36 -14
- package/data/component-props/InputDropdown.json +75 -27
- package/data/component-props/InputRadio.json +31 -13
- package/data/component-props/InputSearch.json +41 -18
- package/data/component-props/InputSlider.json +46 -19
- package/data/component-props/InputText.json +26 -19
- package/data/component-props/InputToggle.json +26 -9
- package/data/component-props/IntentMessage.json +38 -9
- package/data/component-props/Link.json +13 -7
- package/data/component-props/LoadingIndicator.json +11 -3
- package/data/component-props/MenuItem.json +38 -19
- package/data/component-props/MenuSelect.json +8 -8
- package/data/component-props/NavigationFooter.json +49 -19
- package/data/component-props/NavigationHeader.json +150 -37
- package/data/component-props/NavigationJumpTo.json +33 -7
- package/data/component-props/Notification.json +39 -21
- package/data/component-props/Pagination.json +39 -11
- package/data/component-props/Panel.json +62 -9
- package/data/component-props/Popover.json +80 -7
- package/data/component-props/PreComposedTable.json +99 -27
- package/data/component-props/ProteinStructureViewer.json +117 -0
- package/data/component-props/SegmentedControl.json +42 -3
- package/data/component-props/StackedBarChart.json +116 -42
- package/data/component-props/TableRow.json +38 -19
- package/data/component-props/Tabs.json +66 -9
- package/data/component-props/Tag.json +34 -17
- package/data/component-props/TagFilter.json +10 -3
- package/data/component-props/Tooltip.json +49 -18
- package/data/component-props/TooltipCondensed.json +18 -9
- package/data/component-props/TooltipTable.json +17 -7
- package/data/resources/{zeroheight-rules.md → documentation-rules.md} +43 -30
- package/data/resources/figma-rules.md +2 -2
- package/data/tailwind.json +20 -14
- package/dist/stdio.js +112 -208
- package/package.json +9 -5
- package/data/component-props/ButtonDropdownV2.json +0 -34
- package/data/component-props/ButtonNew.json +0 -47
- package/data/component-props/ButtonToggleV2.json +0 -44
- package/data/component-props/ButtonV2.json +0 -43
- package/data/zeroheight-cache.json +0 -10259
- package/data/zeroheight-exports/Accordion.md +0 -774
- package/data/zeroheight-exports/Banner.md +0 -691
- package/data/zeroheight-exports/Borders.md +0 -117
- package/data/zeroheight-exports/Buttons.md +0 -1854
- package/data/zeroheight-exports/Callout.md +0 -931
- package/data/zeroheight-exports/Colors.md +0 -1755
- package/data/zeroheight-exports/Content-Card.md +0 -309
- package/data/zeroheight-exports/Contributing-to-SDS.md +0 -98
- package/data/zeroheight-exports/Control-Inputs.md +0 -2818
- package/data/zeroheight-exports/Corners.md +0 -104
- package/data/zeroheight-exports/Cover-page.md +0 -3
- package/data/zeroheight-exports/Dialog.md +0 -1367
- package/data/zeroheight-exports/Downloads.md +0 -236
- package/data/zeroheight-exports/Drop-Shadows.md +0 -79
- package/data/zeroheight-exports/Dropdown-Input.md +0 -1776
- package/data/zeroheight-exports/Dropdown-Menus.md +0 -913
- package/data/zeroheight-exports/Element-Status-Tracker.md +0 -267
- package/data/zeroheight-exports/Field-Inputs.md +0 -1405
- package/data/zeroheight-exports/Filters.md +0 -1111
- package/data/zeroheight-exports/Getting-Started.md +0 -1157
- package/data/zeroheight-exports/Hero.md +0 -414
- package/data/zeroheight-exports/Icons.md +0 -2067
- package/data/zeroheight-exports/Intent.md +0 -86
- package/data/zeroheight-exports/Introduction-to-Bases.md +0 -35
- package/data/zeroheight-exports/Introduction-to-Cells.md +0 -35
- package/data/zeroheight-exports/Introduction-to-DNA.md +0 -35
- package/data/zeroheight-exports/Introduction-to-Genes.md +0 -35
- package/data/zeroheight-exports/Introduction.md +0 -115
- package/data/zeroheight-exports/Link.md +0 -432
- package/data/zeroheight-exports/Lists.md +0 -986
- package/data/zeroheight-exports/Loading-Indicator.md +0 -41
- package/data/zeroheight-exports/Navigation.md +0 -1190
- package/data/zeroheight-exports/Notification.md +0 -1038
- package/data/zeroheight-exports/Panel.md +0 -1030
- package/data/zeroheight-exports/README.md +0 -122
- package/data/zeroheight-exports/Responsive-Design.md +0 -330
- package/data/zeroheight-exports/Search-Input.md +0 -91
- package/data/zeroheight-exports/Search.md +0 -822
- package/data/zeroheight-exports/Segmented-Control.md +0 -609
- package/data/zeroheight-exports/Spacing.md +0 -297
- package/data/zeroheight-exports/Table.md +0 -5345
- package/data/zeroheight-exports/Tabs.md +0 -1324
- package/data/zeroheight-exports/Tags.md +0 -1545
- package/data/zeroheight-exports/Text-Link.md +0 -268
- package/data/zeroheight-exports/Theming.md +0 -362
- package/data/zeroheight-exports/Tooltips.md +0 -2015
- package/data/zeroheight-exports/Typography.md +0 -800
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# InputCheckbox
|
|
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/InputCheckbox/index.tsx).
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
**React TypeScript**
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { InputCheckbox } from "@czi-sds/components";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Code examples
|
|
16
|
+
|
|
17
|
+
### **Default InputCheckbox**
|
|
18
|
+
|
|
19
|
+
This example has the minimum props needed for the InputCheckbox component.
|
|
20
|
+
|
|
21
|
+
**Example: DefaultInputCheckbox**
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { InputCheckbox } from "@czi-sds/components";
|
|
25
|
+
|
|
26
|
+
function App() {
|
|
27
|
+
return (
|
|
28
|
+
<div className="app">
|
|
29
|
+
<InputCheckbox label="Label" />
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default App;
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### InputCheckbox + Caption
|
|
38
|
+
|
|
39
|
+
This example shows the InputCheckbox with an additional caption beneath the label, presented in a lighter text color.
|
|
40
|
+
|
|
41
|
+
**Example: InputCheckboxCaption**
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { InputCheckbox } from "@czi-sds/components";
|
|
45
|
+
|
|
46
|
+
function App() {
|
|
47
|
+
return (
|
|
48
|
+
<div className="app">
|
|
49
|
+
<InputCheckbox caption="Caption" label="Label" />
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default App;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### InputCheckbox stages
|
|
58
|
+
|
|
59
|
+
The three stages a checkbox can be in, plus a disabled one. Because `stage` pins the state, these examples do not respond to clicks.
|
|
60
|
+
|
|
61
|
+
**Example: InputCheckboxStages**
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
// `stage` pins the state, so pair it with `onChange` when the checkbox
|
|
65
|
+
// needs to respond to clicks.
|
|
66
|
+
import { InputCheckbox } from "@czi-sds/components";
|
|
67
|
+
|
|
68
|
+
function App() {
|
|
69
|
+
return (
|
|
70
|
+
<div
|
|
71
|
+
className="app"
|
|
72
|
+
style={{ display: "flex", flexDirection: "column", gap: "8px" }}
|
|
73
|
+
>
|
|
74
|
+
<InputCheckbox label="Unchecked" stage="unchecked" />
|
|
75
|
+
<InputCheckbox label="Checked" stage="checked" />
|
|
76
|
+
<InputCheckbox label="Indeterminate" stage="indeterminate" />
|
|
77
|
+
<InputCheckbox label="Disabled" stage="checked" disabled />
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export default App;
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### InputCheckbox intents
|
|
86
|
+
|
|
87
|
+
Intent colors the border of the empty box. Check any of these and the box turns the same accent color.
|
|
88
|
+
|
|
89
|
+
**Example: InputCheckboxIntents**
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
// `intent` colors the empty box only; a checked box always uses the accent color.
|
|
93
|
+
import { InputCheckbox } from "@czi-sds/components";
|
|
94
|
+
|
|
95
|
+
function App() {
|
|
96
|
+
return (
|
|
97
|
+
<div className="app" style={{ display: "flex", gap: "24px" }}>
|
|
98
|
+
<InputCheckbox label="Default" intent="default" />
|
|
99
|
+
<InputCheckbox label="Positive" intent="positive" />
|
|
100
|
+
<InputCheckbox label="Notice" intent="notice" />
|
|
101
|
+
<InputCheckbox label="Negative" intent="negative" />
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export default App;
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Indeterminate Checkbox
|
|
110
|
+
|
|
111
|
+
This example demonstrates a parent checkbox that is indeterminate while only some of its children are checked, and checked once all of them are. Since it recomputes `stage` from its own state on every change, the checkboxes stay interactive.
|
|
112
|
+
|
|
113
|
+
**Example: IndeterminateCheckbox**
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
import { useState } from "react";
|
|
117
|
+
import { InputCheckbox } from "@czi-sds/components";
|
|
118
|
+
|
|
119
|
+
const CHILDREN = ["Child 1", "Child 2"];
|
|
120
|
+
|
|
121
|
+
function App() {
|
|
122
|
+
const [checked, setChecked] = useState([true, false]);
|
|
123
|
+
|
|
124
|
+
const allChecked = checked.every(Boolean);
|
|
125
|
+
const someChecked = checked.some(Boolean);
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<div className="app">
|
|
129
|
+
<InputCheckbox
|
|
130
|
+
label="Parent"
|
|
131
|
+
stage={
|
|
132
|
+
allChecked ? "checked" : someChecked ? "indeterminate" : "unchecked"
|
|
133
|
+
}
|
|
134
|
+
onChange={() => setChecked(checked.map(() => !allChecked))}
|
|
135
|
+
/>
|
|
136
|
+
<div
|
|
137
|
+
style={{
|
|
138
|
+
display: "flex",
|
|
139
|
+
flexDirection: "column",
|
|
140
|
+
marginLeft: "24px",
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
{CHILDREN.map((label, index) => (
|
|
144
|
+
<InputCheckbox
|
|
145
|
+
key={label}
|
|
146
|
+
label={label}
|
|
147
|
+
stage={checked[index] ? "checked" : "unchecked"}
|
|
148
|
+
onChange={() =>
|
|
149
|
+
setChecked((previous) =>
|
|
150
|
+
previous.map((value, position) =>
|
|
151
|
+
position === index ? !value : value
|
|
152
|
+
)
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
/>
|
|
156
|
+
))}
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export default App;
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## SDS vs MUI
|
|
166
|
+
|
|
167
|
+
The following props and options differ in how they function across the MUI Checkbox component and the SDS InputCheckbox component:
|
|
168
|
+
|
|
169
|
+
- `size`: Has no effect in SDS. The box is always 16px.
|
|
170
|
+
|
|
171
|
+
- `color`: Not accepted. SDS derives the color from `intent` instead.
|
|
172
|
+
|
|
173
|
+
- `intent`: This is an SDS-specific prop that colors the border of the empty box (`"default"`, `"positive"`, `"notice"`, or `"negative"`). It does not change the checked box, which always uses the accent color.
|
|
174
|
+
|
|
175
|
+
- `labelPlacement`: Has no effect in SDS. The label always sits to the right of the box.
|
|
176
|
+
|
|
177
|
+
- `icon`: SDS's InputCheckbox is not currently set up to support icons (if you add one as shown in the [MUI documentation](https://mui.com/material-ui/react-checkbox/#icon), it will replace the empty checkbox square, but clicking the icon will result in the checked checkbox square appearing in the icon's place)
|
|
178
|
+
|
|
179
|
+
- `stage` and checkbox state: This is the SDS prop that sets the checkbox's state as `"unchecked"`, `"checked"`, or `"indeterminate"`. It pins the state, so on its own the checkbox will not respond to clicks; pass an `onChange` handler and recompute `stage` from your own state to make it interactive, as the indeterminate example below does. Leave `stage` out entirely to let the checkbox manage its own state.
|
|
180
|
+
|
|
181
|
+
- `defaultChecked` and `indeterminate`: Not accepted as top-level props. Use `stage`, or pass them straight to the underlying MUI checkbox through `checkboxProps`.
|
|
182
|
+
|
|
183
|
+
- `caption`: This is an SDS-specific prop, which takes a string of text that is displayed below the primary label text.
|
|
184
|
+
|
|
185
|
+
The following props are available for both the MUI and SDS components: `checked`, `onChange`, `required`, `value`, and `disabled`.
|
|
186
|
+
|
|
187
|
+
## MUI Documentation
|
|
188
|
+
|
|
189
|
+
Documentation for the underlying MUI component can be found [here](https://mui.com/material-ui/react-checkbox/).
|
|
190
|
+
|
|
191
|
+
## Props
|
|
192
|
+
|
|
193
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
194
|
+
|
|
195
|
+
| Name | Type | Default | Description |
|
|
196
|
+
| --------------- | --------------------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
197
|
+
| `caption` | `string` | - | The caption of the InputCheckbox appears beneath the label in a lighter text color. |
|
|
198
|
+
| `checkboxProps` | `Partial<MUICheckboxProps>` | `{}` | Directly pass these props to the underlying MUI checkbox. |
|
|
199
|
+
| `label` | `ReactNode` | - | The label of the InputCheckbox. When omitted, the box renders on its own with no label element. |
|
|
200
|
+
| `stage` | `"checked"` \| `"unchecked"` \| `"indeterminate"` | - | Sets the state of the checkbox. It overrides `checked`, so a checkbox with a `stage` only changes when you recompute the `stage` from an `onChange` handler. Omit it to let the checkbox manage its own state. |
|
|
201
|
+
| `intent` | `"default"` \| `"notice"` \| `"negative"` \| `"positive"` | `"default"` | Colors the border of the empty box. The checked box always uses the accent color. |
|
|
202
|
+
| `checked` | `boolean` | - | Controls the checkbox, as in MUI. Ignored when `stage` is set. |
|
|
203
|
+
| `onChange` | `(event, checked) => void` | - | Called when the user toggles the checkbox. |
|
|
204
|
+
| `disabled` | `boolean` | `false` | If `true`, the component is disabled. |
|
|
205
|
+
| `classes` | `object` | `{}` | Class names for the internal elements: `root`, `labelCaptionContainer`, `label`, `caption`, `checkbox`, `checkboxCheckedIcon`, `checkboxDefaultIcon`, and `checkboxIndeterminateIcon`. |
|