@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.
- 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/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 +262 -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/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/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,203 @@
|
|
|
1
|
+
# TooltipCondensed
|
|
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/TooltipCondensed/index.tsx).
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
**React TypeScript**
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { TooltipCondensed } from "@czi-sds/components";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Code examples
|
|
16
|
+
|
|
17
|
+
### Default TooltipCondensed
|
|
18
|
+
|
|
19
|
+
One line of text on a cell, which is all a condensed tooltip needs. Move across the cell to see it follow the cursor, the behaviour the component locks in and the reason it suits a chart.
|
|
20
|
+
|
|
21
|
+
**Example: DefaultTooltipCondensed**
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
// The least a condensed tooltip needs: one line of text on something the pointer
|
|
25
|
+
// passes over. Move across the cell to see it follow the cursor, which is the
|
|
26
|
+
// behaviour the component locks in and the reason it suits a chart.
|
|
27
|
+
|
|
28
|
+
import {
|
|
29
|
+
TooltipCondensed,
|
|
30
|
+
fontBodyXs,
|
|
31
|
+
getSemanticColors,
|
|
32
|
+
getSpaces,
|
|
33
|
+
type CommonThemeProps,
|
|
34
|
+
} from "@czi-sds/components";
|
|
35
|
+
import styled from "@emotion/styled";
|
|
36
|
+
|
|
37
|
+
const Stage = styled.div<CommonThemeProps>`
|
|
38
|
+
${(props) => {
|
|
39
|
+
const spaces = getSpaces(props);
|
|
40
|
+
|
|
41
|
+
return `
|
|
42
|
+
display: flex;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
padding: ${spaces?.xl}px 0;
|
|
45
|
+
`;
|
|
46
|
+
}}
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
const Cell = styled.div<CommonThemeProps>`
|
|
50
|
+
${fontBodyXs}
|
|
51
|
+
|
|
52
|
+
${(props) => {
|
|
53
|
+
const semanticColors = getSemanticColors(props);
|
|
54
|
+
const spaces = getSpaces(props);
|
|
55
|
+
|
|
56
|
+
return `
|
|
57
|
+
border: 1px solid ${semanticColors?.base?.divider};
|
|
58
|
+
border-radius: 4px;
|
|
59
|
+
color: ${semanticColors?.base?.textPrimary};
|
|
60
|
+
cursor: default;
|
|
61
|
+
padding: ${spaces?.s}px ${spaces?.m}px;
|
|
62
|
+
`;
|
|
63
|
+
}}
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
function App() {
|
|
67
|
+
return (
|
|
68
|
+
<div className="app">
|
|
69
|
+
<Stage>
|
|
70
|
+
<TooltipCondensed title="1,284 cells">
|
|
71
|
+
<Cell>A point in a chart</Cell>
|
|
72
|
+
</TooltipCondensed>
|
|
73
|
+
</Stage>
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default App;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### TooltipCondensed with indicator
|
|
82
|
+
|
|
83
|
+
Two condensed tooltips on a table cell, each with a coloured dot tying it to the value it describes. Both follow the pointer as it moves across the cell.
|
|
84
|
+
|
|
85
|
+
**Example: TooltipCondensedWithIndicator**
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
// TooltipCondensed is the label-sized tooltip for dense surfaces: charts, table
|
|
89
|
+
// cells, anywhere a full sentence would be too much. It follows the cursor instead
|
|
90
|
+
// of anchoring to the element, and it locks that down: followCursor, placement,
|
|
91
|
+
// arrow, and the enter and leave delays are all applied after your props, so passing
|
|
92
|
+
// placement or arrow here changes nothing.
|
|
93
|
+
//
|
|
94
|
+
// indicator draws a 12px dot before the text, coloured by indicatorColor, for tying
|
|
95
|
+
// the tooltip to a series in a chart. indicatorColor takes a raw CSS colour rather
|
|
96
|
+
// than an SDS name, so read the one you want off the theme. Without it the dot is
|
|
97
|
+
// still laid out, just invisible.
|
|
98
|
+
|
|
99
|
+
import {
|
|
100
|
+
TooltipCondensed,
|
|
101
|
+
fontBodyXs,
|
|
102
|
+
getSemanticColors,
|
|
103
|
+
getSpaces,
|
|
104
|
+
type CommonThemeProps,
|
|
105
|
+
} from "@czi-sds/components";
|
|
106
|
+
import styled from "@emotion/styled";
|
|
107
|
+
import { useTheme } from "@mui/material/styles";
|
|
108
|
+
|
|
109
|
+
const Stage = styled.div<CommonThemeProps>`
|
|
110
|
+
${(props) => {
|
|
111
|
+
const spaces = getSpaces(props);
|
|
112
|
+
|
|
113
|
+
return `
|
|
114
|
+
display: flex;
|
|
115
|
+
gap: ${spaces?.xxl}px;
|
|
116
|
+
justify-content: center;
|
|
117
|
+
padding: ${spaces?.xl}px 0;
|
|
118
|
+
`;
|
|
119
|
+
}}
|
|
120
|
+
`;
|
|
121
|
+
|
|
122
|
+
const Cell = styled.div<CommonThemeProps>`
|
|
123
|
+
${fontBodyXs}
|
|
124
|
+
|
|
125
|
+
${(props) => {
|
|
126
|
+
const semanticColors = getSemanticColors(props);
|
|
127
|
+
const spaces = getSpaces(props);
|
|
128
|
+
|
|
129
|
+
return `
|
|
130
|
+
align-items: center;
|
|
131
|
+
border: 1px solid ${semanticColors?.base?.divider};
|
|
132
|
+
border-radius: 4px;
|
|
133
|
+
color: ${semanticColors?.base?.textPrimary};
|
|
134
|
+
cursor: default;
|
|
135
|
+
display: flex;
|
|
136
|
+
gap: ${spaces?.xs}px;
|
|
137
|
+
padding: ${spaces?.s}px ${spaces?.m}px;
|
|
138
|
+
`;
|
|
139
|
+
}}
|
|
140
|
+
`;
|
|
141
|
+
|
|
142
|
+
function App() {
|
|
143
|
+
const theme = useTheme();
|
|
144
|
+
const semanticColors = getSemanticColors({ theme });
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<div className="app">
|
|
148
|
+
<Stage>
|
|
149
|
+
<TooltipCondensed
|
|
150
|
+
indicator
|
|
151
|
+
indicatorColor={semanticColors?.info?.fillPrimary}
|
|
152
|
+
title="1,284 cells"
|
|
153
|
+
>
|
|
154
|
+
<Cell>Hover a data point</Cell>
|
|
155
|
+
</TooltipCondensed>
|
|
156
|
+
|
|
157
|
+
<TooltipCondensed
|
|
158
|
+
indicator
|
|
159
|
+
indicatorColor={semanticColors?.negative?.fillPrimary}
|
|
160
|
+
title="12 failed QC"
|
|
161
|
+
>
|
|
162
|
+
<Cell>Hover a failing point</Cell>
|
|
163
|
+
</TooltipCondensed>
|
|
164
|
+
</Stage>
|
|
165
|
+
</div>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export default App;
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## SDS vs MUI
|
|
173
|
+
|
|
174
|
+
TooltipCondensed is the SDS Tooltip with tighter padding and a fixed set of behaviors, for labelling something in a dense surface such as a chart or a table cell. It takes every Tooltip prop, including `subtitle` and `componentSlot`, and adds two of its own:
|
|
175
|
+
|
|
176
|
+
- `indicator`: draws a 12px round dot before the text, for tying the tooltip to a series in a chart or a colour in a legend.
|
|
177
|
+
|
|
178
|
+
- `indicatorColor`: the dot's colour, given as a CSS colour rather than an SDS name, so read the one you want off the theme. With `indicator` but no colour the dot still takes up its space and stays invisible.
|
|
179
|
+
|
|
180
|
+
Five props are applied after yours and so cannot be changed: `followCursor`, which is what makes the tooltip track the pointer rather than anchor to the element; `placement="right-end"`; `arrow={false}`; and `enterDelay` and `leaveDelay` of 50ms each, which keep it from flickering as the pointer crosses a dense chart. Passing a placement or an arrow of your own is silently ignored.
|
|
181
|
+
|
|
182
|
+
## MUI Documentation
|
|
183
|
+
|
|
184
|
+
Documentation for the underlying MUI component can be found [here](https://mui.com/material-ui/react-tooltip/).
|
|
185
|
+
|
|
186
|
+
## Behavior and accessibility
|
|
187
|
+
|
|
188
|
+
- Because it follows the cursor, this tooltip is a pointer-only affordance. It still opens on focus, but it then appears wherever the pointer happens to be, so anything it says has to exist elsewhere for a keyboard or screen reader user.
|
|
189
|
+
|
|
190
|
+
- Keep the text to a label: a value, a count, a name. Full sentences belong in a Tooltip, and rows of numbers belong in a TooltipTable passed through `componentSlot`.
|
|
191
|
+
|
|
192
|
+
- The dot carries no meaning on its own. Whatever it encodes needs to be legible from the text beside it too.
|
|
193
|
+
|
|
194
|
+
## Props
|
|
195
|
+
|
|
196
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
197
|
+
|
|
198
|
+
| Name | Type | Default | Description |
|
|
199
|
+
| ---------------- | ----------- | ------- | -------------------------------------------------------------------------------------------- |
|
|
200
|
+
| `title` | `ReactNode` | - | The label to show. Pass `null` when the content is coming through `componentSlot` instead. |
|
|
201
|
+
| `indicator` | `boolean` | `false` | Draws a 12px round dot before the text. |
|
|
202
|
+
| `indicatorColor` | `string` | - | The dot's colour, as a CSS colour. Without it the dot occupies its space but cannot be seen. |
|
|
203
|
+
| `componentSlot` | `ReactNode` | - | Inherited from Tooltip, and how a TooltipTable is placed inside a condensed tooltip. |
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# TooltipTable
|
|
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/TooltipTable/index.tsx).
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
**React TypeScript**
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { TooltipTable } from "@czi-sds/components";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Code examples
|
|
16
|
+
|
|
17
|
+
### Default TooltipTable
|
|
18
|
+
|
|
19
|
+
The table inside a condensed tooltip in the lighter scheme, which is what pairs it with a chart or a table cell that the pointer moves across.
|
|
20
|
+
|
|
21
|
+
**Example: DefaultTooltipTable**
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
// TooltipTable is not a tooltip. It is the content (a two-column table of labels
|
|
25
|
+
// and values, grouped into sections) that goes inside one.
|
|
26
|
+
//
|
|
27
|
+
// It belongs in componentSlot rather than title, because title wraps whatever it is
|
|
28
|
+
// given in a paragraph, and a table inside a paragraph is invalid HTML that React
|
|
29
|
+
// complains about. Pair it with TooltipCondensed so the table follows the cursor,
|
|
30
|
+
// which is how it is meant to behave over a chart or a table cell.
|
|
31
|
+
//
|
|
32
|
+
// The table asks for at least 224px and the tooltip caps out at 250px, so the two
|
|
33
|
+
// only just fit. Long labels are what break the layout first, so keep them short.
|
|
34
|
+
|
|
35
|
+
import {
|
|
36
|
+
TooltipCondensed,
|
|
37
|
+
TooltipTable,
|
|
38
|
+
fontBodyXs,
|
|
39
|
+
getSemanticColors,
|
|
40
|
+
getSpaces,
|
|
41
|
+
type CommonThemeProps,
|
|
42
|
+
} from "@czi-sds/components";
|
|
43
|
+
import styled from "@emotion/styled";
|
|
44
|
+
|
|
45
|
+
const DATA = [
|
|
46
|
+
{
|
|
47
|
+
dataRows: [
|
|
48
|
+
{ label: "Cells", value: "1,284" },
|
|
49
|
+
{ label: "Median genes", value: "2,105" },
|
|
50
|
+
{ label: "Mito. reads", value: "4.2%" },
|
|
51
|
+
],
|
|
52
|
+
label: "Sample",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
dataRows: [
|
|
56
|
+
{ label: "Depth", value: "34x" },
|
|
57
|
+
{ label: "Duplicates", value: "8.1%" },
|
|
58
|
+
],
|
|
59
|
+
label: "Sequencing",
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const Stage = styled.div<CommonThemeProps>`
|
|
64
|
+
${(props) => {
|
|
65
|
+
const spaces = getSpaces(props);
|
|
66
|
+
|
|
67
|
+
return `
|
|
68
|
+
display: flex;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
padding: ${spaces?.xl}px 0;
|
|
71
|
+
`;
|
|
72
|
+
}}
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
const Cell = styled.div<CommonThemeProps>`
|
|
76
|
+
${fontBodyXs}
|
|
77
|
+
|
|
78
|
+
${(props) => {
|
|
79
|
+
const semanticColors = getSemanticColors(props);
|
|
80
|
+
const spaces = getSpaces(props);
|
|
81
|
+
|
|
82
|
+
return `
|
|
83
|
+
border: 1px solid ${semanticColors?.base?.divider};
|
|
84
|
+
border-radius: 4px;
|
|
85
|
+
color: ${semanticColors?.base?.textPrimary};
|
|
86
|
+
cursor: default;
|
|
87
|
+
padding: ${spaces?.s}px ${spaces?.m}px;
|
|
88
|
+
`;
|
|
89
|
+
}}
|
|
90
|
+
`;
|
|
91
|
+
|
|
92
|
+
function App() {
|
|
93
|
+
return (
|
|
94
|
+
<div className="app">
|
|
95
|
+
<Stage>
|
|
96
|
+
<TooltipCondensed
|
|
97
|
+
componentSlot={<TooltipTable data={DATA} itemAlign="right" />}
|
|
98
|
+
title={null}
|
|
99
|
+
>
|
|
100
|
+
<Cell>Hover for the sample summary</Cell>
|
|
101
|
+
</TooltipCondensed>
|
|
102
|
+
</Stage>
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export default App;
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## SDS vs MUI
|
|
111
|
+
|
|
112
|
+
TooltipTable is not a tooltip. It is the content that goes inside one: a two-column table of labels and values built on MUI's Table, exported as `TooltipTable` and named `TooltipTableContent` in the source. It has no trigger, no hover behavior and no popper of its own, so it does nothing on its own. Pass it to a tooltip's `componentSlot` and let the tooltip do the showing. What it adds:
|
|
113
|
+
|
|
114
|
+
- `data`: the sections. Each one takes a `label`, a list of `dataRows` of label and value, and an optional `disabled` flag. Sections are separated by a divider, in the order given.
|
|
115
|
+
|
|
116
|
+
- `itemAlign`: whether the values sit at the right of their column, which lines numbers up, or at the left.
|
|
117
|
+
|
|
118
|
+
- `showSectionHeader`: whether the section labels are drawn at all. The dividers stay either way.
|
|
119
|
+
|
|
120
|
+
- `contentAlert`: a line above the whole table, as a string or an element, for a caveat about the numbers below it.
|
|
121
|
+
|
|
122
|
+
## MUI Documentation
|
|
123
|
+
|
|
124
|
+
Documentation for the underlying MUI component can be found [here](https://mui.com/material-ui/react-table/).
|
|
125
|
+
|
|
126
|
+
## Behavior and accessibility
|
|
127
|
+
|
|
128
|
+
- Put it in `componentSlot`, not `title`. A tooltip wraps its title in a paragraph, and a table inside a paragraph is invalid HTML that React reports as an error in the console.
|
|
129
|
+
|
|
130
|
+
- The table asks for at least 224px and a tooltip stops at 250px, so there is almost no slack: long row labels wrap and push the table into a scrollbar. Keeping labels to a word or two matters more here than anywhere else. `width="wide"` on the tooltip buys room for a table that genuinely needs it.
|
|
131
|
+
|
|
132
|
+
- A disabled section is drawn in the disabled text colour and nothing more: it is still read out in full, so the reason it is dimmed has to come from somewhere else, such as the `contentAlert` above it.
|
|
133
|
+
|
|
134
|
+
- Everything in a tooltip disappears with the pointer, and a real table of numbers is often worth putting on the page instead.
|
|
135
|
+
|
|
136
|
+
## Props
|
|
137
|
+
|
|
138
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
139
|
+
|
|
140
|
+
| Name | Type | Default | Description |
|
|
141
|
+
| ------------------- | ----------------------------------------------------------------------------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
142
|
+
| `data` | `Array<{` `label?: string;` `dataRows: {` `label: string;` `value: string \| number;` `}[];` `disabled?: boolean;` `}>` | - | The sections, drawn in order and separated by dividers. A section's `label` heads it, its `dataRows` fill it, and `disabled` greys the whole block. |
|
|
143
|
+
| `itemAlign` | `"left" \| "right"` | `"right"` | Which side of its column each value sits on. Right lines numbers up with each other. |
|
|
144
|
+
| `showSectionHeader` | `boolean` | `true` | Whether section labels are drawn. False hides all of them; the dividers between sections stay. |
|
|
145
|
+
| `contentAlert` | `string \| JSX.Element` | - | A note above the whole table, for a caveat about the numbers. Takes an element, so it can hold a link. |
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Accordion": {
|
|
3
|
+
"file": "Accordion.md",
|
|
4
|
+
"package": "@czi-sds/components",
|
|
5
|
+
"source": "packages/components/src/core/Accordion/__storybook__/docs/content.html"
|
|
6
|
+
},
|
|
7
|
+
"Autocomplete": {
|
|
8
|
+
"file": "Autocomplete.md",
|
|
9
|
+
"package": "@czi-sds/components",
|
|
10
|
+
"source": "packages/components/src/core/Autocomplete/__storybook__/docs/content.html"
|
|
11
|
+
},
|
|
12
|
+
"Banner": {
|
|
13
|
+
"file": "Banner.md",
|
|
14
|
+
"package": "@czi-sds/components",
|
|
15
|
+
"source": "packages/components/src/core/Banner/__storybook__/docs/content.html"
|
|
16
|
+
},
|
|
17
|
+
"Button": {
|
|
18
|
+
"file": "Button.md",
|
|
19
|
+
"package": "@czi-sds/components",
|
|
20
|
+
"source": "packages/components/src/core/Button/__storybook__/docs/content.html"
|
|
21
|
+
},
|
|
22
|
+
"ButtonDropdown": {
|
|
23
|
+
"file": "ButtonDropdown.md",
|
|
24
|
+
"package": "@czi-sds/components",
|
|
25
|
+
"source": "packages/components/src/core/ButtonDropdown/__storybook__/docs/content.html"
|
|
26
|
+
},
|
|
27
|
+
"ButtonGroup": {
|
|
28
|
+
"file": "ButtonGroup.md",
|
|
29
|
+
"package": "@czi-sds/components",
|
|
30
|
+
"source": "packages/components/src/core/ButtonGroup/__storybook__/docs/content.html"
|
|
31
|
+
},
|
|
32
|
+
"ButtonToggle": {
|
|
33
|
+
"file": "ButtonToggle.md",
|
|
34
|
+
"package": "@czi-sds/components",
|
|
35
|
+
"source": "packages/components/src/core/ButtonToggle/__storybook__/docs/content.html"
|
|
36
|
+
},
|
|
37
|
+
"Callout": {
|
|
38
|
+
"file": "Callout.md",
|
|
39
|
+
"package": "@czi-sds/components",
|
|
40
|
+
"source": "packages/components/src/core/Callout/__storybook__/docs/content.html"
|
|
41
|
+
},
|
|
42
|
+
"CellBasic": {
|
|
43
|
+
"file": "CellBasic.md",
|
|
44
|
+
"package": "@czi-sds/components",
|
|
45
|
+
"source": "packages/components/src/core/CellBasic/__storybook__/docs/content.html"
|
|
46
|
+
},
|
|
47
|
+
"CellComponent": {
|
|
48
|
+
"file": "CellComponent.md",
|
|
49
|
+
"package": "@czi-sds/components",
|
|
50
|
+
"source": "packages/components/src/core/CellComponent/__storybook__/docs/content.html"
|
|
51
|
+
},
|
|
52
|
+
"CellHeader": {
|
|
53
|
+
"file": "CellHeader.md",
|
|
54
|
+
"package": "@czi-sds/components",
|
|
55
|
+
"source": "packages/components/src/core/CellHeader/__storybook__/docs/content.html"
|
|
56
|
+
},
|
|
57
|
+
"ComplexFilter": {
|
|
58
|
+
"file": "ComplexFilter.md",
|
|
59
|
+
"package": "@czi-sds/components",
|
|
60
|
+
"source": "packages/components/src/core/ComplexFilter/__storybook__/docs/content.html"
|
|
61
|
+
},
|
|
62
|
+
"ContentCard": {
|
|
63
|
+
"file": "ContentCard.md",
|
|
64
|
+
"package": "@czi-sds/components",
|
|
65
|
+
"source": "packages/components/src/core/ContentCard/__storybook__/docs/content.html"
|
|
66
|
+
},
|
|
67
|
+
"Dialog": {
|
|
68
|
+
"file": "Dialog.md",
|
|
69
|
+
"package": "@czi-sds/components",
|
|
70
|
+
"source": "packages/components/src/core/Dialog/__storybook__/docs/content.html"
|
|
71
|
+
},
|
|
72
|
+
"Dropdown": {
|
|
73
|
+
"file": "Dropdown.md",
|
|
74
|
+
"package": "@czi-sds/components",
|
|
75
|
+
"source": "packages/components/src/core/Dropdown/__storybook__/docs/content.html"
|
|
76
|
+
},
|
|
77
|
+
"DropdownMenu": {
|
|
78
|
+
"file": "DropdownMenu.md",
|
|
79
|
+
"package": "@czi-sds/components",
|
|
80
|
+
"source": "packages/components/src/core/DropdownMenu/__storybook__/docs/content.html"
|
|
81
|
+
},
|
|
82
|
+
"HeatmapChart": {
|
|
83
|
+
"file": "HeatmapChart.md",
|
|
84
|
+
"package": "@czi-sds/data-viz",
|
|
85
|
+
"source": "packages/data-viz/src/core/HeatmapChart/__storybook__/docs/content.html"
|
|
86
|
+
},
|
|
87
|
+
"Hero": {
|
|
88
|
+
"file": "Hero.md",
|
|
89
|
+
"package": "@czi-sds/components",
|
|
90
|
+
"source": "packages/components/src/core/Hero/__storybook__/docs/content.html"
|
|
91
|
+
},
|
|
92
|
+
"Icon": {
|
|
93
|
+
"file": "Icon.md",
|
|
94
|
+
"package": "@czi-sds/components",
|
|
95
|
+
"source": "packages/components/src/core/Icon/__storybook__/docs/content.html"
|
|
96
|
+
},
|
|
97
|
+
"InputCheckbox": {
|
|
98
|
+
"file": "InputCheckbox.md",
|
|
99
|
+
"package": "@czi-sds/components",
|
|
100
|
+
"source": "packages/components/src/core/InputCheckbox/__storybook__/docs/content.html"
|
|
101
|
+
},
|
|
102
|
+
"InputDropdown": {
|
|
103
|
+
"file": "InputDropdown.md",
|
|
104
|
+
"package": "@czi-sds/components",
|
|
105
|
+
"source": "packages/components/src/core/InputDropdown/__storybook__/docs/content.html"
|
|
106
|
+
},
|
|
107
|
+
"InputRadio": {
|
|
108
|
+
"file": "InputRadio.md",
|
|
109
|
+
"package": "@czi-sds/components",
|
|
110
|
+
"source": "packages/components/src/core/InputRadio/__storybook__/docs/content.html"
|
|
111
|
+
},
|
|
112
|
+
"InputSearch": {
|
|
113
|
+
"file": "InputSearch.md",
|
|
114
|
+
"package": "@czi-sds/components",
|
|
115
|
+
"source": "packages/components/src/core/InputSearch/__storybook__/docs/content.html"
|
|
116
|
+
},
|
|
117
|
+
"InputSlider": {
|
|
118
|
+
"file": "InputSlider.md",
|
|
119
|
+
"package": "@czi-sds/components",
|
|
120
|
+
"source": "packages/components/src/core/InputSlider/__storybook__/docs/content.html"
|
|
121
|
+
},
|
|
122
|
+
"InputText": {
|
|
123
|
+
"file": "InputText.md",
|
|
124
|
+
"package": "@czi-sds/components",
|
|
125
|
+
"source": "packages/components/src/core/InputText/__storybook__/docs/content.html"
|
|
126
|
+
},
|
|
127
|
+
"InputToggle": {
|
|
128
|
+
"file": "InputToggle.md",
|
|
129
|
+
"package": "@czi-sds/components",
|
|
130
|
+
"source": "packages/components/src/core/InputToggle/__storybook__/docs/content.html"
|
|
131
|
+
},
|
|
132
|
+
"IntentMessage": {
|
|
133
|
+
"file": "IntentMessage.md",
|
|
134
|
+
"package": "@czi-sds/components",
|
|
135
|
+
"source": "packages/components/src/core/IntentMessage/__storybook__/docs/content.html"
|
|
136
|
+
},
|
|
137
|
+
"Legend": {
|
|
138
|
+
"file": "Legend.md",
|
|
139
|
+
"package": "@czi-sds/components",
|
|
140
|
+
"source": "packages/components/src/core/Legend/__storybook__/docs/content.html"
|
|
141
|
+
},
|
|
142
|
+
"Link": {
|
|
143
|
+
"file": "Link.md",
|
|
144
|
+
"package": "@czi-sds/components",
|
|
145
|
+
"source": "packages/components/src/core/Link/__storybook__/docs/content.html"
|
|
146
|
+
},
|
|
147
|
+
"List": {
|
|
148
|
+
"file": "List.md",
|
|
149
|
+
"package": "@czi-sds/components",
|
|
150
|
+
"source": "packages/components/src/core/List/__storybook__/docs/content.html"
|
|
151
|
+
},
|
|
152
|
+
"LoadingIndicator": {
|
|
153
|
+
"file": "LoadingIndicator.md",
|
|
154
|
+
"package": "@czi-sds/components",
|
|
155
|
+
"source": "packages/components/src/core/LoadingIndicator/__storybook__/docs/content.html"
|
|
156
|
+
},
|
|
157
|
+
"Menu": {
|
|
158
|
+
"file": "Menu.md",
|
|
159
|
+
"package": "@czi-sds/components",
|
|
160
|
+
"source": "packages/components/src/core/Menu/__storybook__/docs/content.html"
|
|
161
|
+
},
|
|
162
|
+
"MenuItem": {
|
|
163
|
+
"file": "MenuItem.md",
|
|
164
|
+
"package": "@czi-sds/components",
|
|
165
|
+
"source": "packages/components/src/core/MenuItem/__storybook__/docs/content.html"
|
|
166
|
+
},
|
|
167
|
+
"NavigationFooter": {
|
|
168
|
+
"file": "NavigationFooter.md",
|
|
169
|
+
"package": "@czi-sds/components",
|
|
170
|
+
"source": "packages/components/src/core/NavigationFooter/__storybook__/docs/content.html"
|
|
171
|
+
},
|
|
172
|
+
"NavigationHeader": {
|
|
173
|
+
"file": "NavigationHeader.md",
|
|
174
|
+
"package": "@czi-sds/components",
|
|
175
|
+
"source": "packages/components/src/core/NavigationHeader/__storybook__/docs/content.html"
|
|
176
|
+
},
|
|
177
|
+
"NavigationJumpTo": {
|
|
178
|
+
"file": "NavigationJumpTo.md",
|
|
179
|
+
"package": "@czi-sds/components",
|
|
180
|
+
"source": "packages/components/src/core/NavigationJumpTo/__storybook__/docs/content.html"
|
|
181
|
+
},
|
|
182
|
+
"Notification": {
|
|
183
|
+
"file": "Notification.md",
|
|
184
|
+
"package": "@czi-sds/components",
|
|
185
|
+
"source": "packages/components/src/core/Notification/__storybook__/docs/content.html"
|
|
186
|
+
},
|
|
187
|
+
"Pagination": {
|
|
188
|
+
"file": "Pagination.md",
|
|
189
|
+
"package": "@czi-sds/components",
|
|
190
|
+
"source": "packages/components/src/core/Pagination/__storybook__/docs/content.html"
|
|
191
|
+
},
|
|
192
|
+
"Panel": {
|
|
193
|
+
"file": "Panel.md",
|
|
194
|
+
"package": "@czi-sds/components",
|
|
195
|
+
"source": "packages/components/src/core/Panel/__storybook__/docs/content.html"
|
|
196
|
+
},
|
|
197
|
+
"Popover": {
|
|
198
|
+
"file": "Popover.md",
|
|
199
|
+
"package": "@czi-sds/components",
|
|
200
|
+
"source": "packages/components/src/core/Popover/__storybook__/docs/content.html"
|
|
201
|
+
},
|
|
202
|
+
"PreComposedTable": {
|
|
203
|
+
"file": "PreComposedTable.md",
|
|
204
|
+
"package": "@czi-sds/components",
|
|
205
|
+
"source": "packages/components/src/core/PreComposedTable/__storybook__/docs/content.html"
|
|
206
|
+
},
|
|
207
|
+
"SegmentedControl": {
|
|
208
|
+
"file": "SegmentedControl.md",
|
|
209
|
+
"package": "@czi-sds/components",
|
|
210
|
+
"source": "packages/components/src/core/SegmentedControl/__storybook__/docs/content.html"
|
|
211
|
+
},
|
|
212
|
+
"StackedBarChart": {
|
|
213
|
+
"file": "StackedBarChart.md",
|
|
214
|
+
"package": "@czi-sds/data-viz",
|
|
215
|
+
"source": "packages/data-viz/src/core/StackedBarChart/__storybook__/docs/content.html"
|
|
216
|
+
},
|
|
217
|
+
"Table": {
|
|
218
|
+
"file": "Table.md",
|
|
219
|
+
"package": "@czi-sds/components",
|
|
220
|
+
"source": "packages/components/src/core/Table/__storybook__/docs/content.html"
|
|
221
|
+
},
|
|
222
|
+
"TableHeader": {
|
|
223
|
+
"file": "TableHeader.md",
|
|
224
|
+
"package": "@czi-sds/components",
|
|
225
|
+
"source": "packages/components/src/core/TableHeader/__storybook__/docs/content.html"
|
|
226
|
+
},
|
|
227
|
+
"TableRow": {
|
|
228
|
+
"file": "TableRow.md",
|
|
229
|
+
"package": "@czi-sds/components",
|
|
230
|
+
"source": "packages/components/src/core/TableRow/__storybook__/docs/content.html"
|
|
231
|
+
},
|
|
232
|
+
"Tabs": {
|
|
233
|
+
"file": "Tabs.md",
|
|
234
|
+
"package": "@czi-sds/components",
|
|
235
|
+
"source": "packages/components/src/core/Tabs/__storybook__/docs/content.html"
|
|
236
|
+
},
|
|
237
|
+
"Tag": {
|
|
238
|
+
"file": "Tag.md",
|
|
239
|
+
"package": "@czi-sds/components",
|
|
240
|
+
"source": "packages/components/src/core/Tag/__storybook__/docs/content.html"
|
|
241
|
+
},
|
|
242
|
+
"TagFilter": {
|
|
243
|
+
"file": "TagFilter.md",
|
|
244
|
+
"package": "@czi-sds/components",
|
|
245
|
+
"source": "packages/components/src/core/TagFilter/__storybook__/docs/content.html"
|
|
246
|
+
},
|
|
247
|
+
"Tooltip": {
|
|
248
|
+
"file": "Tooltip.md",
|
|
249
|
+
"package": "@czi-sds/components",
|
|
250
|
+
"source": "packages/components/src/core/Tooltip/__storybook__/docs/content.html"
|
|
251
|
+
},
|
|
252
|
+
"TooltipCondensed": {
|
|
253
|
+
"file": "TooltipCondensed.md",
|
|
254
|
+
"package": "@czi-sds/components",
|
|
255
|
+
"source": "packages/components/src/core/TooltipCondensed/__storybook__/docs/content.html"
|
|
256
|
+
},
|
|
257
|
+
"TooltipTable": {
|
|
258
|
+
"file": "TooltipTable.md",
|
|
259
|
+
"package": "@czi-sds/components",
|
|
260
|
+
"source": "packages/components/src/core/TooltipTable/__storybook__/docs/content.html"
|
|
261
|
+
}
|
|
262
|
+
}
|
package/data/component-list.json
CHANGED
|
@@ -2,29 +2,49 @@
|
|
|
2
2
|
"Accordion": {
|
|
3
3
|
"props": {
|
|
4
4
|
"defaultExpanded": {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"defaultValue": false,
|
|
6
|
+
"description": "If `true`, expands the accordion by default.",
|
|
7
|
+
"isRequired": false,
|
|
8
|
+
"type": "boolean"
|
|
7
9
|
},
|
|
8
10
|
"id": {
|
|
9
|
-
"
|
|
10
|
-
"isRequired":
|
|
11
|
+
"description": "Required. A unique id for each accordion item, also used to derive the ids that link the header and its content for screen readers.",
|
|
12
|
+
"isRequired": true,
|
|
13
|
+
"type": "string"
|
|
11
14
|
},
|
|
12
15
|
"togglePosition": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
16
|
+
"defaultValue": "right",
|
|
17
|
+
"description": "Position of the toggle chevron icon.",
|
|
18
|
+
"isRequired": false,
|
|
19
|
+
"type": "\"left\" | \"right\""
|
|
15
20
|
},
|
|
16
21
|
"useDivider": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
22
|
+
"defaultValue": false,
|
|
23
|
+
"description": "Display a divider line between accordion items.",
|
|
24
|
+
"isRequired": false,
|
|
25
|
+
"type": "boolean"
|
|
26
|
+
},
|
|
27
|
+
"disabled": {
|
|
28
|
+
"defaultValue": false,
|
|
29
|
+
"description": "If `true`, the component is disabled.",
|
|
30
|
+
"isRequired": false,
|
|
31
|
+
"type": "boolean"
|
|
32
|
+
},
|
|
33
|
+
"chevronSize": {
|
|
34
|
+
"defaultValue": "xs",
|
|
35
|
+
"description": "Set on AccordionHeader. Size of the toggle chevron icon.",
|
|
36
|
+
"isRequired": false,
|
|
37
|
+
"type": "\"s\" | \"xs\" | \"l\" | \"xl\""
|
|
19
38
|
}
|
|
20
39
|
}
|
|
21
40
|
},
|
|
22
41
|
"AccordionHeader": {
|
|
23
42
|
"props": {
|
|
24
43
|
"subtitle": {
|
|
25
|
-
"
|
|
26
|
-
"isRequired": false
|
|
44
|
+
"description": "Set on AccordionHeader. A text that will be displayed as a subtitle beneath the accordion title.",
|
|
45
|
+
"isRequired": false,
|
|
46
|
+
"type": "string"
|
|
27
47
|
}
|
|
28
48
|
}
|
|
29
49
|
}
|
|
30
|
-
}
|
|
50
|
+
}
|