@czi-sds/mcp 0.2.1 → 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 +515 -12
- package/package.json +4 -3
|
@@ -0,0 +1,675 @@
|
|
|
1
|
+
# Accordions
|
|
2
|
+
|
|
3
|
+
To help control the amount of information presented to the user, Accordions are expandable/collapsable elements that hide and reveal content.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
| | In Figma | | | Meets Accessibility | | | In napari hub + .org Codebases |
|
|
8
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
9
|
+
|
|
10
|
+
Accordions are elements that can be used by designers to hide or reveal content. Use the header text to communicate what type of content the user can expect to see when the Accordion is expanded.
|
|
11
|
+
|
|
12
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
### Accordion Spacing
|
|
21
|
+
|
|
22
|
+
These rules establish how much margin should exist between and around elements.
|
|
23
|
+
|
|
24
|
+
## Code
|
|
25
|
+
|
|
26
|
+
## Accordion Component
|
|
27
|
+
|
|
28
|
+
| Below you will find an interactive Storybook iframe for Accordions. Tabs within each iframe provide a different set of tools: The Controls tab allows you to see and adjust all available props. The Actions tab shows you data displayed by event handler arguments. | | **Jump to component:** Accordion |
|
|
29
|
+
| --- | --- | --- |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
>This component appears as it is in the default SDS codebase. Once imported into the napari hub or napari.org codebases, use a theme file to enable the napari visual appearance customization.
|
|
34
|
+
|
|
35
|
+
### Accordion
|
|
36
|
+
|
|
37
|
+
Storybook
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
To help control the amount of information presented to the user, Accordions are expandable/collapsable elements that hide and reveal content.
|
|
42
|
+
|
|
43
|
+
## Overview
|
|
44
|
+
|
|
45
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
46
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
47
|
+
|
|
48
|
+
Accordions are elements that can be used by designers to hide or reveal content. Use the header text to communicate what type of content the user can expect to see when the Accordion is expanded. They can optionally include a bottom-positioned divider line to help visually separate an Accordion from the one below it.
|
|
49
|
+
|
|
50
|
+
Once expanded, the content revealed within the Accordion can be whatever the designer desires, whether basic text or another component or element.
|
|
51
|
+
|
|
52
|
+
Click on each state below to enter inspect view and get details on its code attributes and any global styles it uses.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### Accordion Spacing
|
|
61
|
+
|
|
62
|
+
These rules establish how much margin should exist between and around elements.
|
|
63
|
+
|
|
64
|
+
## Code
|
|
65
|
+
|
|
66
|
+
## Accordion Component
|
|
67
|
+
|
|
68
|
+
| Below you will find an interactive Storybook iframe for Accordions. Tabs within each iframe provide a different set of tools: The Controls tab allows you to see and adjust all available props. The Actions tab shows you data displayed by event handler arguments. | | **Jump to component:** Accordion |
|
|
69
|
+
| --- | --- | --- |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### Accordion
|
|
74
|
+
|
|
75
|
+
Storybook
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
Accordions are expandable/collapsable elements that hide and reveal content to help control the amount of information presented to the user at one time.
|
|
82
|
+
|
|
83
|
+
## Guidelines
|
|
84
|
+
|
|
85
|
+
## Overview
|
|
86
|
+
|
|
87
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
88
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
89
|
+
|
|
90
|
+
### Accordion Variants
|
|
91
|
+
|
|
92
|
+
Accordions are elements that can be used to hide or reveal content. Use the header text to communicate what type of content the user can expect to see when the Accordion is expanded. Accordions can contain anything from — basic text to others components or elements.
|
|
93
|
+
|
|
94
|
+
The Accordion indicator arrow may appear to the left or the right of the header. Accordions may show a subtitle below the header text. Accordions may show bottom divider lines to help visually separate them from one another.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### Live Instance
|
|
99
|
+
|
|
100
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
101
|
+
|
|
102
|
+
Default
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
### Accordion – Left Toggle
|
|
107
|
+
|
|
108
|
+
Left-aligned toggles works well when the Accordion's container is wide, because a right-aligned toggle would be far from the header text and it is less obvious that the two elements are related.
|
|
109
|
+
|
|
110
|
+
| Default | Default + Divider | Default + Subtitle | Expanded |
|
|
111
|
+
| --- | --- | --- | --- |
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### Accordion – Right Toggle
|
|
116
|
+
|
|
117
|
+
Use when there's a preference for the Accordion toggle to appear to the right of its header text. The toggle icon right aligns to the right edge of the Accordion's container.
|
|
118
|
+
|
|
119
|
+
| Default | Default + Divider | Default + Subtitle | Expanded |
|
|
120
|
+
| --- | --- | --- | --- |
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### Accordion Spacing
|
|
125
|
+
|
|
126
|
+
These rules establish how much margin should exist between and around elements.
|
|
127
|
+
|
|
128
|
+
## Code
|
|
129
|
+
|
|
130
|
+
>**Note:** The code examples below must install dependencies before displaying and may take extra time to load
|
|
131
|
+
|
|
132
|
+
## Accordion
|
|
133
|
+
|
|
134
|
+
### SDS Source Code
|
|
135
|
+
|
|
136
|
+
The component's source code in the SDS codebase can be found here.
|
|
137
|
+
|
|
138
|
+
### SDS vs MUI
|
|
139
|
+
|
|
140
|
+
The SDS `Accordion` component introduces a couple new props that aren't part of the MUI version, that make it easier to implement options that may be needed in CZI products:
|
|
141
|
+
|
|
142
|
+
* **`useDivider`****:** this boolean prop adds a horizontal line below the accordion, which can help to visually separate it from other accordions if they are stacked
|
|
143
|
+
* **`togglePosition`****:** takes `right` (default) or `left` as values, and specifies where the baked-in Chevron icon that acts as a visual toggle sits
|
|
144
|
+
|
|
145
|
+
Additionally, there are a couple of MUI props that are not currently supported by the SDS `Accordion` component:
|
|
146
|
+
|
|
147
|
+
* **`defaultExpanded`****:** this boolean prop has no effect when used
|
|
148
|
+
* **`expanded`****:** this boolean prop is not recommended to be used with the SDS `Accordion` component, because it forces the accordion to remain open even when the user clicks it as though to close it
|
|
149
|
+
* **`disableGutters`****:** this boolean prop is not needed with the SDS accordion design, and has no effect
|
|
150
|
+
|
|
151
|
+
### MUI Documentation
|
|
152
|
+
|
|
153
|
+
Documentation for the underlying MUI component can be found here.
|
|
154
|
+
|
|
155
|
+
### Props
|
|
156
|
+
|
|
157
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
158
|
+
|
|
159
|
+
| Name | Type | Default | Description |
|
|
160
|
+
| --- | --- | --- | --- |
|
|
161
|
+
| `id` | `string` | `-` | A unique id for each accordion item. |
|
|
162
|
+
| `disabled` | `bool` | `false` | The `disabled` prop, when set to true, prevents user interaction with the Accordion component, keeping it in a static state. |
|
|
163
|
+
| `togglePosition` | `"right"` `| "left"` | `right` | Position of the toggle chevron icon. |
|
|
164
|
+
| `subtitle` | `string` | `-` | A text that will be displayed as a subtitle beneath the accordion title. |
|
|
165
|
+
| `useDivider` | `bool` | `false` | Display a divider line between accordion items. |
|
|
166
|
+
|
|
167
|
+
There are more props that can be used with the `InputDropdown` component, via those available to MUI's `Accordion` component.
|
|
168
|
+
|
|
169
|
+
### Code examples
|
|
170
|
+
|
|
171
|
+
#### Default Accordion
|
|
172
|
+
|
|
173
|
+
This example has the minimum props needed for the `Accordion` component.
|
|
174
|
+
|
|
175
|
+
**/styles.css**
|
|
176
|
+
|
|
177
|
+
```css
|
|
178
|
+
body {
|
|
179
|
+
font-size: 13px;
|
|
180
|
+
font-weight: 400;
|
|
181
|
+
letter-spacing: 0.08px;
|
|
182
|
+
line-height: 20px;
|
|
183
|
+
text-transform: none;
|
|
184
|
+
font-family: "Inter", sans-serif;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
h1 {
|
|
188
|
+
font-size: 1.5rem;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.app {
|
|
192
|
+
padding: 20px;
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**tsconfig.json**
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"include": [
|
|
201
|
+
"./**/*"
|
|
202
|
+
],
|
|
203
|
+
"compilerOptions": {
|
|
204
|
+
"strict": true,
|
|
205
|
+
"esModuleInterop": true,
|
|
206
|
+
"lib": [ "dom", "es2015" ],
|
|
207
|
+
"jsx": "react-jsx"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**/App.tsx**
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
// Most minimal Accordion (just has the basic requirements)
|
|
216
|
+
|
|
217
|
+
import { Accordion, AccordionHeader, AccordionDetails } from "@czi-sds/components";
|
|
218
|
+
import "./styles.css";
|
|
219
|
+
|
|
220
|
+
function App() {
|
|
221
|
+
return (
|
|
222
|
+
<div className="app">
|
|
223
|
+
<Accordion
|
|
224
|
+
id="accordion-1"
|
|
225
|
+
useDivider={false}
|
|
226
|
+
togglePosition="right">
|
|
227
|
+
<AccordionHeader id={`accordion-1-header`}>
|
|
228
|
+
Accordion Header
|
|
229
|
+
</AccordionHeader>
|
|
230
|
+
<AccordionDetails>
|
|
231
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
|
|
232
|
+
malesuada lacus ex, sit amet blandit leo lobortis eget.
|
|
233
|
+
</AccordionDetails>
|
|
234
|
+
</Accordion>
|
|
235
|
+
</div>
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export default App;
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**/index.tsx**
|
|
243
|
+
|
|
244
|
+
```tsx
|
|
245
|
+
import React from "react";
|
|
246
|
+
import { createRoot } from "react-dom/client";
|
|
247
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
248
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
249
|
+
import { Theme } from "@czi-sds/components";
|
|
250
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
251
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
252
|
+
|
|
253
|
+
import App from "./App";
|
|
254
|
+
|
|
255
|
+
const container = document.getElementById("root");
|
|
256
|
+
const root = createRoot(container!);
|
|
257
|
+
|
|
258
|
+
const RootApp = () => {
|
|
259
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
260
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
261
|
+
|
|
262
|
+
return (
|
|
263
|
+
<StyledEngineProvider injectFirst>
|
|
264
|
+
<ThemeProvider theme={theme}>
|
|
265
|
+
<EmotionThemeProvider theme={theme}>
|
|
266
|
+
<CssBaseline />
|
|
267
|
+
<App />
|
|
268
|
+
</EmotionThemeProvider>
|
|
269
|
+
</ThemeProvider>
|
|
270
|
+
</StyledEngineProvider>
|
|
271
|
+
);
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
root.render(
|
|
275
|
+
<React.StrictMode>
|
|
276
|
+
<RootApp />
|
|
277
|
+
</React.StrictMode>
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**/public/index.html**
|
|
283
|
+
|
|
284
|
+
```html
|
|
285
|
+
<!DOCTYPE html>
|
|
286
|
+
<html lang="en">
|
|
287
|
+
<head>
|
|
288
|
+
<meta charset="UTF-8" />
|
|
289
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
290
|
+
<title>Accordion</title>
|
|
291
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
292
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
293
|
+
<link
|
|
294
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
295
|
+
rel="stylesheet"
|
|
296
|
+
/>
|
|
297
|
+
<link
|
|
298
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
299
|
+
rel="stylesheet"
|
|
300
|
+
/>
|
|
301
|
+
</head>
|
|
302
|
+
<body>
|
|
303
|
+
<div id="root"></div>
|
|
304
|
+
</body>
|
|
305
|
+
</html>
|
|
306
|
+
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**/package.json**
|
|
310
|
+
|
|
311
|
+
```json
|
|
312
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
#### Accordion with subtitles
|
|
318
|
+
|
|
319
|
+
This example show a group of `Accordions`, each with its own subtitle and dividing line.
|
|
320
|
+
|
|
321
|
+
**/styles.css**
|
|
322
|
+
|
|
323
|
+
```css
|
|
324
|
+
body {
|
|
325
|
+
font-size: 13px;
|
|
326
|
+
font-weight: 400;
|
|
327
|
+
letter-spacing: 0.08px;
|
|
328
|
+
line-height: 20px;
|
|
329
|
+
text-transform: none;
|
|
330
|
+
font-family: "Inter", sans-serif;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
h1 {
|
|
334
|
+
font-size: 1.5rem;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.app {
|
|
338
|
+
padding: 20px;
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**tsconfig.json**
|
|
343
|
+
|
|
344
|
+
```json
|
|
345
|
+
{
|
|
346
|
+
"include": [
|
|
347
|
+
"./**/*"
|
|
348
|
+
],
|
|
349
|
+
"compilerOptions": {
|
|
350
|
+
"strict": true,
|
|
351
|
+
"esModuleInterop": true,
|
|
352
|
+
"lib": [ "dom", "es2015" ],
|
|
353
|
+
"jsx": "react-jsx"
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**/App.tsx**
|
|
359
|
+
|
|
360
|
+
```tsx
|
|
361
|
+
// Most minimal InputDropdown (just has the basic requirements)
|
|
362
|
+
|
|
363
|
+
import { Accordion, AccordionHeader, AccordionDetails } from "@czi-sds/components";
|
|
364
|
+
import "./styles.css";
|
|
365
|
+
|
|
366
|
+
function App() {
|
|
367
|
+
return (
|
|
368
|
+
<div className="app">
|
|
369
|
+
<Accordion
|
|
370
|
+
id="accordion-1"
|
|
371
|
+
useDivider={true}
|
|
372
|
+
togglePosition="right">
|
|
373
|
+
<AccordionHeader id={`accordion-1-header`} subtitle="Explore the functionalities of our amazing product">
|
|
374
|
+
Product Features
|
|
375
|
+
</AccordionHeader>
|
|
376
|
+
<AccordionDetails>
|
|
377
|
+
Unveil the multitude of features that make our product stand out. From seamless
|
|
378
|
+
integration with your existing workflow to advanced customization options,
|
|
379
|
+
each feature has been meticulously crafted to empower you. Navigate through
|
|
380
|
+
this section to discover how our product can revolutionize the way you work.
|
|
381
|
+
</AccordionDetails>
|
|
382
|
+
</Accordion>
|
|
383
|
+
<Accordion
|
|
384
|
+
id="accordion-2"
|
|
385
|
+
useDivider={true}
|
|
386
|
+
togglePosition="right">
|
|
387
|
+
<AccordionHeader id={`accordion-2-header`} subtitle="Answers to commonly asked questions about our service">
|
|
388
|
+
FAQ Section
|
|
389
|
+
</AccordionHeader>
|
|
390
|
+
<AccordionDetails>
|
|
391
|
+
Delve into a comprehensive compilation of frequently asked questions and their
|
|
392
|
+
detailed answers. This section is your go-to resource for clarifying any doubts
|
|
393
|
+
you might have about our service. Whether it's about pricing, compatibility,
|
|
394
|
+
or functionality, we've got you covered with clear and concise explanations,
|
|
395
|
+
ensuring a smooth and informed experience.
|
|
396
|
+
</AccordionDetails>
|
|
397
|
+
</Accordion>
|
|
398
|
+
|
|
399
|
+
<Accordion
|
|
400
|
+
id="accordion-3"
|
|
401
|
+
useDivider={false}
|
|
402
|
+
togglePosition="right">
|
|
403
|
+
<AccordionHeader id={`accordion-3-header`} subtitle="Enhance your skills with our collection of educational materials">
|
|
404
|
+
Learning Resources
|
|
405
|
+
</AccordionHeader>
|
|
406
|
+
<AccordionDetails>
|
|
407
|
+
Embark on a journey of continuous improvement with our treasure trove of learning
|
|
408
|
+
materials. This section hosts an array of tutorials, guides, and insightful
|
|
409
|
+
articles designed to enhance your skills and deepen your understanding.
|
|
410
|
+
Whether you're a beginner or an expert, these resources offer valuable
|
|
411
|
+
insights to help you grow and excel in your endeavors.
|
|
412
|
+
</AccordionDetails>
|
|
413
|
+
</Accordion>
|
|
414
|
+
</div>
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export default App;
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
**/index.tsx**
|
|
422
|
+
|
|
423
|
+
```tsx
|
|
424
|
+
import React from "react";
|
|
425
|
+
import { createRoot } from "react-dom/client";
|
|
426
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
427
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
428
|
+
import { Theme } from "@czi-sds/components";
|
|
429
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
430
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
431
|
+
|
|
432
|
+
import App from "./App";
|
|
433
|
+
|
|
434
|
+
const container = document.getElementById("root");
|
|
435
|
+
const root = createRoot(container!);
|
|
436
|
+
|
|
437
|
+
const RootApp = () => {
|
|
438
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
439
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
440
|
+
|
|
441
|
+
return (
|
|
442
|
+
<StyledEngineProvider injectFirst>
|
|
443
|
+
<ThemeProvider theme={theme}>
|
|
444
|
+
<EmotionThemeProvider theme={theme}>
|
|
445
|
+
<CssBaseline />
|
|
446
|
+
<App />
|
|
447
|
+
</EmotionThemeProvider>
|
|
448
|
+
</ThemeProvider>
|
|
449
|
+
</StyledEngineProvider>
|
|
450
|
+
);
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
root.render(
|
|
454
|
+
<React.StrictMode>
|
|
455
|
+
<RootApp />
|
|
456
|
+
</React.StrictMode>
|
|
457
|
+
);
|
|
458
|
+
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
**/public/index.html**
|
|
462
|
+
|
|
463
|
+
```html
|
|
464
|
+
<!DOCTYPE html>
|
|
465
|
+
<html lang="en">
|
|
466
|
+
<head>
|
|
467
|
+
<meta charset="UTF-8" />
|
|
468
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
469
|
+
<title>Accordion</title>
|
|
470
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
471
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
472
|
+
<link
|
|
473
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
474
|
+
rel="stylesheet"
|
|
475
|
+
/>
|
|
476
|
+
<link
|
|
477
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
478
|
+
rel="stylesheet"
|
|
479
|
+
/>
|
|
480
|
+
</head>
|
|
481
|
+
<body>
|
|
482
|
+
<div id="root"></div>
|
|
483
|
+
</body>
|
|
484
|
+
</html>
|
|
485
|
+
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
**/package.json**
|
|
489
|
+
|
|
490
|
+
```json
|
|
491
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
---
|
|
495
|
+
|
|
496
|
+
#### Accordion with disabled item
|
|
497
|
+
|
|
498
|
+
This example shows a group of multiple `Accordions`, one of which is disabled and cannot be opened.
|
|
499
|
+
|
|
500
|
+
**/styles.css**
|
|
501
|
+
|
|
502
|
+
```css
|
|
503
|
+
body {
|
|
504
|
+
font-size: 13px;
|
|
505
|
+
font-weight: 400;
|
|
506
|
+
letter-spacing: 0.08px;
|
|
507
|
+
line-height: 20px;
|
|
508
|
+
text-transform: none;
|
|
509
|
+
font-family: "Inter", sans-serif;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
h1 {
|
|
513
|
+
font-size: 1.5rem;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.app {
|
|
517
|
+
padding: 20px;
|
|
518
|
+
}
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
**tsconfig.json**
|
|
522
|
+
|
|
523
|
+
```json
|
|
524
|
+
{
|
|
525
|
+
"include": [
|
|
526
|
+
"./**/*"
|
|
527
|
+
],
|
|
528
|
+
"compilerOptions": {
|
|
529
|
+
"strict": true,
|
|
530
|
+
"esModuleInterop": true,
|
|
531
|
+
"lib": [ "dom", "es2015" ],
|
|
532
|
+
"jsx": "react-jsx"
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
**/App.tsx**
|
|
538
|
+
|
|
539
|
+
```tsx
|
|
540
|
+
// Most minimal InputDropdown (just has the basic requirements)
|
|
541
|
+
|
|
542
|
+
import { Accordion, AccordionHeader, AccordionDetails } from "@czi-sds/components";
|
|
543
|
+
import "./styles.css";
|
|
544
|
+
|
|
545
|
+
function App() {
|
|
546
|
+
return (
|
|
547
|
+
<div className="app">
|
|
548
|
+
<Accordion
|
|
549
|
+
id="accordion-1"
|
|
550
|
+
useDivider={true}
|
|
551
|
+
togglePosition="right">
|
|
552
|
+
<AccordionHeader id={`accordion-1-header`} subtitle="Explore the functionalities of our amazing product">
|
|
553
|
+
Product Features
|
|
554
|
+
</AccordionHeader>
|
|
555
|
+
<AccordionDetails>
|
|
556
|
+
Unveil the multitude of features that make our product stand out. From seamless
|
|
557
|
+
integration with your existing workflow to advanced customization options,
|
|
558
|
+
each feature has been meticulously crafted to empower you. Navigate through
|
|
559
|
+
this section to discover how our product can revolutionize the way you work.
|
|
560
|
+
</AccordionDetails>
|
|
561
|
+
</Accordion>
|
|
562
|
+
<Accordion
|
|
563
|
+
disabled={true}
|
|
564
|
+
id="accordion-2"
|
|
565
|
+
useDivider={true}
|
|
566
|
+
togglePosition="right">
|
|
567
|
+
<AccordionHeader id={`accordion-2-header`} subtitle="Answers to commonly asked questions about our service">
|
|
568
|
+
FAQ Section
|
|
569
|
+
</AccordionHeader>
|
|
570
|
+
<AccordionDetails>
|
|
571
|
+
Delve into a comprehensive compilation of frequently asked questions and their
|
|
572
|
+
detailed answers. This section is your go-to resource for clarifying any doubts
|
|
573
|
+
you might have about our service. Whether it's about pricing, compatibility,
|
|
574
|
+
or functionality, we've got you covered with clear and concise explanations,
|
|
575
|
+
ensuring a smooth and informed experience.
|
|
576
|
+
</AccordionDetails>
|
|
577
|
+
</Accordion>
|
|
578
|
+
|
|
579
|
+
<Accordion
|
|
580
|
+
id="accordion-3"
|
|
581
|
+
useDivider={false}
|
|
582
|
+
togglePosition="right">
|
|
583
|
+
<AccordionHeader id={`accordion-3-header`} subtitle="Enhance your skills with our collection of educational materials">
|
|
584
|
+
Learning Resources
|
|
585
|
+
</AccordionHeader>
|
|
586
|
+
<AccordionDetails>
|
|
587
|
+
Embark on a journey of continuous improvement with our treasure trove of learning
|
|
588
|
+
materials. This section hosts an array of tutorials, guides, and insightful
|
|
589
|
+
articles designed to enhance your skills and deepen your understanding.
|
|
590
|
+
Whether you're a beginner or an expert, these resources offer valuable
|
|
591
|
+
insights to help you grow and excel in your endeavors.
|
|
592
|
+
</AccordionDetails>
|
|
593
|
+
</Accordion>
|
|
594
|
+
</div>
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export default App;
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
**/index.tsx**
|
|
602
|
+
|
|
603
|
+
```tsx
|
|
604
|
+
import React from "react";
|
|
605
|
+
import { createRoot } from "react-dom/client";
|
|
606
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
607
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
608
|
+
import { Theme } from "@czi-sds/components";
|
|
609
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
610
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
611
|
+
|
|
612
|
+
import App from "./App";
|
|
613
|
+
|
|
614
|
+
const container = document.getElementById("root");
|
|
615
|
+
const root = createRoot(container!);
|
|
616
|
+
|
|
617
|
+
const RootApp = () => {
|
|
618
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
619
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
620
|
+
|
|
621
|
+
return (
|
|
622
|
+
<StyledEngineProvider injectFirst>
|
|
623
|
+
<ThemeProvider theme={theme}>
|
|
624
|
+
<EmotionThemeProvider theme={theme}>
|
|
625
|
+
<CssBaseline />
|
|
626
|
+
<App />
|
|
627
|
+
</EmotionThemeProvider>
|
|
628
|
+
</ThemeProvider>
|
|
629
|
+
</StyledEngineProvider>
|
|
630
|
+
);
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
root.render(
|
|
634
|
+
<React.StrictMode>
|
|
635
|
+
<RootApp />
|
|
636
|
+
</React.StrictMode>
|
|
637
|
+
);
|
|
638
|
+
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
**/public/index.html**
|
|
642
|
+
|
|
643
|
+
```html
|
|
644
|
+
<!DOCTYPE html>
|
|
645
|
+
<html lang="en">
|
|
646
|
+
<head>
|
|
647
|
+
<meta charset="UTF-8" />
|
|
648
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
649
|
+
<title>Accordion</title>
|
|
650
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
651
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
652
|
+
<link
|
|
653
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
654
|
+
rel="stylesheet"
|
|
655
|
+
/>
|
|
656
|
+
<link
|
|
657
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
658
|
+
rel="stylesheet"
|
|
659
|
+
/>
|
|
660
|
+
</head>
|
|
661
|
+
<body>
|
|
662
|
+
<div id="root"></div>
|
|
663
|
+
</body>
|
|
664
|
+
</html>
|
|
665
|
+
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
**/package.json**
|
|
669
|
+
|
|
670
|
+
```json
|
|
671
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
---
|
|
675
|
+
|