@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.
Files changed (50) hide show
  1. package/data/zeroheight-cache.json +5195 -0
  2. package/data/zeroheight-exports/Accordion.md +675 -0
  3. package/data/zeroheight-exports/Banner.md +576 -0
  4. package/data/zeroheight-exports/Borders.md +118 -0
  5. package/data/zeroheight-exports/Buttons.md +2260 -0
  6. package/data/zeroheight-exports/Callout.md +756 -0
  7. package/data/zeroheight-exports/Colors.md +633 -0
  8. package/data/zeroheight-exports/Content-Card.md +162 -0
  9. package/data/zeroheight-exports/Contributing-to-SDS.md +99 -0
  10. package/data/zeroheight-exports/Control-Inputs.md +2066 -0
  11. package/data/zeroheight-exports/Corners.md +112 -0
  12. package/data/zeroheight-exports/Cover-page.md +4 -0
  13. package/data/zeroheight-exports/Dialog.md +1133 -0
  14. package/data/zeroheight-exports/Downloads.md +121 -0
  15. package/data/zeroheight-exports/Drop-Shadows.md +80 -0
  16. package/data/zeroheight-exports/Dropdown-Input.md +1149 -0
  17. package/data/zeroheight-exports/Dropdown-Menu.md +3787 -0
  18. package/data/zeroheight-exports/Element-Status-Tracker.md +268 -0
  19. package/data/zeroheight-exports/Field-Inputs.md +965 -0
  20. package/data/zeroheight-exports/Filters.md +868 -0
  21. package/data/zeroheight-exports/Getting-Started.md +1296 -0
  22. package/data/zeroheight-exports/Hero.md +256 -0
  23. package/data/zeroheight-exports/Icons.md +432 -0
  24. package/data/zeroheight-exports/Intent.md +47 -0
  25. package/data/zeroheight-exports/Introduction-to-Bases.md +36 -0
  26. package/data/zeroheight-exports/Introduction-to-Cells.md +36 -0
  27. package/data/zeroheight-exports/Introduction-to-DNA.md +36 -0
  28. package/data/zeroheight-exports/Introduction-to-Genes.md +36 -0
  29. package/data/zeroheight-exports/Introduction.md +116 -0
  30. package/data/zeroheight-exports/Link.md +373 -0
  31. package/data/zeroheight-exports/Lists.md +617 -0
  32. package/data/zeroheight-exports/Loading-Indicator.md +38 -0
  33. package/data/zeroheight-exports/Navigation.md +853 -0
  34. package/data/zeroheight-exports/Notification.md +858 -0
  35. package/data/zeroheight-exports/Panel.md +862 -0
  36. package/data/zeroheight-exports/README.md +124 -0
  37. package/data/zeroheight-exports/Responsive-Design.md +275 -0
  38. package/data/zeroheight-exports/Search-Input.md +54 -0
  39. package/data/zeroheight-exports/Search.md +609 -0
  40. package/data/zeroheight-exports/Segmented-Control.md +561 -0
  41. package/data/zeroheight-exports/Spacing.md +298 -0
  42. package/data/zeroheight-exports/Table.md +4832 -0
  43. package/data/zeroheight-exports/Tabs.md +773 -0
  44. package/data/zeroheight-exports/Tags.md +1025 -0
  45. package/data/zeroheight-exports/Text-Link.md +185 -0
  46. package/data/zeroheight-exports/Theming.md +313 -0
  47. package/data/zeroheight-exports/Tooltips.md +1564 -0
  48. package/data/zeroheight-exports/Typography.md +769 -0
  49. package/dist/stdio.js +188 -0
  50. package/package.json +4 -3
@@ -0,0 +1,853 @@
1
+ # Navigation
2
+
3
+ Navigation components enable users to move around an application, either between pages or within the same page, and help facilitate user's ability to find relevant content and tools.
4
+
5
+ ## Overview
6
+
7
+ ## Jump-to Navigation
8
+
9
+ | | In Figma | | | Meets Accessibility | | | In napari hub + .org Codebases |
10
+ | --- | --- | --- | --- | --- | --- | --- | --- |
11
+
12
+ The Jump-to Navigation component can contain as many Nav Items as necessary though must have a minimum of two. Each Nav Item is tied to a a section of the page and functions as a jump link to that page section. It is positioned on the right side of the page, anchored to the top of the page’s first paragraph and remains sticky on the page as the user scrolls; once the user scrolls into a new section, the active indicator on that section is highlighted until the user scrolls beyond it and into the next (or previous) at which point the indictor moves again. When the user clicks on any of the Nav Items, the page will smooth scroll to that section of the page.
13
+
14
+ | **Default / Active** | **Hover** |
15
+ | --- | --- |
16
+
17
+ ---
18
+
19
+ ### Jump-to Navigation Spacing
20
+
21
+ These rules establish how much margin should exist between and around elements.
22
+
23
+  
24
+
25
+ ## Code
26
+
27
+ ## Jump-to Navigation Component
28
+
29
+ | Below you will find an interactive Storybook iframe for the Jump-to Navigation. 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:** NavigationJumpTo |
30
+ | --- | --- | --- |
31
+
32
+ ---
33
+
34
+ >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.
35
+
36
+ ### NavigationJumpTo
37
+
38
+ Default
39
+
40
+  
41
+
42
+ ---
43
+
44
+ Navigation components enable users to move around an application, either between pages or within the same page, and help facilitate user's ability to find relevant content and tools.
45
+
46
+ ## Overview
47
+
48
+ ## Jump-to Navigation
49
+
50
+ | | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
51
+ | --- | --- | --- | --- | --- | --- | --- | --- |
52
+
53
+ The Jump-to Navigation component can contain as many Nav Items as necessary though must have a minimum of two. Each Nav Item is tied to a a section of the page and functions as a jump link to that page section. It is positioned on the right side of the page, anchored to the top of the page’s first paragraph and remains sticky on the page as the user scrolls; once the user scrolls into a new section, the active indicator on that section is highlighted until the user scrolls beyond it and into the next (or previous) at which point the indictor moves again. When the user clicks on any of the Nav Items, the page will smooth scroll to that section of the page.
54
+
55
+ Use a positive pixel value in the `offset` prop to adjust where on the page the user is navigated to in relation to the top of each section.
56
+
57
+ | **Default / Active** | **Hover** |
58
+ | --- | --- |
59
+
60
+ ---
61
+
62
+ ### Jump-to Navigation Spacing
63
+
64
+ These rules establish how much margin should exist between and around elements.
65
+
66
+  
67
+
68
+ ---
69
+
70
+ ### Indicator Variations
71
+
72
+ The color of the position indicator can be adjusted using the `indicatorColor` prop, allowing designers to customize the designs based on their needs.
73
+
74
+ Each color option is demonstrated below:
75
+
76
+ | **Beta** | **Error** | **Gray** | **Info** |
77
+ | --- | --- | --- | --- |
78
+
79
+ | **Primary** | **Success** | **Warning** |
80
+ | --- | --- | --- |
81
+
82
+ ## Code
83
+
84
+ ## Jump-to Navigation Component
85
+
86
+ | Below you will find an interactive Storybook iframe for the Jump-to Navigation. 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:** NavigationJumpTo |
87
+ | --- | --- | --- |
88
+
89
+ ---
90
+
91
+ ### NavigationJumpTo
92
+
93
+ Default
94
+
95
+ ---
96
+
97
+ Navigation components enable users to move around an application, either between pages or within the same page, and help facilitate users' abilities to find relevant content and tools.
98
+
99
+ ## Guidelines
100
+
101
+ ## Navigation Components
102
+
103
+ | Header and Footer Navigation provide the primary means for users to move between the top-level pages of an application as well as access important sections and links to relevant external content; they always sit at the top and bottom of the page respectively. Jump-to Navigation enables users to move between main sections on a single page, making it easy for users to traverse large amounts of content. | | **Jump to component:** Header Navigation Footer Navigation Jump-to Navigation |
104
+ | --- | --- | --- |
105
+
106
+ ### Visual Preview
107
+
108
+ ---
109
+
110
+ ## Header Navigation
111
+
112
+ | | In Figma | | | Meets Accessibility | | | In Code |
113
+ | --- | --- | --- | --- | --- | --- | --- | --- |
114
+
115
+ ### Live Instance
116
+
117
+ Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
118
+
119
+ Default
120
+
121
+ ---
122
+
123
+ ### Header Navigation Anatomy
124
+
125
+ Header Navigation contains the following elements:
126
+
127
+ * Logo – when clicked, brings users back to the main landing page of the application
128
+ * Primary navigation group – contains navigation items that serve as the way users move between the main pages of the application
129
+ * Secondary navigation group – contains navigation items that are used to link out to relevant external sites, help or FAQ pages, tutorials, additional resources, etc.
130
+ * Optionally, secondary navigation items can display sub-navigation items when additional navigation options within the same category are needed
131
+ * Buttons – can be used for application-level tasks, account login and management, etc.
132
+ * Search Input – searches across the entire application
133
+
134
+ All elements besides the logo section are optional and their usage should be determined by the application's information architecture.
135
+
136
+ Header Navigation can optionally be displayed using an inverted color scheme for better contrast or for stylistic reasons.
137
+
138
+ #### Wide
139
+
140
+ #### Narrow
141
+
142
+ ---
143
+
144
+ ### Header Navigation Types
145
+
146
+ Once implemented into an application, the Header Navigation type displayed will be automatically determined by the user's viewport width; the point at which one type is displayed over the other can be manually adjusted in code.
147
+
148
+ ---
149
+
150
+ ### Header Navigation – Wide
151
+
152
+ Use Wide when pages are being displayed at a **Large** or **Medium** breakpoint (though in some cases Header Navigation – Narrow may be preferable for Medium breakpoints; see Responsive Design for more information).
153
+
154
+ The arrangement of the primary navigation group and the Search Input can be flipped depending on the application's navigation needs.
155
+
156
+ | Default | Default (inverted) |
157
+ | --- | --- |
158
+
159
+ #### Primary Navigation Items
160
+
161
+ | Default | Default (expandable) | Hover | Hover (expandable) | Selected | Open (expandable) |
162
+ | --- | --- | --- | --- | --- | --- |
163
+
164
+ #### Secondary Navigation Items
165
+
166
+ | Default | Default (expandable) | Hover | Hover (expandable) | Pressed | Open (expandable) |
167
+ | --- | --- | --- | --- | --- | --- |
168
+
169
+ ---
170
+
171
+ ### Header Navigation – Narrow
172
+
173
+ Use Narrow when pages are being displayed at a **Small** breakpoint (though in some cases a Header Navigation – Narrow may be preferable for Medium breakpoints; see Responsive Design for more information).
174
+
175
+ | Default (closed) | Default (closed; inverted) | Default (open) | Default (open; inverted) |
176
+ | --- | --- | --- | --- |
177
+
178
+ #### Primary Navigation Items
179
+
180
+ | Default | Default (collapsed) | Default (expanded) | Hover | Hover (collapsed) | Hover (expanded) | Active |
181
+ | --- | --- | --- | --- | --- | --- | --- |
182
+
183
+ #### Primary Sub-navigation Items
184
+
185
+ | Default | Hover |
186
+ | --- | --- |
187
+
188
+ #### Secondary Navigation Items
189
+
190
+ | Default | Default (collapsed) | Default (expanded) | Hover | Hover (collapsed) | Hover (expanded) |
191
+ | --- | --- | --- | --- | --- | --- |
192
+
193
+ #### Secondary Sub-navigation Items
194
+
195
+ | Default | Hover |
196
+ | --- | --- |
197
+
198
+ ---
199
+
200
+ ## Footer Navigation
201
+
202
+ | | In Figma | | | Meets Accessibility | | | In Code |
203
+ | --- | --- | --- | --- | --- | --- | --- | --- |
204
+
205
+ ### Live Instance
206
+
207
+ Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
208
+
209
+ Default
210
+
211
+ ---
212
+
213
+ ### Footer Navigation Anatomy
214
+
215
+ Footer Navigation contains the following elements:
216
+
217
+ * Primary logo – when clicked, brings users back to the main landing page of the application
218
+ * Secondary logo group – for logos of partner institutions or other entities
219
+ * Navigation group – contains navigation items that serve as the way users move between the pages of the application
220
+ * It is recommended, though not required, that the Navigation Items in Navigation Footer match the Navigation Items found in the Primary Navigation group in Navigation Header, making for unified navigation across the application
221
+ * Link group – contains links to tertiary pages like Terms of Service, Privacy Policies, etc.
222
+
223
+ All elements besides the logo section are optional and their usage should be determined by the application's information architecture.
224
+
225
+ Header Navigation can optionally be displayed using an inverted color scheme for better contrast or for stylistic reasons.
226
+
227
+ #### Wide
228
+
229
+ #### Narrow
230
+
231
+ ---
232
+
233
+ ### Footer Navigation Types
234
+
235
+ Once implemented into an application, the Footer Navigation type displayed will be automatically determined by the user's viewport width; the point at which one type is displayed over the other can be manually adjusted in code.
236
+
237
+ ---
238
+
239
+ ### Footer Navigation – Wide
240
+
241
+ Use Wide when pages are being displayed at a **Large** or **Medium** breakpoint (though in some cases Footer Navigation – Narrow may be preferable for Medium breakpoints; see Responsive Design for more information).
242
+
243
+ | Default | Default (inverted) |
244
+ | --- | --- |
245
+
246
+ #### Navigation Items
247
+
248
+ | Default | Hover | Pressed |
249
+ | --- | --- | --- |
250
+
251
+ #### Link Items
252
+
253
+ | Default | Hover | Pressed |
254
+ | --- | --- | --- |
255
+
256
+ ---
257
+
258
+ ### Footer Navigation – Narrow
259
+
260
+ Use Narrow when pages are being displayed at a **Small** breakpoint (though in some cases a Footer Navigation – Narrow may be preferable for Medium breakpoints; see Responsive Design for more information).
261
+
262
+ | Default | Default (inverted) |
263
+ | --- | --- |
264
+
265
+ #### Navigation Items
266
+
267
+ | Default | Hover | Pressed |
268
+ | --- | --- | --- |
269
+
270
+ #### Link Items
271
+
272
+ | Default | Hover | Pressed |
273
+ | --- | --- | --- |
274
+
275
+ ---
276
+
277
+ ## Jump-to Navigation
278
+
279
+ | | In Figma | | | Meets Accessibility | | | In Code |
280
+ | --- | --- | --- | --- | --- | --- | --- | --- |
281
+
282
+ ### Live Instance
283
+
284
+ Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
285
+
286
+ Default
287
+
288
+ ---
289
+
290
+ ### Overview
291
+
292
+ The Jump-to Navigation component can contain as many Nav Items as necessary though must have a minimum of two. Each Nav Item is tied to a a section of the page and functions as a jump link to that page section. It is positioned on the right side of the page, anchored to the top of the page’s first paragraph and remains sticky on the page as the user scrolls; once the user scrolls into a new section, the active indicator on that section is highlighted until the user scrolls beyond it and into the next (or previous) at which point the indictor moves again. When the user clicks on any of the Nav Items, the page will smooth scroll to that section of the page.
293
+
294
+ | Default / Active | Hover |
295
+ | --- | --- |
296
+
297
+ ---
298
+
299
+ ### Jump-to Navigation Spacing
300
+
301
+ These rules establish how much margin should exist between and around elements.
302
+
303
+ ## Code
304
+
305
+ ## Navigation Components
306
+
307
+ | Header and Footer Navigation provide the primary means for users to move between the top-level pages of an application as well as access important sections and links to relevant external content; they always sit at the top and bottom of the page respectively. Jump-to Navigation enables users to move between main sections on a single page, making it easy for users to traverse large amounts of content. | | **Jump to component:** NavigationHeader NavigationFooter NavigationJumpTo |
308
+ | --- | --- | --- |
309
+
310
+ ### Visual Preview
311
+
312
+ >**Note:** The code examples below must install dependencies before displaying and may take extra time to load
313
+
314
+ ---
315
+
316
+ ## NavigationHeader
317
+
318
+ ### SDS Source Code
319
+
320
+ The component's source code in the SDS codebase can be found here.
321
+
322
+ ### Props
323
+
324
+ Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
325
+
326
+ | Name | Type | Default | Description |
327
+ | --- | --- | --- | --- |
328
+ | `activePrimaryNavKey` | `string` | - | The key of the currently active primary navigation item. |
329
+ | `setActivePrimaryNavKey` | `(key: string) => void` | - | Callback function to set the active primary navigation key. |
330
+ | `buttons` | `ButtonProps[]` | - | An array of buttons displayed in the header. |
331
+ | `hasInvertedStyle` | `boolean` | `false` | When set to `true`, applies an inverted color scheme to the header component. |
332
+ | `logo` | `ReactNode` | - | The logo displayed in the header. Can be an image, icon, svg or any ReactNode. |
333
+ | `logoUrl` | `string` | - | URL for the logo link. If provided, clicking the logo navigates to this URL. |
334
+ | `logoLinkComponent` | `ElementType` | `a` | Specifies the component to use for the logo link. |
335
+ | `logoLinkProps` | `LinkProps` | - | Props to pass to the logo link component. |
336
+ | `primaryNavItems` | `NavigationHeaderPrimaryNavItem<T>[]` | - | List of items for the primary navigation section. |
337
+ | `primaryNavPosition` | `"left"` |`"right"` | `"left"` | Position of the primaryNavItems list. If set to `"left"`, the items appear to the left of the search bar. If set to `"right"`, they are positioned next to the secondaryNavItems on the right. |
338
+ | `position` | `string` | `"sticky"` | Specifies the CSS position value for the NavigationHeader. Accepts any valid CSS position value (e.g., "relative", "absolute", "fixed"). By default, it uses "sticky" to keep the header fixed at the top of the page while scrolling. |
339
+ | `showSearch` | `boolean` | `true` | Whether to display the search input in the header. |
340
+ | `searchProps` | `Partial<InputSearchProps>` | - | Props passed to the search input component. |
341
+ | `secondaryNavItems` | `NavigationHeaderSecondaryNavItem[]` | - | List of items for the secondary navigation section. |
342
+ | `scrollElevation` | `boolean` | `true` | Controls whether a shadow is shown under the Nav when scrolling. |
343
+ | `tag` | `string` | - | A small label displayed next to the title. |
344
+ | `tagColor` | `| "info"` `| "positive"` `| "notice"` `| "negative"` `| "neutral"` `| "beta"` `| [string, string]` `| [string, string, string]` | `neutral` | The color of the tag label. |
345
+ | `title` | `string` | - | The main title displayed in the header. |
346
+
347
+ >**Important Note!**
348
+ >
349
+ >The NavigationHeader component automatically switches to a mobile-friendly version when there isn’t enough space to display the full header.
350
+
351
+ ### Code examples
352
+
353
+ The example below shows a NavigationHeader component with all the possible sections available.
354
+
355
+ >**Note:** Due to a bug in Zeroheight we are unable to publish code examples at this time; we will update this section once a fix is released.
356
+
357
+ ---
358
+
359
+ ## NavigationFooter
360
+
361
+ ### SDS Source Code
362
+
363
+ The component's source code in the SDS codebase can be found here.
364
+
365
+ ### Props
366
+
367
+ Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
368
+
369
+ | Name | Type | Default | Description |
370
+ | --- | --- | --- | --- |
371
+ | `hasInvertedStyle` | `boolean` | `false` | If true, applies an inverted (dark-on-light) color scheme to the footer. |
372
+ | `images` | `FooterImage[]` | `-` | An array of images displayed in the footer. Each item includes an image, optional link URL, and component. |
373
+ | `logo` | `ReactNode` | `-` | The logo displayed in the footer. Can be any valid React node such as an image, icon, or SVG. |
374
+ | `logoUrl` | `string` | `-` | If provided, clicking the logo will navigate to this URL. |
375
+ | `logoComponent` | `ElementType` | `"a"` | Specifies the component to use for the logo link. Defaults to an anchor tag. |
376
+ | `logoLinkProps` | `Record<string, unknown>` | `-` | Additional props passed to the logo link component. |
377
+ | `navItems` | `NavigationFooterNavItem[]` | `-` | List of navigation items displayed next to the logo. |
378
+ | `navLinks` | `NavigationFooterNavItem[]` | `-` | List of secondary links shown at the bottom section of the footer. |
379
+ | `tag` | `string` | `-` | A small label displayed next to the title. |
380
+ | `tagColor` | `TagProps["tagColor"]` | `"neutral"` | The color of the tag. Accepts predefined tag color values from the Tag component. |
381
+ | `title` | `string` | `-` | The main title displayed in the footer. |
382
+
383
+ ### FooterImage
384
+
385
+ | Name | Type | Default | Description |
386
+ | --- | --- | --- | --- |
387
+ | `image` | `ReactNode` | `-` | The image element to be displayed. Can be an icon, image, SVG, or any ReactNode. |
388
+ | `url` | `string` | `-` | Optional URL to navigate to when the image is clicked. |
389
+ | `component` | `ElementType` | `"a"` | Custom link component to use for navigation (e.g., a router link). |
390
+ | `linkProps` | `Record<string, unknown>` | `-` | Additional props passed to the link component. |
391
+
392
+ ### NavigationFooterNavItem
393
+
394
+ | Name | Type | Default | Description |
395
+ | --- | --- | --- | --- |
396
+ | `label` | `string` | `-` | The text label displayed for the navigation item. |
397
+ | `url` | `string` | `-` | Optional URL the item links to. |
398
+ | `component` | `ElementType` | `"a"` | Custom component to render the link (e.g., Next.js Link). |
399
+ | `linkProps` | `Record<string, unknown>` | `-` | Props forwarded to the link component. |
400
+
401
+ ### Code examples
402
+
403
+ >**Note:** Due to a bug in Zeroheight we are unable to publish code examples at this time; we will update this section once a fix is released.
404
+
405
+ ---
406
+
407
+ ## NavigationJumpTo
408
+
409
+ ### SDS Source Code
410
+
411
+ The component's source code in the SDS codebase can be found here.
412
+
413
+ ### SDS vs MUI
414
+
415
+ SDS's `NavigationJumpTo` uses MUI's `Tab` component under the hood. `NavigationJumpTo` acts as an indicator of where a user is on a page as well as allowing them to navigate to different page sections. It differs from MUI's `Tab` component in a few main ways:
416
+
417
+ **`orientation`****:** SDS's `NavigationJumpTo` design only supports `orientation="vertical"`, which is baked into its code by default, whereas the default `orientation` value for MUI's `Tab` component is `horizontal`. Setting `orientation="horizontal"` on `NaviagationJumpTo` is not recommended.
418
+
419
+ **`textColor`****:** Changing the text color of a tab within `NavigationJumpTo` is not currently supported. However, you can still change the `indicatorColor`; it will take any of the SDS colors (`beta`, `error`, `gray`, `info`, `primary`, `success`, `warning`).
420
+
421
+ **`icon`****:** `NavigationJumpTo` does not support the inclusion of icons.
422
+
423
+ **`offsetTop`****:** This prop is exclusive to `NavigationJumpTo` and takes a number between 0 to 100. It means that a section indicator will turn on when the top of that section is the specified number of pixels below the top of the window. This is used to adjust when the section indicator moves to a different section based on the preference of a team.
424
+
425
+ ### MUI Documentation
426
+
427
+ Documentation for the underlying MUI component can be found here.
428
+
429
+ ### Props
430
+
431
+ Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
432
+
433
+ | Name | Type | Default | Description |
434
+ | --- | --- | --- | --- |
435
+ | `items` | `Array<{` `title: string;` `elementRef: React.MutableRefObject<HTMLElement | null>;` `}>;` | `-` | An array of items to be displayed in the NavigationJumpTo component. |
436
+ | `offsetTop` | `number` | `-` | The top offset for scrolling, measured in pixels comes before the target element during scrolling. |
437
+ | `onChange` | `(` `value: number,` `event?: React.SyntheticEvent,` `type?: "click" | "scroll"``) => void;` | `-` | Defines the action to be taken when the value changes. |
438
+
439
+ ### Code examples
440
+
441
+ #### Default Navigation Menu
442
+
443
+ This example shows the default props needed to render `NavigationJumpTo`.
444
+
445
+ **/styles.css**
446
+
447
+ ```css
448
+ body {
449
+ font-size: 13px;
450
+ font-weight: 400;
451
+ letter-spacing: 0.08px;
452
+ line-height: 20px;
453
+ text-transform: none;
454
+ font-family: "Inter", sans-serif;
455
+ }
456
+
457
+ h1 {
458
+ font-size: 1.5rem;
459
+ }
460
+
461
+ .app {
462
+ padding: 20px;
463
+ }
464
+ ```
465
+
466
+ **tsconfig.json**
467
+
468
+ ```json
469
+ {
470
+ "include": [
471
+ "./**/*"
472
+ ],
473
+ "compilerOptions": {
474
+ "strict": true,
475
+ "esModuleInterop": true,
476
+ "lib": [ "dom", "es2015" ],
477
+ "jsx": "react-jsx"
478
+ }
479
+ }
480
+ ```
481
+
482
+ **/App.tsx**
483
+
484
+ ```tsx
485
+ import { NavigationJumpTo } from "@czi-sds/components";
486
+ import "./styles.css";
487
+
488
+ function App() {
489
+ return (
490
+ <div className="app">
491
+ <NavigationJumpTo items={[
492
+ { elementRef: { current: null }, title: "Item 1" },
493
+ { elementRef: { current: null }, title: "Item 2" },
494
+ { elementRef: { current: null }, title: "Item 3" },
495
+ { elementRef: { current: null }, title: "Item 4" },
496
+ { elementRef: { current: null }, title: "Item 5" },
497
+ ]} />
498
+ </div>
499
+ );
500
+ }
501
+
502
+ export default App;
503
+ ```
504
+
505
+ **/index.tsx**
506
+
507
+ ```tsx
508
+ import React from "react";
509
+ import { createRoot } from "react-dom/client";
510
+ import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
511
+ import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
512
+ import { Theme } from "@czi-sds/components";
513
+ import CssBaseline from "@mui/material/CssBaseline";
514
+ import useMediaQuery from "@mui/material/useMediaQuery";
515
+
516
+ import App from "./App";
517
+
518
+ const container = document.getElementById("root");
519
+ const root = createRoot(container!);
520
+
521
+ const RootApp = () => {
522
+ const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
523
+ const theme = prefersDarkMode ? Theme("dark") : Theme("light");
524
+
525
+ return (
526
+ <StyledEngineProvider injectFirst>
527
+ <ThemeProvider theme={theme}>
528
+ <EmotionThemeProvider theme={theme}>
529
+ <CssBaseline />
530
+ <App />
531
+ </EmotionThemeProvider>
532
+ </ThemeProvider>
533
+ </StyledEngineProvider>
534
+ );
535
+ };
536
+
537
+ root.render(
538
+ <React.StrictMode>
539
+ <RootApp />
540
+ </React.StrictMode>
541
+ );
542
+
543
+ ```
544
+
545
+ **/public/index.html**
546
+
547
+ ```html
548
+ <!DOCTYPE html>
549
+ <html lang="en">
550
+ <head>
551
+ <meta charset="UTF-8" />
552
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
553
+ <title>Navigation Jump To</title>
554
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
555
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
556
+ <link
557
+ href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
558
+ rel="stylesheet"
559
+ />
560
+ <link
561
+ href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
562
+ rel="stylesheet"
563
+ />
564
+ </head>
565
+ <body>
566
+ <div id="root"></div>
567
+ </body>
568
+ </html>
569
+
570
+ ```
571
+
572
+ **/package.json**
573
+
574
+ ```json
575
+ {"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"}
576
+ ```
577
+
578
+ ---
579
+
580
+ #### Full NavigationJumpTo demo with corresponding sections
581
+
582
+ This comprehensive example demonstrates the functionality of `NavigationJumpTo` within a dynamic web page layout. The example features a series of sections with varying heights, creating a scrolling effect. Users can easily navigate between these sections using the `NavigationJumpTo` component.
583
+
584
+ **/styles.css**
585
+
586
+ ```css
587
+ body {
588
+ font-size: 13px;
589
+ font-weight: 400;
590
+ letter-spacing: 0.08px;
591
+ line-height: 20px;
592
+ text-transform: none;
593
+ font-family: "Inter", sans-serif;
594
+ }
595
+
596
+ h1 {
597
+ font-size: 1.5rem;
598
+ }
599
+
600
+ .app {
601
+ padding: 20px;
602
+ }
603
+ ```
604
+
605
+ **tsconfig.json**
606
+
607
+ ```json
608
+ {
609
+ "include": [
610
+ "./**/*"
611
+ ],
612
+ "compilerOptions": {
613
+ "strict": true,
614
+ "esModuleInterop": true,
615
+ "lib": [ "dom", "es2015" ],
616
+ "jsx": "react-jsx"
617
+ }
618
+ }
619
+ ```
620
+
621
+ **/App.tsx**
622
+
623
+ ```tsx
624
+ import { forwardRef, useState, useRef } from "react";
625
+ import { InputSlider, NavigationJumpTo, getSemanticColors } from "@czi-sds/components";
626
+ import { useTheme } from "@mui/material";
627
+ import { Box } from "@mui/material";
628
+ import "./styles.css";
629
+
630
+ interface TabPanelPropsExtra extends TabPanelProps {
631
+ sdsDemoHeight: number;
632
+ }
633
+
634
+ const TabPanel = forwardRef<HTMLDivElement, TabPanelPropsExtra>(
635
+ (props, ref) => {
636
+ const { children, sdsDemoHeight, ...other } = props;
637
+ const theme = useTheme();
638
+ const semanticColors = getSemanticColors({theme});
639
+
640
+ return (
641
+ <div
642
+ ref={ref}
643
+ role="tabpanel"
644
+ style={{
645
+ alignItems: "center",
646
+ backgroundColor: "rgba(0, 0, 0, 0.05)",
647
+ color: "black",
648
+ display: "flex",
649
+ fontFamily: "Open Sans, sans-serif",
650
+ fontSize: "36px",
651
+ fontWeight: 100,
652
+ justifyContent: "center",
653
+ margin: "0px 22px 22px 6px",
654
+ minHeight: `${sdsDemoHeight}vh`,
655
+ textAlign: "center",
656
+ }}
657
+ {...other}
658
+ >
659
+ <Box sx={{ p: 3 }}>
660
+ {children}
661
+ <p style={{ fontSize: 14, margin: "5px 0 0 0" }}>
662
+ height: {sdsDemoHeight} vh
663
+ </p>
664
+ </Box>
665
+ </div>
666
+ );
667
+ }
668
+ );
669
+
670
+ function App() {
671
+ const [navPanelHeight, setNavPanelHeight] = useState(100);
672
+ const sectionRef0 = useRef(null);
673
+ const sectionRef1 = useRef(null);
674
+ const sectionRef2 = useRef(null);
675
+ const sectionRef3 = useRef(null);
676
+ const sectionRef4 = useRef(null);
677
+
678
+ return (
679
+ <div className="app">
680
+ <Box
681
+ sx={{
682
+ fontFamily: "Open Sans, sans-serif",
683
+ margin: "0 0 30px 6px",
684
+ width: 250,
685
+ }}
686
+ >
687
+ <p id="nav-item-height-slider" style={{ marginBottom: "5px" }}>
688
+ Section panel height:
689
+ </p>
690
+ <InputSlider
691
+ aria-labelledby="nav-item-height-slider"
692
+ min={20}
693
+ max={120}
694
+ step={1}
695
+ onChange={(_, value) => {
696
+ setNavPanelHeight(value as number);
697
+ }}
698
+ defaultValue={100}
699
+ marks={[
700
+ { label: "20", value: 20 },
701
+ { label: "40", value: 40 },
702
+ { label: "60", value: 60 },
703
+ { label: "80", value: 80 },
704
+ { label: "100", value: 100 },
705
+ { label: "120", value: 120 },
706
+ ]}
707
+ />
708
+ </Box>
709
+
710
+ <Box
711
+ sx={{
712
+ display: "flex",
713
+ flexDirection: "row-reverse",
714
+ position: "relative",
715
+ width: "100%",
716
+ }}
717
+ >
718
+ <Box sx={{ width: 150 }}>
719
+ <NavigationJumpTo
720
+ items={[
721
+ { elementRef: sectionRef0, title: "Section 1" },
722
+ { elementRef: sectionRef1, title: "Section 2" },
723
+ { elementRef: sectionRef2, title: "Section 3" },
724
+ { elementRef: sectionRef3, title: "Section 4" },
725
+ { elementRef: sectionRef4, title: "Section 5" },
726
+ ]}
727
+ />
728
+ </Box>
729
+ <Box
730
+ sx={{
731
+ position: "relative",
732
+ width: "100%",
733
+ }}
734
+ >
735
+ <TabPanel
736
+ id="navigation-panel-1"
737
+ ref={sectionRef0}
738
+ sdsDemoHeight={navPanelHeight}
739
+ >
740
+ Section #1
741
+ </TabPanel>
742
+ <TabPanel
743
+ id="navigation-panel-2"
744
+ ref={sectionRef1}
745
+ sdsDemoHeight={navPanelHeight}
746
+ >
747
+ Section #2
748
+ </TabPanel>
749
+ <TabPanel
750
+ id="navigation-panel-3"
751
+ ref={sectionRef2}
752
+ sdsDemoHeight={navPanelHeight}
753
+ >
754
+ Section #3
755
+ </TabPanel>
756
+ <TabPanel
757
+ id="navigation-panel-4"
758
+ ref={sectionRef3}
759
+ sdsDemoHeight={navPanelHeight}
760
+ >
761
+ Section #4
762
+ </TabPanel>
763
+ <TabPanel
764
+ id="navigation-panel-5"
765
+ ref={sectionRef4}
766
+ sdsDemoHeight={navPanelHeight}
767
+ >
768
+ Section #5
769
+ </TabPanel>
770
+ </Box>
771
+ </Box>
772
+ </div>
773
+ );
774
+ }
775
+
776
+ export default App;
777
+ ```
778
+
779
+ **/index.tsx**
780
+
781
+ ```tsx
782
+ import React from "react";
783
+ import { createRoot } from "react-dom/client";
784
+ import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
785
+ import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
786
+ import { Theme } from "@czi-sds/components";
787
+ import CssBaseline from "@mui/material/CssBaseline";
788
+ import useMediaQuery from "@mui/material/useMediaQuery";
789
+
790
+ import App from "./App";
791
+
792
+ const container = document.getElementById("root");
793
+ const root = createRoot(container!);
794
+
795
+ const RootApp = () => {
796
+ const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
797
+ const theme = prefersDarkMode ? Theme("dark") : Theme("light");
798
+
799
+ return (
800
+ <StyledEngineProvider injectFirst>
801
+ <ThemeProvider theme={theme}>
802
+ <EmotionThemeProvider theme={theme}>
803
+ <CssBaseline />
804
+ <App />
805
+ </EmotionThemeProvider>
806
+ </ThemeProvider>
807
+ </StyledEngineProvider>
808
+ );
809
+ };
810
+
811
+ root.render(
812
+ <React.StrictMode>
813
+ <RootApp />
814
+ </React.StrictMode>
815
+ );
816
+
817
+ ```
818
+
819
+ **/public/index.html**
820
+
821
+ ```html
822
+ <!DOCTYPE html>
823
+ <html lang="en">
824
+ <head>
825
+ <meta charset="UTF-8" />
826
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
827
+ <title>Navigation Jump To</title>
828
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
829
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
830
+ <link
831
+ href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
832
+ rel="stylesheet"
833
+ />
834
+ <link
835
+ href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
836
+ rel="stylesheet"
837
+ />
838
+ </head>
839
+ <body>
840
+ <div id="root"></div>
841
+ </body>
842
+ </html>
843
+
844
+ ```
845
+
846
+ **/package.json**
847
+
848
+ ```json
849
+ {"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"}
850
+ ```
851
+
852
+ ---
853
+