@czi-sds/mcp 0.2.2 → 0.3.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/data/zeroheight-cache.json +5195 -0
- package/data/zeroheight-exports/Accordion.md +675 -0
- package/data/zeroheight-exports/Banner.md +576 -0
- package/data/zeroheight-exports/Borders.md +118 -0
- package/data/zeroheight-exports/Buttons.md +2260 -0
- package/data/zeroheight-exports/Callout.md +756 -0
- package/data/zeroheight-exports/Colors.md +633 -0
- package/data/zeroheight-exports/Content-Card.md +162 -0
- package/data/zeroheight-exports/Contributing-to-SDS.md +99 -0
- package/data/zeroheight-exports/Control-Inputs.md +2066 -0
- package/data/zeroheight-exports/Corners.md +112 -0
- package/data/zeroheight-exports/Cover-page.md +4 -0
- package/data/zeroheight-exports/Dialog.md +1133 -0
- package/data/zeroheight-exports/Downloads.md +121 -0
- package/data/zeroheight-exports/Drop-Shadows.md +80 -0
- package/data/zeroheight-exports/Dropdown-Input.md +1149 -0
- package/data/zeroheight-exports/Dropdown-Menu.md +3787 -0
- package/data/zeroheight-exports/Element-Status-Tracker.md +268 -0
- package/data/zeroheight-exports/Field-Inputs.md +965 -0
- package/data/zeroheight-exports/Filters.md +868 -0
- package/data/zeroheight-exports/Getting-Started.md +1296 -0
- package/data/zeroheight-exports/Hero.md +256 -0
- package/data/zeroheight-exports/Icons.md +432 -0
- package/data/zeroheight-exports/Intent.md +47 -0
- package/data/zeroheight-exports/Introduction-to-Bases.md +36 -0
- package/data/zeroheight-exports/Introduction-to-Cells.md +36 -0
- package/data/zeroheight-exports/Introduction-to-DNA.md +36 -0
- package/data/zeroheight-exports/Introduction-to-Genes.md +36 -0
- package/data/zeroheight-exports/Introduction.md +116 -0
- package/data/zeroheight-exports/Link.md +373 -0
- package/data/zeroheight-exports/Lists.md +617 -0
- package/data/zeroheight-exports/Loading-Indicator.md +38 -0
- package/data/zeroheight-exports/Navigation.md +853 -0
- package/data/zeroheight-exports/Notification.md +858 -0
- package/data/zeroheight-exports/Panel.md +862 -0
- package/data/zeroheight-exports/README.md +124 -0
- package/data/zeroheight-exports/Responsive-Design.md +275 -0
- package/data/zeroheight-exports/Search-Input.md +54 -0
- package/data/zeroheight-exports/Search.md +609 -0
- package/data/zeroheight-exports/Segmented-Control.md +561 -0
- package/data/zeroheight-exports/Spacing.md +298 -0
- package/data/zeroheight-exports/Table.md +4832 -0
- package/data/zeroheight-exports/Tabs.md +773 -0
- package/data/zeroheight-exports/Tags.md +1025 -0
- package/data/zeroheight-exports/Text-Link.md +185 -0
- package/data/zeroheight-exports/Theming.md +313 -0
- package/data/zeroheight-exports/Tooltips.md +1564 -0
- package/data/zeroheight-exports/Typography.md +769 -0
- package/dist/stdio.js +188 -0
- package/package.json +4 -3
|
@@ -0,0 +1,1296 @@
|
|
|
1
|
+
# Getting Started
|
|
2
|
+
|
|
3
|
+
Let the following guides serve as starting points for working with the SDS. Understand how to use the design system libraries within Figma, navigate the documentation, contribute new components to the design system, access the SDS codebase, and incorporate coded components into application builds.
|
|
4
|
+
|
|
5
|
+
## For Designers
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
| The Science Design System (SDS) brings consistency and universal standards to CZI's science products. Within Figma, the elements of the SDS are accessible to product designers via a collection of published libraries. These libraries have been built to allow for maximum flexibility depending on each product team's component needs. The SDS Documentation serves as an in-depth guide for both designers and engineers for using elements of the design system within projects. In instances where the available SDS components don't fulfill a product team's needs, there is a straightforward process for requesting additional elements for the design system. | | **Jump to section:** Figma SDS Documentation Contributing to the SDS |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
### Figma
|
|
15
|
+
|
|
16
|
+
#### **Library structure**
|
|
17
|
+
|
|
18
|
+
Instead of consolidating all elements into the same Figma library, the SDS team has broken out each element type into separate libraries—SDS Bases, SDS Typography, SDS Icons, and SDS Components. Each of these libraries can be turned on or off depending on the needs of the individual product team. This ensures product designers' project files aren't cluttered with unnecessary elements and they only see the pieces of the SDS that are relevant to them.
|
|
19
|
+
|
|
20
|
+
> For example, CZ ID and CZ GEN EPI use the same fonts in both of their products, whereas Single Cell and napari use their own unique typography and therefore have no need for the SDS Typography library to be enabled in their project files. All four products use the same icon set, meaning all four will have the SDS Icons library enabled in their project files.
|
|
21
|
+
|
|
22
|
+
The SDS Components library is not intended to be used by itself, but instead feeds into component sub-libraries for each product. This ensures each component is built consistently and has the same functionality and props, while allowing for visual customization of every component to align with each product's look and feel. Each product sub-library contains any product-specific colors (generally Primary and Info colors) and typography.
|
|
23
|
+
|
|
24
|
+
> For example, designers on CZ ID and CZ GEN EPI will both be using the same Button component and all of its variant options, while CZ ID's primary Button will be blue and pulled from the CZ ID Components library and CZ GEN EPI's will be purple and pulled from the CZ GEN EPI Components library.
|
|
25
|
+
|
|
26
|
+
#### **Project file set up**
|
|
27
|
+
|
|
28
|
+
When working on a project, ensure the necessary SDS libraries for your product are enabled. Figma's team settings for napari hub + .org have been adjusted to ensure any new project started in the team folder will have the necessary libraries enabled by default.
|
|
29
|
+
|
|
30
|
+
For reference, below are the libraries that should be enabled for napari hub + .org projects:
|
|
31
|
+
|
|
32
|
+
* SDS Icons
|
|
33
|
+
* napari hub + .org Design System
|
|
34
|
+
|
|
35
|
+
For more details around using and working with libraries in Figma, see this helpful guide from the Figma team.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### SDS Documentation
|
|
40
|
+
|
|
41
|
+
The SDS documentation should be the go-to place to learn about using elements of the design system within projects. It is not intended to be used only by designers, but by anyone on a product team looking to better familiarize themselves with all of the pieces of the design system and how it can be best leveraged in product work.
|
|
42
|
+
|
|
43
|
+
Below are a few tips around navigating the documentation:
|
|
44
|
+
|
|
45
|
+
* Visit the Element Status Tracker page for the most up-to-date view of which elements are available for use within the Figma libraries and the SDS codebase; a more detailed status spreadsheet is linked at the bottom of this page for an in-depth look at status by component variant as well as links to implementation tickets for a granular view of when to expect components to be available for use
|
|
46
|
+
* Most components have a Live Preview section on their Overview tabs; this displays an interactive instance of the element, providing the ability to engage with it and get a better feel for how it will work when included as part of a product build
|
|
47
|
+
* Each variant of every component is viewable on their Overview tabs; aside from displaying all of the available props for each variant, these views are able to be clicked on and inspected to get further design details such as typography and color styles, border radiuses, spacing, etc.
|
|
48
|
+
* On every component page there is a Code tab containing individual iframes imported from Storybook of each variant available to that component; each iframe has all of the same functionality found within Storybook, allowing engineers to explore props, adjust colors and text, see any event handlers, etc. all without leaving the documentation site
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
### Contributing to the SDS
|
|
53
|
+
|
|
54
|
+
If a product need arises for a component that doesn't exist in the SDS, a request can be made to the SDS team to design and add it into the system. To do so, follow the steps below:
|
|
55
|
+
|
|
56
|
+
1. Take a second look through the SDS Documentation to double check the product need can indeed not be satisfied by an existing SDS component
|
|
57
|
+
2. Post the component request to the #sci-design-system-support.) channel in Slack using the following request template to ensure all of the necessary details are captured for the SDS team:
|
|
58
|
+
|
|
59
|
+
Once a request is submitted, the SDS team will conduct an evaluation across all Science products to determine whether the new component would be beneficial to multiple products and should become part of the SDS. If it is determined that the requested component be added into the SDS, the SDS team will work with the requesting team to build, review, test, and incorporate the new component into the system.
|
|
60
|
+
|
|
61
|
+
If it is determined that the new component should not become part of the SDS, it will become the requesting product team's responsibility to design and maintain the component on their own.
|
|
62
|
+
|
|
63
|
+
See a more detailed flow of the component request process here.
|
|
64
|
+
|
|
65
|
+
## For Engineers
|
|
66
|
+
|
|
67
|
+
## Overview
|
|
68
|
+
|
|
69
|
+
| The Science Design System (SDS) brings consistency and universal standards to CZI’s science products by offering a library of high quality, reusable components that deliver predictable, accessible and easy to learn experiences. Our goal is to democratize access to tools and technologies for scientists. | | **Jump to section:** Getting Started Usage Contributing to the SDS |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### Getting Started
|
|
75
|
+
|
|
76
|
+
#### **Installation**
|
|
77
|
+
|
|
78
|
+
NPM Package:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
// with npm
|
|
82
|
+
|
|
83
|
+
npm i czifui
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
// with yarn
|
|
88
|
+
|
|
89
|
+
yarn add czifui
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
SDS currently uses Material UI v5
|
|
95
|
+
|
|
96
|
+
czifui installs without direct dependencies to prevent version errors. Please ensure the following peer dependencies are also installed:
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
"@emotion/css"
|
|
100
|
+
|
|
101
|
+
"@emotion/react"
|
|
102
|
+
|
|
103
|
+
"@emotion/styled"
|
|
104
|
+
|
|
105
|
+
"@material-ui/core"
|
|
106
|
+
|
|
107
|
+
"@material-ui/icons"
|
|
108
|
+
|
|
109
|
+
"@material-ui/lab"
|
|
110
|
+
|
|
111
|
+
"react"
|
|
112
|
+
|
|
113
|
+
"react-dom"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
To install the dependencies:
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
// with npm
|
|
120
|
+
|
|
121
|
+
npm i @emotion/css @emotion/react @emotion/styled @material-ui/core @material-ui/icons @material-ui/lab react react-dom
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
// with yarn
|
|
126
|
+
|
|
127
|
+
yarn add @emotion/css @emotion/react @emotion/styled @material-ui/core @material-ui/icons @material-ui/lab react react-dom
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### Usage
|
|
133
|
+
|
|
134
|
+
`czifui` comes with four main exports that help you build your app:
|
|
135
|
+
|
|
136
|
+
1. **Components** - Accessible and reusable components
|
|
137
|
+
|
|
138
|
+
```js
|
|
139
|
+
import React from "react";
|
|
140
|
+
|
|
141
|
+
import { Button } from "czifui";
|
|
142
|
+
|
|
143
|
+
<Button onClick={actions.onClick} sdsStyle="rounded" sdsType="primary">
|
|
144
|
+
|
|
145
|
+
{text}
|
|
146
|
+
|
|
147
|
+
</Button>;
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
2. **Mixins** - Grouped styles defined by the design system
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
import styled from "@emotion/styled";
|
|
154
|
+
|
|
155
|
+
import { Typography } from "@material-ui/core";
|
|
156
|
+
|
|
157
|
+
import { fontHeaderXL } from "czifui";
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
export const Title - styled(Typography)`
|
|
162
|
+
|
|
163
|
+
${fontHeaderXl}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
// which compiles to:
|
|
168
|
+
|
|
169
|
+
font-size: 22px;
|
|
170
|
+
|
|
171
|
+
font-weight: 600;
|
|
172
|
+
|
|
173
|
+
letter-spacing: 0.3px;
|
|
174
|
+
|
|
175
|
+
line-height: 30px;
|
|
176
|
+
|
|
177
|
+
`;
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
3. **Selectors** - Helper functions that return theme variables based on passed props
|
|
181
|
+
|
|
182
|
+
```js
|
|
183
|
+
import { css, SerializedStyles } from "@emotion/react";
|
|
184
|
+
|
|
185
|
+
import styled from "@emotion/styled";
|
|
186
|
+
|
|
187
|
+
import { getColors, getCorners } from "czifui";
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
export const Tag = styled.div`
|
|
192
|
+
|
|
193
|
+
// This is a callback function that returns more CSS rules, but the only way
|
|
194
|
+
|
|
195
|
+
// to access the custom theme object
|
|
196
|
+
|
|
197
|
+
${(props) => {
|
|
198
|
+
|
|
199
|
+
// getColors() is a selector that picks out colors from the theme object
|
|
200
|
+
|
|
201
|
+
const colors = getColors(props);
|
|
202
|
+
|
|
203
|
+
// getSpaces() is a selector that picks out spacings from the theme object
|
|
204
|
+
|
|
205
|
+
const spacings = getSpaces(props);
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
return `
|
|
210
|
+
|
|
211
|
+
background-color: ${colors?.gray[500]};
|
|
212
|
+
|
|
213
|
+
padding-bottom: ${spacings?.m}px;
|
|
214
|
+
|
|
215
|
+
margin-bottom: ${spacings?.xxl}px;
|
|
216
|
+
|
|
217
|
+
`;
|
|
218
|
+
|
|
219
|
+
}}
|
|
220
|
+
|
|
221
|
+
`;
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
4. **CSS & SCSS Variables** - Variables for the `defaultTheme` to use if your app doesn't support `@emotion/styled`
|
|
225
|
+
|
|
226
|
+
```css
|
|
227
|
+
// with SCSS variables
|
|
228
|
+
|
|
229
|
+
@import "~czifui/dist/variables";
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
.button-primary {
|
|
234
|
+
|
|
235
|
+
background-color: $sds-color-primary-400;
|
|
236
|
+
|
|
237
|
+
padding: $sds-spaces-xxs;
|
|
238
|
+
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
// with CSS variables
|
|
244
|
+
|
|
245
|
+
.button-primary {
|
|
246
|
+
|
|
247
|
+
background-color: var(--sds-color-primary-400);
|
|
248
|
+
|
|
249
|
+
padding: var(--sds-spaces-xxs);
|
|
250
|
+
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
#### **Default Theme**
|
|
255
|
+
|
|
256
|
+
To use the default theme in your React application, complete the following:
|
|
257
|
+
|
|
258
|
+
1. Add the following HTML to your `index.html` at the `<head>`section:
|
|
259
|
+
|
|
260
|
+
```html
|
|
261
|
+
// installs the sds font from google fonts
|
|
262
|
+
|
|
263
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
|
264
|
+
|
|
265
|
+
<link
|
|
266
|
+
|
|
267
|
+
href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,400;1,600;1,700&display=swap"
|
|
268
|
+
|
|
269
|
+
rel="stylesheet"
|
|
270
|
+
|
|
271
|
+
/>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
2. Import the default theme object and use it in Material UI's `<ThemeProvider />`:
|
|
275
|
+
|
|
276
|
+
```js
|
|
277
|
+
import { defaultTheme } from "czifui";
|
|
278
|
+
|
|
279
|
+
import { StylesProvider, ThemeProvider } from "@material-ui/core/styles";
|
|
280
|
+
|
|
281
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
<StylesProvider injectFirst>
|
|
286
|
+
|
|
287
|
+
<EmotionThemeProvider theme={defaultTheme}>
|
|
288
|
+
|
|
289
|
+
<ThemeProvider theme={defaultTheme}>
|
|
290
|
+
|
|
291
|
+
<YourApp />
|
|
292
|
+
|
|
293
|
+
</ThemeProvider>
|
|
294
|
+
|
|
295
|
+
</EmotionThemeProvider>
|
|
296
|
+
|
|
297
|
+
</StylesProvider>;
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
3. If you need to override the default SDS theme, please follow the instructions here.
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
### Contributing to the SDS
|
|
305
|
+
|
|
306
|
+
If you would like to contribute to the Science Design System by building requested components, please follow the contribution guidelines here.
|
|
307
|
+
|
|
308
|
+
If a product need arises for a component that doesn't exist in the SDS, a request can be made to the SDS team to design and add it into the system. To do so, follow the steps below:d
|
|
309
|
+
|
|
310
|
+
1. Take a second look through the SDS Documentation to double check the product need can indeed not be satisfied by an existing SDS component
|
|
311
|
+
2. Post the component request to the #sci-design-system-support.) channel in Slack using the following request template to ensure all of the necessary details are captured for the SDS team:
|
|
312
|
+
|
|
313
|
+
Once a request is submitted, the SDS team will conduct an evaluation across all Science products to determine whether the new component would be beneficial to multiple products and should become part of the SDS. If it is determined that the requested component be added into the SDS, the SDS team will work with the requesting team to build, review, test, and incorporate the new component into the system.
|
|
314
|
+
|
|
315
|
+
If it is determined that the new component should not become part of the SDS, it will become the requesting product team's responsibility to design and maintain the component on their own.
|
|
316
|
+
|
|
317
|
+
See a more detailed flow of the component request process here.
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
Let the following guides serve as starting points for working with the SDS. Understand how to use the design system libraries within Figma, navigate the documentation, contribute new components to the design system, access the SDS codebase, and incorporate coded components into application builds.
|
|
322
|
+
|
|
323
|
+
## For Designers
|
|
324
|
+
|
|
325
|
+
## Overview
|
|
326
|
+
|
|
327
|
+
| The Science Design System (SDS) brings consistency and universal standards to CZI's science products. Within Figma, the elements of the SDS are accessible to product designers via a collection of published libraries. These libraries have been built to allow for maximum flexibility depending on each product team's component needs. The SDS Documentation serves as an in-depth guide for both designers and engineers for using elements of the design system within projects. In instances where the available SDS components don't fulfill a product team's needs, there is a straightforward process for requesting additional elements for the design system. | | **Jump to section:** Figma SDS Documentation Contributing to the SDS |
|
|
328
|
+
| --- | --- | --- |
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
### Figma
|
|
333
|
+
|
|
334
|
+
#### **Library structure**
|
|
335
|
+
|
|
336
|
+
Instead of consolidating all elements into the same Figma library, the SDS team has broken out each element type into separate libraries—SDS Bases, SDS Typography, SDS Icons, and SDS Components. Each of these libraries can be turned on or off depending on the needs of the individual product team. This ensures product designers' project files aren't cluttered with unnecessary elements and they only see the pieces of the SDS that are relevant to them.
|
|
337
|
+
|
|
338
|
+
> For example, CZ ID and CZ GEN EPI use the same fonts in both of their products, whereas Single Cell and Napari use their own unique typography and therefore have no need for the SDS Typography library to be enabled in their project files. All four products use the same icon set, meaning all four will have the SDS Icons library enabled in their project files.
|
|
339
|
+
|
|
340
|
+
The SDS Components library is not intended to be used by itself, but instead feeds into component sub-libraries for each product. This ensures each component is built consistently and has the same functionality and props, while allowing for visual customization of every component to align with each product's look and feel. Each product sub-library contains any product-specific colors (generally Primary and Info colors) and typography.
|
|
341
|
+
|
|
342
|
+
> For example, designers on CZ ID and CZ GEN EPI will both be using the same Button component and all of its variant options, while CZ ID's primary Button will be blue and pulled from the CZ ID Components library and CZ GEN EPI's will be purple and pulled from the CZ GEN EPI Components library.
|
|
343
|
+
|
|
344
|
+
#### **Project file set up**
|
|
345
|
+
|
|
346
|
+
When working on a project, ensure the necessary SDS libraries for your product are enabled. Figma's team settings for CZ GEN EPI have been adjusted to ensure any new project started in the team folder will have the necessary libraries enabled by default.
|
|
347
|
+
|
|
348
|
+
For reference, below are the libraries that should be enabled for CZ GEN EPI projects:
|
|
349
|
+
|
|
350
|
+
* SDS Bases
|
|
351
|
+
* SDS Typography
|
|
352
|
+
* SDS Icons
|
|
353
|
+
* CZ GEN EPI Design System
|
|
354
|
+
|
|
355
|
+
For more details around using and working with libraries in Figma, see this helpful guide from the Figma team.
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
### SDS Documentation
|
|
360
|
+
|
|
361
|
+
The SDS documentation should be the go-to place to learn about using elements of the design system within projects. It is not intended to be used only by designers, but by anyone on a product team looking to better familiarize themselves with all of the pieces of the design system and how it can be best leveraged in product work.
|
|
362
|
+
|
|
363
|
+
Below are a few tips around navigating the documentation:
|
|
364
|
+
|
|
365
|
+
* Visit the Element Status Tracker page for the most up-to-date view of which elements are available for use within the Figma libraries and the SDS codebase; a more detailed status spreadsheet is linked at the bottom of this page for an in-depth look at status by component variant as well as links to implementation tickets for a granular view of when to expect components to be available for use
|
|
366
|
+
* Most components have a Live Preview section on their Overview tabs; this displays an interactive instance of the element, providing the ability to engage with it and get a better feel for how it will work when included as part of a product build
|
|
367
|
+
* Each variant of every component is viewable on their Overview tabs; aside from displaying all of the available props for each variant, these views are able to be clicked on and inspected to get further design details such as typography and color styles, border radiuses, spacing, etc.
|
|
368
|
+
* On every component page there is a Code tab containing individual iframes imported from Storybook of each variant available to that component; each iframe has all of the same functionality found within Storybook, allowing engineers to explore props, adjust colors and text, see any event handlers, etc. all without leaving the documentation site
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
### Contributing to the SDS
|
|
373
|
+
|
|
374
|
+
If a product need arises for a component that doesn't exist in the SDS, a request can be made to the SDS team to design and add it into the system. To do so, follow the steps below:
|
|
375
|
+
|
|
376
|
+
1. Take a second look through the SDS Documentation to double check the product need can indeed not be satisfied by an existing SDS component
|
|
377
|
+
2. Post the component request to the #sci-design-system-support.) channel in Slack using the following request template to ensure all of the necessary details are captured for the SDS team:
|
|
378
|
+
|
|
379
|
+
Once a request is submitted, the SDS team will conduct an evaluation across all Science products to determine whether the new component would be beneficial to multiple products and should become part of the SDS. If it is determined that the requested component be added into the SDS, the SDS team will work with the requesting team to build, review, test, and incorporate the new component into the system.
|
|
380
|
+
|
|
381
|
+
If it is determined that the new component should not become part of the SDS, it will become the requesting product team's responsibility to design and maintain the component on their own.
|
|
382
|
+
|
|
383
|
+
See a more detailed flow of the component request process here.
|
|
384
|
+
|
|
385
|
+
## For Engineers
|
|
386
|
+
|
|
387
|
+
## Overview
|
|
388
|
+
|
|
389
|
+
| The Science Design System (SDS) brings consistency and universal standards to CZI’s science products by offering a library of high quality, reusable components that deliver predictable, accessible and easy to learn experiences. Our goal is to democratize access to tools and technologies for scientists. | | **Jump to section:** Getting Started Usage Contributing to the SDS |
|
|
390
|
+
| --- | --- | --- |
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
### Getting Started
|
|
395
|
+
|
|
396
|
+
#### **Installation**
|
|
397
|
+
|
|
398
|
+
NPM Package:
|
|
399
|
+
|
|
400
|
+
```sh
|
|
401
|
+
// with npm
|
|
402
|
+
|
|
403
|
+
npm i czifui
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
// with yarn
|
|
408
|
+
|
|
409
|
+
yarn add czifui
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
SDS currently uses Material UI v5
|
|
413
|
+
|
|
414
|
+
czifui installs without direct dependencies to prevent version errors. Please ensure the following peer dependencies are also installed:
|
|
415
|
+
|
|
416
|
+
```html
|
|
417
|
+
"@emotion/css"
|
|
418
|
+
|
|
419
|
+
"@emotion/react"
|
|
420
|
+
|
|
421
|
+
"@emotion/styled"
|
|
422
|
+
|
|
423
|
+
"@material-ui/core"
|
|
424
|
+
|
|
425
|
+
"@material-ui/icons"
|
|
426
|
+
|
|
427
|
+
"@material-ui/lab"
|
|
428
|
+
|
|
429
|
+
"react"
|
|
430
|
+
|
|
431
|
+
"react-dom"
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
To install the dependencies:
|
|
435
|
+
|
|
436
|
+
```sh
|
|
437
|
+
// with npm
|
|
438
|
+
|
|
439
|
+
npm i @emotion/css @emotion/react @emotion/styled @material-ui/core @material-ui/icons @material-ui/lab react react-dom
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
// with yarn
|
|
444
|
+
|
|
445
|
+
yarn add @emotion/css @emotion/react @emotion/styled @material-ui/core @material-ui/icons @material-ui/lab react react-dom
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
### Usage
|
|
451
|
+
|
|
452
|
+
`czifui` comes with four main exports that help you build your app:
|
|
453
|
+
|
|
454
|
+
1. **Components** - Accessible and reusable components
|
|
455
|
+
|
|
456
|
+
```js
|
|
457
|
+
import React from "react";
|
|
458
|
+
|
|
459
|
+
import { Button } from "czifui";
|
|
460
|
+
|
|
461
|
+
<Button onClick={actions.onClick} sdsStyle="rounded" sdsType="primary">
|
|
462
|
+
|
|
463
|
+
{text}
|
|
464
|
+
|
|
465
|
+
</Button>;
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
2. **Mixins** - Grouped styles defined by the design system
|
|
469
|
+
|
|
470
|
+
```js
|
|
471
|
+
import styled from "@emotion/styled";
|
|
472
|
+
|
|
473
|
+
import { Typography } from "@material-ui/core";
|
|
474
|
+
|
|
475
|
+
import { fontHeaderXL } from "czifui";
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
export const Title - styled(Typography)`
|
|
480
|
+
|
|
481
|
+
${fontHeaderXl}
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
// which compiles to:
|
|
486
|
+
|
|
487
|
+
font-size: 22px;
|
|
488
|
+
|
|
489
|
+
font-weight: 600;
|
|
490
|
+
|
|
491
|
+
letter-spacing: 0.3px;
|
|
492
|
+
|
|
493
|
+
line-height: 30px;
|
|
494
|
+
|
|
495
|
+
`;
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
3. **Selectors** - Helper functions that return theme variables based on passed props
|
|
499
|
+
|
|
500
|
+
```js
|
|
501
|
+
import { css, SerializedStyles } from "@emotion/react";
|
|
502
|
+
|
|
503
|
+
import styled from "@emotion/styled";
|
|
504
|
+
|
|
505
|
+
import { getColors, getCorners } from "czifui";
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
export const Tag = styled.div`
|
|
510
|
+
|
|
511
|
+
// This is a callback function that returns more CSS rules, but the only way
|
|
512
|
+
|
|
513
|
+
// to access the custom theme object
|
|
514
|
+
|
|
515
|
+
${(props) => {
|
|
516
|
+
|
|
517
|
+
// getColors() is a selector that picks out colors from the theme object
|
|
518
|
+
|
|
519
|
+
const colors = getColors(props);
|
|
520
|
+
|
|
521
|
+
// getSpaces() is a selector that picks out spacings from the theme object
|
|
522
|
+
|
|
523
|
+
const spacings = getSpaces(props);
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
return `
|
|
528
|
+
|
|
529
|
+
background-color: ${colors?.gray[500]};
|
|
530
|
+
|
|
531
|
+
padding-bottom: ${spacings?.m}px;
|
|
532
|
+
|
|
533
|
+
margin-bottom: ${spacings?.xxl}px;
|
|
534
|
+
|
|
535
|
+
`;
|
|
536
|
+
|
|
537
|
+
}}
|
|
538
|
+
|
|
539
|
+
`;
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
4. **CSS & SCSS Variables** - Variables for the `defaultTheme` to use if your app doesn't support `@emotion/styled`
|
|
545
|
+
|
|
546
|
+
```css
|
|
547
|
+
// with SCSS variables
|
|
548
|
+
|
|
549
|
+
@import "~czifui/dist/variables";
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
.button-primary {
|
|
554
|
+
|
|
555
|
+
background-color: $sds-color-primary-400;
|
|
556
|
+
|
|
557
|
+
padding: $sds-spaces-xxs;
|
|
558
|
+
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
// with CSS variables
|
|
564
|
+
|
|
565
|
+
.button-primary {
|
|
566
|
+
|
|
567
|
+
background-color: var(--sds-color-primary-400);
|
|
568
|
+
|
|
569
|
+
padding: var(--sds-spaces-xxs);
|
|
570
|
+
|
|
571
|
+
}
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
#### **Default Theme**
|
|
575
|
+
|
|
576
|
+
To use the default theme in your React application, complete the following:
|
|
577
|
+
|
|
578
|
+
1. Add the following HTML to your `index.html` at the `<head>`section:
|
|
579
|
+
|
|
580
|
+
```html
|
|
581
|
+
// installs the sds font from google fonts
|
|
582
|
+
|
|
583
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
|
584
|
+
|
|
585
|
+
<link
|
|
586
|
+
|
|
587
|
+
href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,400;1,600;1,700&display=swap"
|
|
588
|
+
|
|
589
|
+
rel="stylesheet"
|
|
590
|
+
|
|
591
|
+
/>
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
2. Import the default theme object and use it in Material UI's `<ThemeProvider />`:
|
|
595
|
+
|
|
596
|
+
```js
|
|
597
|
+
import { defaultTheme } from "czifui";
|
|
598
|
+
|
|
599
|
+
import { StylesProvider, ThemeProvider } from "@material-ui/core/styles";
|
|
600
|
+
|
|
601
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
<StylesProvider injectFirst>
|
|
606
|
+
|
|
607
|
+
<EmotionThemeProvider theme={defaultTheme}>
|
|
608
|
+
|
|
609
|
+
<ThemeProvider theme={defaultTheme}>
|
|
610
|
+
|
|
611
|
+
<YourApp />
|
|
612
|
+
|
|
613
|
+
</ThemeProvider>
|
|
614
|
+
|
|
615
|
+
</EmotionThemeProvider>
|
|
616
|
+
|
|
617
|
+
</StylesProvider>;
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
3. If you need to override the default SDS theme, please follow the instructions here.
|
|
623
|
+
|
|
624
|
+
---
|
|
625
|
+
|
|
626
|
+
### Contributing to the SDS
|
|
627
|
+
|
|
628
|
+
If you would like to contribute to the Science Design System by building requested components, please follow the contribution guidelines here.
|
|
629
|
+
|
|
630
|
+
If a product need arises for a component that doesn't exist in the SDS, a request can be made to the SDS team to design and add it into the system. To do so, follow the steps below:
|
|
631
|
+
|
|
632
|
+
1. Take a second look through the SDS Documentation to double check the product need can indeed not be satisfied by an existing SDS component
|
|
633
|
+
2. Post the component request to the #sci-design-system-support.) channel in Slack using the following request template to ensure all of the necessary details are captured for the SDS team:
|
|
634
|
+
|
|
635
|
+
Once a request is submitted, the SDS team will conduct an evaluation across all Science products to determine whether the new component would be beneficial to multiple products and should become part of the SDS. If it is determined that the requested component be added into the SDS, the SDS team will work with the requesting team to build, review, test, and incorporate the new component into the system.
|
|
636
|
+
|
|
637
|
+
If it is determined that the new component should not become part of the SDS, it will become the requesting product team's responsibility to design and maintain the component on their own.
|
|
638
|
+
|
|
639
|
+
See a more detailed flow of the component request process here.
|
|
640
|
+
|
|
641
|
+
---
|
|
642
|
+
|
|
643
|
+
Let the following guides serve as starting points for working with the SDS. Understand how to use the design system libraries within Figma, navigate the documentation, contribute new components to the design system, access the SDS codebase, and incorporate coded components into application builds.
|
|
644
|
+
|
|
645
|
+
## For Designers
|
|
646
|
+
|
|
647
|
+
## Overview
|
|
648
|
+
|
|
649
|
+
| The Science Design System (SDS) brings consistency and universal standards to CZI's science products. Within Figma, the elements of the SDS are accessible to product designers via a collection of published libraries. These libraries have been built to allow for maximum flexibility depending on each product team's component needs. The SDS Documentation serves as an in-depth guide for both designers and engineers for using elements of the design system within projects. In instances where the available SDS components don't fulfill a product team's needs, there is a straightforward process for requesting additional elements for the design system. | | **Jump to section:** Figma SDS Documentation Contributing to the SDS |
|
|
650
|
+
| --- | --- | --- |
|
|
651
|
+
|
|
652
|
+
---
|
|
653
|
+
|
|
654
|
+
### Figma
|
|
655
|
+
|
|
656
|
+
#### **Library structure**
|
|
657
|
+
|
|
658
|
+
Instead of consolidating all elements into the same Figma library, the SDS team has broken out each element type into separate libraries—SDS Bases, SDS Typography, SDS Icons, and SDS Components. Each of these libraries can be turned on or off depending on the needs of the individual product team. This ensures product designers' project files aren't cluttered with unnecessary elements and they only see the pieces of the SDS that are relevant to them.
|
|
659
|
+
|
|
660
|
+
> For example, CZ ID and CZ GEN EPI use the same fonts in both of their products, whereas Single Cell and Napari use their own unique typography and therefore have no need for the SDS Typography library to be enabled in their project files. All four products use the same icon set, meaning all four will have the SDS Icons library enabled in their project files.
|
|
661
|
+
|
|
662
|
+
The SDS Components library is not intended to be used by itself, but instead feeds into component sub-libraries for each product. This ensures each component is built consistently and has the same functionality and props, while allowing for visual customization of every component to align with each product's look and feel. Each product sub-library contains any product-specific colors (generally Primary and Info colors) and typography.
|
|
663
|
+
|
|
664
|
+
> For example, designers on CZ ID and CZ GEN EPI will both be using the same Button component and all of its variant options, while CZ ID's primary Button will be blue and pulled from the CZ ID Components library and CZ GEN EPI's will be purple and pulled from the CZ GEN EPI Components library.
|
|
665
|
+
|
|
666
|
+
#### **Project file set up**
|
|
667
|
+
|
|
668
|
+
When working on a project, ensure the necessary SDS libraries for your product are enabled. Figma's team settings for CZ ID have been adjusted to ensure any new project started in the team folder will have the necessary libraries enabled by default.
|
|
669
|
+
|
|
670
|
+
For reference, below are the libraries that should be enabled for CZ ID projects:
|
|
671
|
+
|
|
672
|
+
* SDS Bases
|
|
673
|
+
* SDS Typography
|
|
674
|
+
* SDS Icons
|
|
675
|
+
* CZ ID Design System
|
|
676
|
+
|
|
677
|
+
For more details around using and working with libraries in Figma, see this helpful guide from the Figma team.
|
|
678
|
+
|
|
679
|
+
---
|
|
680
|
+
|
|
681
|
+
### SDS Documentation
|
|
682
|
+
|
|
683
|
+
The SDS documentation should be the go-to place to learn about using elements of the design system within projects. It is not intended to be used only by designers, but by anyone on a product team looking to better familiarize themselves with all of the pieces of the design system and how it can be best leveraged in product work.
|
|
684
|
+
|
|
685
|
+
Below are a few tips around navigating the documentation:
|
|
686
|
+
|
|
687
|
+
* Visit the Element Status Tracker page for the most up-to-date view of which elements are available for use within the Figma libraries and the SDS codebase; a more detailed status spreadsheet is linked at the bottom of this page for an in-depth look at status by component variant as well as links to implementation tickets for a granular view of when to expect components to be available for use
|
|
688
|
+
* Most components have a Live Preview section on their Overview tabs; this displays an interactive instance of the element, providing the ability to engage with it and get a better feel for how it will work when included as part of a product build
|
|
689
|
+
* Each variant of every component is viewable on their Overview tabs; aside from displaying all of the available props for each variant, these views are able to be clicked on and inspected to get further design details such as typography and color styles, border radiuses, spacing, etc.
|
|
690
|
+
* On every component page there is a Code tab containing individual iframes imported from Storybook of each variant available to that component; each iframe has all of the same functionality found within Storybook, allowing engineers to explore props, adjust colors and text, see any event handlers, etc. all without leaving the documentation site
|
|
691
|
+
|
|
692
|
+
---
|
|
693
|
+
|
|
694
|
+
### Contributing to the SDS
|
|
695
|
+
|
|
696
|
+
If a product need arises for a component that doesn't exist in the SDS, a request can be made to the SDS team to design and add it into the system. To do so, follow the steps below:
|
|
697
|
+
|
|
698
|
+
1. Take a second look through the SDS Documentation to double check the product need can indeed not be satisfied by an existing SDS component
|
|
699
|
+
2. Post the component request to the #sci-design-system-support.) channel in Slack using the following request template to ensure all of the necessary details are captured for the SDS team:
|
|
700
|
+
|
|
701
|
+
Once a request is submitted, the SDS team will conduct an evaluation across all Science products to determine whether the new component would be beneficial to multiple products and should become part of the SDS. If it is determined that the requested component be added into the SDS, the SDS team will work with the requesting team to build, review, test, and incorporate the new component into the system.
|
|
702
|
+
|
|
703
|
+
If it is determined that the new component should not become part of the SDS, it will become the requesting product team's responsibility to design and maintain the component on their own.
|
|
704
|
+
|
|
705
|
+
See a more detailed flow of the component request process here.
|
|
706
|
+
|
|
707
|
+
## For Engineers
|
|
708
|
+
|
|
709
|
+
## Overview
|
|
710
|
+
|
|
711
|
+
| The Science Design System (SDS) brings consistency and universal standards to CZI’s science products by offering a library of high quality, reusable components that deliver predictable, accessible and easy to learn experiences. Our goal is to democratize access to tools and technologies for scientists. | | **Jump to section:** Getting Started Usage Contributing to the SDS |
|
|
712
|
+
| --- | --- | --- |
|
|
713
|
+
|
|
714
|
+
---
|
|
715
|
+
|
|
716
|
+
### Getting Started
|
|
717
|
+
|
|
718
|
+
#### **Installation**
|
|
719
|
+
|
|
720
|
+
NPM Package:
|
|
721
|
+
|
|
722
|
+
```sh
|
|
723
|
+
// with npm
|
|
724
|
+
|
|
725
|
+
npm i czifui
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
// with yarn
|
|
730
|
+
|
|
731
|
+
yarn add czifui
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
SDS currently uses Material UI v5
|
|
735
|
+
|
|
736
|
+
czifui installs without direct dependencies to prevent version errors. Please ensure the following peer dependencies are also installed:
|
|
737
|
+
|
|
738
|
+
```html
|
|
739
|
+
"@emotion/css"
|
|
740
|
+
|
|
741
|
+
"@emotion/react"
|
|
742
|
+
|
|
743
|
+
"@emotion/styled"
|
|
744
|
+
|
|
745
|
+
"@material-ui/core"
|
|
746
|
+
|
|
747
|
+
"@material-ui/icons"
|
|
748
|
+
|
|
749
|
+
"@material-ui/lab"
|
|
750
|
+
|
|
751
|
+
"react"
|
|
752
|
+
|
|
753
|
+
"react-dom"
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
To install the dependencies:
|
|
757
|
+
|
|
758
|
+
```sh
|
|
759
|
+
// with npm
|
|
760
|
+
|
|
761
|
+
npm i @emotion/css @emotion/react @emotion/styled @material-ui/core @material-ui/icons @material-ui/lab react react-dom
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
// with yarn
|
|
766
|
+
|
|
767
|
+
yarn add @emotion/css @emotion/react @emotion/styled @material-ui/core @material-ui/icons @material-ui/lab react react-dom
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
---
|
|
771
|
+
|
|
772
|
+
### Usage
|
|
773
|
+
|
|
774
|
+
`czifui` comes with four main exports that help you build your app:
|
|
775
|
+
|
|
776
|
+
1. **Components** - Accessible and reusable components
|
|
777
|
+
|
|
778
|
+
```js
|
|
779
|
+
import React from "react";
|
|
780
|
+
|
|
781
|
+
import { Button } from "czifui";
|
|
782
|
+
|
|
783
|
+
<Button onClick={actions.onClick} sdsStyle="rounded" sdsType="primary">
|
|
784
|
+
|
|
785
|
+
{text}
|
|
786
|
+
|
|
787
|
+
</Button>;
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
2. **Mixins** - Grouped styles defined by the design system
|
|
791
|
+
|
|
792
|
+
```js
|
|
793
|
+
import styled from "@emotion/styled";
|
|
794
|
+
|
|
795
|
+
import { Typography } from "@material-ui/core";
|
|
796
|
+
|
|
797
|
+
import { fontHeaderXL } from "czifui";
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
export const Title - styled(Typography)`
|
|
802
|
+
|
|
803
|
+
${fontHeaderXl}
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
// which compiles to:
|
|
808
|
+
|
|
809
|
+
font-size: 22px;
|
|
810
|
+
|
|
811
|
+
font-weight: 600;
|
|
812
|
+
|
|
813
|
+
letter-spacing: 0.3px;
|
|
814
|
+
|
|
815
|
+
line-height: 30px;
|
|
816
|
+
|
|
817
|
+
`;
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
3. **Selectors** - Helper functions that return theme variables based on passed props
|
|
821
|
+
|
|
822
|
+
```js
|
|
823
|
+
import { css, SerializedStyles } from "@emotion/react";
|
|
824
|
+
|
|
825
|
+
import styled from "@emotion/styled";
|
|
826
|
+
|
|
827
|
+
import { getColors, getCorners } from "czifui";
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
export const Tag = styled.div`
|
|
832
|
+
|
|
833
|
+
// This is a callback function that returns more CSS rules, but the only way
|
|
834
|
+
|
|
835
|
+
// to access the custom theme object
|
|
836
|
+
|
|
837
|
+
${(props) => {
|
|
838
|
+
|
|
839
|
+
// getColors() is a selector that picks out colors from the theme object
|
|
840
|
+
|
|
841
|
+
const colors = getColors(props);
|
|
842
|
+
|
|
843
|
+
// getSpaces() is a selector that picks out spacings from the theme object
|
|
844
|
+
|
|
845
|
+
const spacings = getSpaces(props);
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
return `
|
|
850
|
+
|
|
851
|
+
background-color: ${colors?.gray[500]};
|
|
852
|
+
|
|
853
|
+
padding-bottom: ${spacings?.m}px;
|
|
854
|
+
|
|
855
|
+
margin-bottom: ${spacings?.xxl}px;
|
|
856
|
+
|
|
857
|
+
`;
|
|
858
|
+
|
|
859
|
+
}}
|
|
860
|
+
|
|
861
|
+
`;
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
4. **CSS & SCSS Variables** - Variables for the `defaultTheme` to use if your app doesn't support `@emotion/styled`
|
|
865
|
+
|
|
866
|
+
```css
|
|
867
|
+
// with SCSS variables
|
|
868
|
+
|
|
869
|
+
@import "~czifui/dist/variables";
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
.button-primary {
|
|
874
|
+
|
|
875
|
+
background-color: $sds-color-primary-400;
|
|
876
|
+
|
|
877
|
+
padding: $sds-spaces-xxs;
|
|
878
|
+
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
// with CSS variables
|
|
884
|
+
|
|
885
|
+
.button-primary {
|
|
886
|
+
|
|
887
|
+
background-color: var(--sds-color-primary-400);
|
|
888
|
+
|
|
889
|
+
padding: var(--sds-spaces-xxs);
|
|
890
|
+
|
|
891
|
+
}
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
#### **Default Theme**
|
|
895
|
+
|
|
896
|
+
To use the default theme in your React application, complete the following:
|
|
897
|
+
|
|
898
|
+
1. Add the following HTML to your `index.html` at the `<head>`section:
|
|
899
|
+
|
|
900
|
+
```html
|
|
901
|
+
// installs the sds font from google fonts
|
|
902
|
+
|
|
903
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
|
904
|
+
|
|
905
|
+
<link
|
|
906
|
+
|
|
907
|
+
href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,400;1,600;1,700&display=swap"
|
|
908
|
+
|
|
909
|
+
rel="stylesheet"
|
|
910
|
+
|
|
911
|
+
/>
|
|
912
|
+
```
|
|
913
|
+
|
|
914
|
+
2. Import the default theme object and use it in Material UI's `<ThemeProvider />`:
|
|
915
|
+
|
|
916
|
+
```js
|
|
917
|
+
import { defaultTheme } from "czifui";
|
|
918
|
+
|
|
919
|
+
import { StylesProvider, ThemeProvider } from "@material-ui/core/styles";
|
|
920
|
+
|
|
921
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
<StylesProvider injectFirst>
|
|
926
|
+
|
|
927
|
+
<EmotionThemeProvider theme={defaultTheme}>
|
|
928
|
+
|
|
929
|
+
<ThemeProvider theme={defaultTheme}>
|
|
930
|
+
|
|
931
|
+
<YourApp />
|
|
932
|
+
|
|
933
|
+
</ThemeProvider>
|
|
934
|
+
|
|
935
|
+
</EmotionThemeProvider>
|
|
936
|
+
|
|
937
|
+
</StylesProvider>;
|
|
938
|
+
```
|
|
939
|
+
|
|
940
|
+
3. If you need to override the default SDS theme, please follow the instructions here.
|
|
941
|
+
|
|
942
|
+
---
|
|
943
|
+
|
|
944
|
+
### Contributing to the SDS
|
|
945
|
+
|
|
946
|
+
If you would like to contribute to the Science Design System by building requested components, please follow the contribution guidelines here.
|
|
947
|
+
|
|
948
|
+
If a product need arises for a component that doesn't exist in the SDS, a request can be made to the SDS team to design and add it into the system. To do so, follow the steps below:d
|
|
949
|
+
|
|
950
|
+
1. Take a second look through the SDS Documentation to double check the product need can indeed not be satisfied by an existing SDS component
|
|
951
|
+
2. Post the component request to the #sci-design-system-support.) channel in Slack using the following request template to ensure all of the necessary details are captured for the SDS team:
|
|
952
|
+
|
|
953
|
+
Once a request is submitted, the SDS team will conduct an evaluation across all Science products to determine whether the new component would be beneficial to multiple products and should become part of the SDS. If it is determined that the requested component be added into the SDS, the SDS team will work with the requesting team to build, review, test, and incorporate the new component into the system.
|
|
954
|
+
|
|
955
|
+
If it is determined that the new component should not become part of the SDS, it will become the requesting product team's responsibility to design and maintain the component on their own.
|
|
956
|
+
|
|
957
|
+
See a more detailed flow of the component request process here.
|
|
958
|
+
|
|
959
|
+
---
|
|
960
|
+
|
|
961
|
+
Let the following guides serve as starting points for working with the SDS. Understand how to use the design system libraries within Figma, navigate the documentation, contribute new components to the design system, access the SDS codebase, and incorporate coded components into application builds.
|
|
962
|
+
|
|
963
|
+
## For Designers
|
|
964
|
+
|
|
965
|
+
## Overview
|
|
966
|
+
|
|
967
|
+
| The Science Design System (SDS) brings consistency and universal standards to CZI's science products. Within Figma, the elements of the SDS are accessible to product designers via a collection of published libraries. These libraries have been built to allow for maximum flexibility depending on each product team's component needs. The SDS Documentation serves as an in-depth guide for both designers and engineers for using elements of the design system within projects. In instances where the available SDS components don't fulfill a product team's needs, there is a straightforward process for requesting additional elements for the design system. | | **Jump to** **s****ection:** Figma SDS Documentation Contributing to the SDS |
|
|
968
|
+
| --- | --- | --- |
|
|
969
|
+
|
|
970
|
+
---
|
|
971
|
+
|
|
972
|
+
### Figma
|
|
973
|
+
|
|
974
|
+
#### Library structure
|
|
975
|
+
|
|
976
|
+
Instead of consolidating all elements into the same Figma library, the SDS team has broken out each element type into separate libraries—SDS Bases, SDS Typography, SDS Icons, and SDS Components. Each of these libraries can be turned on or off depending on the needs of the individual product team. This ensures product designers' project files aren't cluttered with unnecessary elements and they only see the pieces of the SDS that are relevant to them.
|
|
977
|
+
|
|
978
|
+
> For example, CZ ID and CZ GEN EPI use the same fonts in both of their products, whereas Single Cell and Napari use their own unique typography and therefore have no need for the SDS Typography library to be enabled in their project files. All four products use the same icon set, meaning all four will have the SDS Icons library enabled in their project files.
|
|
979
|
+
|
|
980
|
+
The SDS Components library is not intended to be used by itself, but instead feeds into component sub-libraries for each product. This ensures each component is built consistently and has the same functionality and props, while allowing for visual customization of every component to align with each product's look and feel. Each product sub-library contains any product-specific colors (generally Primary and Info colors) and typography.
|
|
981
|
+
|
|
982
|
+
> For example, designers on CZ ID and CZ GEN EPI will both be using the same Button component and all of its variant options, while CZ ID's primary Button will be blue and pulled from the CZ ID Components library and CZ GEN EPI's will be purple and pulled from the CZ GEN EPI Components library.
|
|
983
|
+
|
|
984
|
+
#### Project file set up
|
|
985
|
+
|
|
986
|
+
When working on a project, ensure the necessary SDS libraries for your product are enabled. Figma's team settings for CZ ID and CZ GEN EPI have been adjusted to ensure any new project started within either of these team folders will have the necessary libraries enabled by default.
|
|
987
|
+
|
|
988
|
+
Below are the libraries that should be enabled by product:
|
|
989
|
+
|
|
990
|
+
CZ ID
|
|
991
|
+
|
|
992
|
+
* SDS Bases
|
|
993
|
+
* SDS Typography
|
|
994
|
+
* SDS Icons
|
|
995
|
+
* CZ ID Design System
|
|
996
|
+
|
|
997
|
+
CZ GEN EPI
|
|
998
|
+
|
|
999
|
+
* SDS Bases
|
|
1000
|
+
* SDS Typography
|
|
1001
|
+
* SDS Icons
|
|
1002
|
+
* CZ GEN EPI Design System
|
|
1003
|
+
|
|
1004
|
+
Single Cell Biology
|
|
1005
|
+
|
|
1006
|
+
* SDS Bases
|
|
1007
|
+
* SDS Icons
|
|
1008
|
+
* Single Cell Design System
|
|
1009
|
+
|
|
1010
|
+
Imaging
|
|
1011
|
+
|
|
1012
|
+
* SDS Icons
|
|
1013
|
+
* napari hub + .org Design System
|
|
1014
|
+
|
|
1015
|
+
For more details around using and working with libraries in Figma, see this helpful guide from the Figma team.
|
|
1016
|
+
|
|
1017
|
+
---
|
|
1018
|
+
|
|
1019
|
+
### SDS Documentation
|
|
1020
|
+
|
|
1021
|
+
The SDS documentation should be the go-to place to learn about using elements of the design system within projects. It is not intended to be used only by designers, but by anyone on a product team looking to better familiarize themselves with all of the pieces of the design system and how it can be best leveraged in product work.
|
|
1022
|
+
|
|
1023
|
+
Below are a few tips around navigating the documentation:
|
|
1024
|
+
|
|
1025
|
+
* Visit the Element Status Tracker page for the most up-to-date view of which elements are available for use within the Figma libraries and the SDS codebase; a more detailed status spreadsheet is linked at the bottom of this page for an in-depth look at status by component variant as well as links to implementation tickets for a granular view of when to expect components to be available for use
|
|
1026
|
+
* Most components have a Live Preview section on their Overview tabs; this displays an interactive instance of the element, providing the ability to engage with it and get a better feel for how it will work when included as part of a product build
|
|
1027
|
+
* Each variant of every component is viewable on their Overview tabs; aside from displaying all of the available props for each variant, these views are able to be clicked on and inspected to get further design details such as typography and color styles, border radiuses, spacing, etc.
|
|
1028
|
+
* On every component page there is a Code tab containing individual iframes imported from Storybook of each variant available to that component; each iframe has all of the same functionality found within Storybook, allowing engineers to explore props, adjust colors and text, see any event handlers, etc. all without leaving the documentation site
|
|
1029
|
+
|
|
1030
|
+
---
|
|
1031
|
+
|
|
1032
|
+
### Contributing to the SDS
|
|
1033
|
+
|
|
1034
|
+
If a product need arises for a component that doesn't exist in the SDS, a request can be made to the SDS team to design and add it into the system. To do so, follow the steps below:
|
|
1035
|
+
|
|
1036
|
+
1. Take a second look through the SDS Documentation to double check the product need can indeed not be satisfied by an existing SDS component
|
|
1037
|
+
2. Post the component request to the #sci-design-system-support.) channel in Slack using the following request template to ensure all of the necessary details are captured for the SDS team:
|
|
1038
|
+
|
|
1039
|
+
Once a request is submitted, the SDS team will conduct an evaluation across all Science products to determine whether the new component would be beneficial to multiple products and should become part of the SDS. If it is determined that the requested component be added into the SDS, the SDS team will work with the requesting team to build, review, test, and incorporate the new component into the system.
|
|
1040
|
+
|
|
1041
|
+
If it is determined that the new component should not become part of the SDS, it will become the requesting product team's responsibility to design and maintain the component on their own.
|
|
1042
|
+
|
|
1043
|
+
See a more detailed flow of the component request process here.
|
|
1044
|
+
|
|
1045
|
+
## For Engineers
|
|
1046
|
+
|
|
1047
|
+
## Overview
|
|
1048
|
+
|
|
1049
|
+
| The Science Design System (SDS) brings consistency and universal standards to CZI’s science products by offering a library of high quality, reusable components that deliver predictable, accessible and easy to learn experiences. Our goal is to democratize access to tools and technologies for scientists. | | **Jump to** **s****ection:** Getting Started Usage Contributing to the SDS |
|
|
1050
|
+
| --- | --- | --- |
|
|
1051
|
+
|
|
1052
|
+
---
|
|
1053
|
+
|
|
1054
|
+
### Getting Started
|
|
1055
|
+
|
|
1056
|
+
#### Installation
|
|
1057
|
+
|
|
1058
|
+
NPM Package:
|
|
1059
|
+
|
|
1060
|
+
```sh
|
|
1061
|
+
// with npm
|
|
1062
|
+
|
|
1063
|
+
npm i czifui
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
// with yarn
|
|
1068
|
+
|
|
1069
|
+
yarn add czifui
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1072
|
+
SDS currently uses Material UI v5
|
|
1073
|
+
|
|
1074
|
+
czifui installs without direct dependencies to prevent version errors. Please ensure the following peer dependencies are also installed:
|
|
1075
|
+
|
|
1076
|
+
```html
|
|
1077
|
+
"@emotion/css"
|
|
1078
|
+
|
|
1079
|
+
"@emotion/react"
|
|
1080
|
+
|
|
1081
|
+
"@emotion/styled"
|
|
1082
|
+
|
|
1083
|
+
"@material-ui/core"
|
|
1084
|
+
|
|
1085
|
+
"@material-ui/icons"
|
|
1086
|
+
|
|
1087
|
+
"@material-ui/lab"
|
|
1088
|
+
|
|
1089
|
+
"react"
|
|
1090
|
+
|
|
1091
|
+
"react-dom"
|
|
1092
|
+
```
|
|
1093
|
+
|
|
1094
|
+
To install the dependencies:
|
|
1095
|
+
|
|
1096
|
+
```sh
|
|
1097
|
+
// with npm
|
|
1098
|
+
|
|
1099
|
+
npm i @emotion/css @emotion/react @emotion/styled @material-ui/core @material-ui/icons @material-ui/lab react react-dom
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
// with yarn
|
|
1104
|
+
|
|
1105
|
+
yarn add @emotion/css @emotion/react @emotion/styled @material-ui/core @material-ui/icons @material-ui/lab react react-dom
|
|
1106
|
+
```
|
|
1107
|
+
|
|
1108
|
+
---
|
|
1109
|
+
|
|
1110
|
+
### Usage
|
|
1111
|
+
|
|
1112
|
+
`czifui` comes with four main exports that help you build your app:
|
|
1113
|
+
|
|
1114
|
+
1. **Components** - Accessible and reusable components
|
|
1115
|
+
|
|
1116
|
+
```js
|
|
1117
|
+
import React from "react";
|
|
1118
|
+
|
|
1119
|
+
import { Button } from "czifui";
|
|
1120
|
+
|
|
1121
|
+
<Button onClick={actions.onClick} sdsStyle="rounded" sdsType="primary">
|
|
1122
|
+
|
|
1123
|
+
{text}
|
|
1124
|
+
|
|
1125
|
+
</Button>;
|
|
1126
|
+
```
|
|
1127
|
+
|
|
1128
|
+
2. **Mixins** - Grouped styles defined by the design system
|
|
1129
|
+
|
|
1130
|
+
```js
|
|
1131
|
+
import styled from "@emotion/styled";
|
|
1132
|
+
|
|
1133
|
+
import { Typography } from "@material-ui/core";
|
|
1134
|
+
|
|
1135
|
+
import { fontHeaderXL } from "czifui";
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
export const Title - styled(Typography)`
|
|
1140
|
+
|
|
1141
|
+
${fontHeaderXl}
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
// which compiles to:
|
|
1146
|
+
|
|
1147
|
+
font-size: 22px;
|
|
1148
|
+
|
|
1149
|
+
font-weight: 600;
|
|
1150
|
+
|
|
1151
|
+
letter-spacing: 0.3px;
|
|
1152
|
+
|
|
1153
|
+
line-height: 30px;
|
|
1154
|
+
|
|
1155
|
+
`;
|
|
1156
|
+
```
|
|
1157
|
+
|
|
1158
|
+
3. **Selectors** - Helper functions that return theme variables based on passed props
|
|
1159
|
+
|
|
1160
|
+
```js
|
|
1161
|
+
import { css, SerializedStyles } from "@emotion/react";
|
|
1162
|
+
|
|
1163
|
+
import styled from "@emotion/styled";
|
|
1164
|
+
|
|
1165
|
+
import { getColors, getCorners } from "czifui";
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
|
|
1169
|
+
export const Tag = styled.div`
|
|
1170
|
+
|
|
1171
|
+
// This is a callback function that returns more CSS rules, but the only way
|
|
1172
|
+
|
|
1173
|
+
// to access the custom theme object
|
|
1174
|
+
|
|
1175
|
+
${(props) => {
|
|
1176
|
+
|
|
1177
|
+
// getColors() is a selector that picks out colors from the theme object
|
|
1178
|
+
|
|
1179
|
+
const colors = getColors(props);
|
|
1180
|
+
|
|
1181
|
+
// getSpaces() is a selector that picks out spacings from the theme object
|
|
1182
|
+
|
|
1183
|
+
const spacings = getSpaces(props);
|
|
1184
|
+
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
return `
|
|
1188
|
+
|
|
1189
|
+
background-color: ${colors?.gray[500]};
|
|
1190
|
+
|
|
1191
|
+
padding-bottom: ${spacings?.m}px;
|
|
1192
|
+
|
|
1193
|
+
margin-bottom: ${spacings?.xxl}px;
|
|
1194
|
+
|
|
1195
|
+
`;
|
|
1196
|
+
|
|
1197
|
+
}}
|
|
1198
|
+
|
|
1199
|
+
`;
|
|
1200
|
+
```
|
|
1201
|
+
|
|
1202
|
+
4. **CSS & SCSS Variables** - Variables for the `defaultTheme` to use if your app doesn't support `@emotion/styled`
|
|
1203
|
+
|
|
1204
|
+
```css
|
|
1205
|
+
// with SCSS variables
|
|
1206
|
+
|
|
1207
|
+
@import "~czifui/dist/variables";
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
|
|
1211
|
+
.button-primary {
|
|
1212
|
+
|
|
1213
|
+
background-color: $sds-color-primary-400;
|
|
1214
|
+
|
|
1215
|
+
padding: $sds-spaces-xxs;
|
|
1216
|
+
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
// with CSS variables
|
|
1222
|
+
|
|
1223
|
+
.button-primary {
|
|
1224
|
+
|
|
1225
|
+
background-color: var(--sds-color-primary-400);
|
|
1226
|
+
|
|
1227
|
+
padding: var(--sds-spaces-xxs);
|
|
1228
|
+
|
|
1229
|
+
}
|
|
1230
|
+
```
|
|
1231
|
+
|
|
1232
|
+
#### Default Theme
|
|
1233
|
+
|
|
1234
|
+
To use the default theme in your React application, complete the following:
|
|
1235
|
+
|
|
1236
|
+
1. Add the following HTML to your `index.html` at the `<head>`section:
|
|
1237
|
+
|
|
1238
|
+
```html
|
|
1239
|
+
// installs the sds font from google fonts
|
|
1240
|
+
|
|
1241
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
|
1242
|
+
|
|
1243
|
+
<link
|
|
1244
|
+
|
|
1245
|
+
href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,400;1,600;1,700&display=swap"
|
|
1246
|
+
|
|
1247
|
+
rel="stylesheet"
|
|
1248
|
+
|
|
1249
|
+
/>
|
|
1250
|
+
```
|
|
1251
|
+
|
|
1252
|
+
2. Import the default theme object and use it in Material UI's `<ThemeProvider />`:
|
|
1253
|
+
|
|
1254
|
+
```js
|
|
1255
|
+
import { defaultTheme } from "czifui";
|
|
1256
|
+
|
|
1257
|
+
import { StylesProvider, ThemeProvider } from "@material-ui/core/styles";
|
|
1258
|
+
|
|
1259
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
<StylesProvider injectFirst>
|
|
1264
|
+
|
|
1265
|
+
<EmotionThemeProvider theme={defaultTheme}>
|
|
1266
|
+
|
|
1267
|
+
<ThemeProvider theme={defaultTheme}>
|
|
1268
|
+
|
|
1269
|
+
<YourApp />
|
|
1270
|
+
|
|
1271
|
+
</ThemeProvider>
|
|
1272
|
+
|
|
1273
|
+
</EmotionThemeProvider>
|
|
1274
|
+
|
|
1275
|
+
</StylesProvider>;
|
|
1276
|
+
```
|
|
1277
|
+
|
|
1278
|
+
3. If you need to override the default SDS theme, please follow the instructions here.
|
|
1279
|
+
|
|
1280
|
+
---
|
|
1281
|
+
|
|
1282
|
+
### Contributing to the SDS
|
|
1283
|
+
|
|
1284
|
+
If you would like to contribute to the Science Design System by building requested components, please follow the contribution guidelines here.
|
|
1285
|
+
|
|
1286
|
+
If a product need arises for a component that doesn't exist in the SDS, a request can be made to the SDS team to design and add it into the system. To do so, follow the steps below:
|
|
1287
|
+
|
|
1288
|
+
1. Take a second look through the SDS Documentation to double check the product need can indeed not be satisfied by an existing SDS component
|
|
1289
|
+
2. Post the component request to the #sci-design-system-support.) channel in Slack using the following request template to ensure all of the necessary details are captured for the SDS team:
|
|
1290
|
+
|
|
1291
|
+
Once a request is submitted, the SDS team will conduct an evaluation across all Science products to determine whether the new component would be beneficial to multiple products and should become part of the SDS. If it is determined that the requested component be added into the SDS, the SDS team will work with the requesting team to build, review, test, and incorporate the new component into the system.
|
|
1292
|
+
|
|
1293
|
+
If it is determined that the new component should not become part of the SDS, it will become the requesting product team's responsibility to design and maintain the component on their own.
|
|
1294
|
+
|
|
1295
|
+
See a more detailed flow of the component request process here.
|
|
1296
|
+
|