@atlaskit/side-navigation 3.0.9 → 3.1.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/CHANGELOG.md +646 -366
- package/constellation/index/examples.mdx +17 -19
- package/constellation/index/usage.mdx +20 -6
- package/dist/cjs/components/NestingItem/index.js +1 -0
- package/dist/cjs/components/Section/heading-item.js +1 -1
- package/dist/es2019/components/NestingItem/index.js +1 -0
- package/dist/es2019/components/Section/heading-item.js +1 -1
- package/dist/esm/components/NestingItem/index.js +1 -0
- package/dist/esm/components/Section/heading-item.js +1 -1
- package/dist/types/components/Header/index.d.ts +1 -1
- package/dist/types/components/LoadingItems/index.d.ts +2 -2
- package/dist/types/components/NestableNavigationContent/index.d.ts +6 -6
- package/dist/types/components/NestingItem/index.d.ts +6 -6
- package/dist/types/components/Section/heading-item.d.ts +1 -1
- package/dist/types/components/Section/section.d.ts +4 -4
- package/dist/types/components/SideNavigation/index.d.ts +2 -2
- package/dist/types-ts4.5/components/Header/index.d.ts +1 -1
- package/dist/types-ts4.5/components/LoadingItems/index.d.ts +2 -2
- package/dist/types-ts4.5/components/NestableNavigationContent/index.d.ts +6 -6
- package/dist/types-ts4.5/components/NestingItem/index.d.ts +6 -6
- package/dist/types-ts4.5/components/Section/heading-item.d.ts +1 -1
- package/dist/types-ts4.5/components/Section/section.d.ts +4 -4
- package/dist/types-ts4.5/components/SideNavigation/index.d.ts +2 -2
- package/package.json +10 -9
|
@@ -16,7 +16,7 @@ import SectionExample from '../../examples/constellation/section';
|
|
|
16
16
|
|
|
17
17
|
## Default
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
This side navigation example shows all of the [components](#side-navigation-components) and [items](#side-navigation-items) composed together.
|
|
20
20
|
|
|
21
21
|
<Example Component={DefaultExample} packageName="@atlaskit/side-navigation" />
|
|
22
22
|
|
|
@@ -24,14 +24,15 @@ A side navigation example showing all [components](#side-navigation-components)
|
|
|
24
24
|
|
|
25
25
|
### Container
|
|
26
26
|
|
|
27
|
-
Uses 100% of its parent's height and width, so make sure to place it into an element with explicit values set
|
|
28
|
-
|
|
27
|
+
Uses 100% of its parent's height and width, so make sure to place it into an element with explicit values set.
|
|
28
|
+
|
|
29
|
+
The minimum width of the container is `240px`.
|
|
29
30
|
|
|
30
31
|
<Example Component={ContainerExample} packageName="@atlaskit/side-navigation" />
|
|
31
32
|
|
|
32
33
|
### Header and footer
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
Use `NavigationHeader` and `NavigationFooter` to customise the header and footer.
|
|
35
36
|
|
|
36
37
|
<Example
|
|
37
38
|
Component={HeaderAndFooterExample}
|
|
@@ -40,46 +41,47 @@ You can customise header and footer using `NavigationHeader` and `NavigationFoot
|
|
|
40
41
|
|
|
41
42
|
### Content
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
This is used as the container for [navigation items](#side-navigation-items). For nested views see the [nested navigation example](#nested-navigation).
|
|
44
45
|
|
|
45
46
|
<Example Component={ContentExample} packageName="@atlaskit/side-navigation" />
|
|
46
47
|
|
|
47
48
|
### Section
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
This is used to separate items into sections. Using the `title` prop makes a section implicitly group the items for assistive technology such as screen readers with no extra work required.
|
|
50
51
|
|
|
51
52
|
<Example Component={SectionExample} packageName="@atlaskit/side-navigation" />
|
|
52
53
|
|
|
53
54
|
### Nested navigation
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
Use `NestableNavigationContent` if you need a container for navigation items with nested views.
|
|
56
57
|
|
|
57
58
|
<Example Component={NestedExample} packageName="@atlaskit/side-navigation" />
|
|
58
59
|
|
|
59
60
|
## Side navigation items
|
|
60
61
|
|
|
61
|
-
Granular items that can be rendered as part of the navigation experience
|
|
62
|
-
|
|
62
|
+
Granular items that can be rendered as part of the navigation experience.
|
|
63
|
+
|
|
64
|
+
You must use the `Section` component to ensure consistent spacing around blocks of items.
|
|
63
65
|
|
|
64
66
|
### Go back item
|
|
65
67
|
|
|
66
|
-
|
|
68
|
+
Use the go back item to provide a customized "go back" button in nested navigations.
|
|
67
69
|
|
|
68
70
|
<Example Component={GoBackExample} packageName="@atlaskit/side-navigation" />
|
|
69
71
|
|
|
70
72
|
### Link item
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
This renders an item wrapped in an anchor tag, useful when you have an item that should navigate to another page using native browser navigation.
|
|
73
75
|
|
|
74
|
-
For custom SPA transitions use a custom item with the respective router logic, following the
|
|
76
|
+
For custom SPA transitions use a custom item with the respective router logic, following the [custom item example](#custom-item).
|
|
75
77
|
|
|
76
78
|
<Example Component={LinkItemExample} packageName="@atlaskit/side-navigation" />
|
|
77
79
|
|
|
78
80
|
### Custom item
|
|
79
81
|
|
|
80
|
-
|
|
82
|
+
This handles use cases where a custom router link component is needed.
|
|
81
83
|
|
|
82
|
-
The custom component receives all overflow props passed to the custom item component
|
|
84
|
+
The custom component receives all overflow props passed to the custom item component. When using TypeScript this will add the custom component props to the root component props type for type safety.
|
|
83
85
|
|
|
84
86
|
<Example
|
|
85
87
|
Component={CustomItemExample}
|
|
@@ -88,17 +90,13 @@ The custom component receives all overflow props passed to the custom item compo
|
|
|
88
90
|
|
|
89
91
|
### Button item
|
|
90
92
|
|
|
91
|
-
|
|
93
|
+
This renders an item wrapped in a button tag. Use this when an action does something other than navigating to another page.
|
|
92
94
|
|
|
93
95
|
<Example
|
|
94
96
|
Component={ButtonItemExample}
|
|
95
97
|
packageName="@atlaskit/side-navigation"
|
|
96
98
|
/>
|
|
97
99
|
|
|
98
|
-
### Heading item
|
|
99
|
-
|
|
100
|
-
Available for advanced use cases, for most situations providing a `title` to `Section` should be enough.
|
|
101
|
-
|
|
102
100
|
## Loading
|
|
103
101
|
|
|
104
102
|
Use loading skeletons to reduce the perceived loading time.
|
|
@@ -4,13 +4,27 @@ order: 2
|
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
+
The side navigation helps people move around within a subsection of a product. For example, navigating through the topics in a Confluence space, or to specific tasks within their Jira project.
|
|
8
|
+
|
|
9
|
+
Use the side navigation with the [page layout component](/components/page-layout/examples) to compose your navigation experience. This ensures that you get access to useful accessibility and customization features by default.
|
|
10
|
+
|
|
11
|
+
## Accessibility
|
|
12
|
+
|
|
13
|
+
- Keep nested navigation levels to a minimum. If you need to use a nested navigation, always provide a "go back" button to help people get out of the menu.
|
|
14
|
+
- Provide a unique `label` for every different navigation in the page layout. Make sure that the navigation label is meaningful and not direction-based. For example, "Current project" not "Left navigation". If it's the same navigation repeated in another place on the page layout, use the same `label`.
|
|
15
|
+
- Don't include the word "navigation" in your `label`. The `<nav>` semantics mean assistive technology will already tell people that they are using a navigation.
|
|
16
|
+
|
|
17
|
+
## Best practices
|
|
18
|
+
|
|
7
19
|
### Loading states
|
|
8
20
|
|
|
9
|
-
|
|
21
|
+
Sometimes you'll need to load some of the side navigation content asynchronously. There are a few things to keep in mind:
|
|
22
|
+
|
|
23
|
+
- Only use skeletons when you're certain of what the loaded state will look like. Most items that appear in side navigation are probably fine to use with skeletons, for example, `@atlaskit/tree`.
|
|
24
|
+
- When transitioning from loading skeleton to loaded items, try to ensure the jump doesn't look janky - use the equivalent skeleton item that is appropriate and be careful of things changing size by a few pixels. We should be striving for UI that feels **stable**, which means it doesn't jump around when content loads.
|
|
25
|
+
- Ensure loading does not take too long - try to anticipate if people will look at your menu via hover events and pre-load the data as soon as possible.
|
|
26
|
+
- When the content is loading in, make sure it all loads in at the same time - our minds aren't fast enough to distinguish each item loading individually, for example, and it appears slower to most people.
|
|
10
27
|
|
|
11
|
-
|
|
12
|
-
- When transitioning from loading skeleton to loaded items, try to ensure the jump does not look janky - use the equivalent skeleton item that is appropriate and be careful of things jumping around by a few pixels. We should be striving for UI that feels **stable**, which means it doesn't jump around when content loads.
|
|
13
|
-
- Ensure loading does not take too long - try to anticipate if a user will look at your menu via hover events and the like, and pre-load the data as soon as possible.
|
|
14
|
-
- When content is loading in, make sure it all loads in at the same time - our minds aren't fast enough to distinguish each item loading individually, for example, and it would appear slower to most users.
|
|
28
|
+
## Related
|
|
15
29
|
|
|
16
|
-
|
|
30
|
+
- Use the side navigation with the [page layout component](/components/page-layout/examples).
|
|
@@ -96,6 +96,7 @@ var NestingItem = function NestingItem(props) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
// Avoid a nesting transition if a modifier key is detected during click.
|
|
99
|
+
// @ts-expect-error - Argument of type 'MouseEvent<Element, MouseEvent> | KeyboardEvent<Element>' is not assignable to parameter of type 'MouseEvent'
|
|
99
100
|
if (isNormalClick(e)) {
|
|
100
101
|
setIsInteracted(true);
|
|
101
102
|
onNest(id);
|
|
@@ -13,7 +13,7 @@ var _context = require("../NestableNavigationContent/context");
|
|
|
13
13
|
/**
|
|
14
14
|
* __Heading item__
|
|
15
15
|
*
|
|
16
|
-
* Available for advanced use cases, for most situations providing a title to
|
|
16
|
+
* Available for advanced use cases, for most situations providing a `title` to `section` should be enough.
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
var HeadingItem = function HeadingItem(props) {
|
|
@@ -75,6 +75,7 @@ const NestingItem = props => {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
// Avoid a nesting transition if a modifier key is detected during click.
|
|
78
|
+
// @ts-expect-error - Argument of type 'MouseEvent<Element, MouseEvent> | KeyboardEvent<Element>' is not assignable to parameter of type 'MouseEvent'
|
|
78
79
|
if (isNormalClick(e)) {
|
|
79
80
|
setIsInteracted(true);
|
|
80
81
|
onNest(id);
|
|
@@ -6,7 +6,7 @@ import { useShouldNestedElementRender } from '../NestableNavigationContent/conte
|
|
|
6
6
|
/**
|
|
7
7
|
* __Heading item__
|
|
8
8
|
*
|
|
9
|
-
* Available for advanced use cases, for most situations providing a title to
|
|
9
|
+
* Available for advanced use cases, for most situations providing a `title` to `section` should be enough.
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
const HeadingItem = props => {
|
|
@@ -86,6 +86,7 @@ var NestingItem = function NestingItem(props) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
// Avoid a nesting transition if a modifier key is detected during click.
|
|
89
|
+
// @ts-expect-error - Argument of type 'MouseEvent<Element, MouseEvent> | KeyboardEvent<Element>' is not assignable to parameter of type 'MouseEvent'
|
|
89
90
|
if (isNormalClick(e)) {
|
|
90
91
|
setIsInteracted(true);
|
|
91
92
|
onNest(id);
|
|
@@ -6,7 +6,7 @@ import { useShouldNestedElementRender } from '../NestableNavigationContent/conte
|
|
|
6
6
|
/**
|
|
7
7
|
* __Heading item__
|
|
8
8
|
*
|
|
9
|
-
* Available for advanced use cases, for most situations providing a title to
|
|
9
|
+
* Available for advanced use cases, for most situations providing a `title` to `section` should be enough.
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
var HeadingItem = function HeadingItem(props) {
|
|
@@ -16,7 +16,7 @@ export type HeaderProps = {
|
|
|
16
16
|
cssFn?: CSSFn;
|
|
17
17
|
/**
|
|
18
18
|
* Element to render before the item text.
|
|
19
|
-
* Generally should be an [icon](https://
|
|
19
|
+
* Generally should be an [icon](https://atlassian.design/components/icon/icon-explorer) component.
|
|
20
20
|
*/
|
|
21
21
|
iconBefore?: React.ReactNode;
|
|
22
22
|
/**
|
|
@@ -11,8 +11,8 @@ export interface LoadingItemsProps {
|
|
|
11
11
|
*/
|
|
12
12
|
fallback: React.ReactNode;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* Use this to show either the loading fallback or the loaded contents.
|
|
15
|
+
* It will cross fade between children and fallback when the value is flipped.
|
|
16
16
|
*/
|
|
17
17
|
isLoading?: boolean;
|
|
18
18
|
/**
|
|
@@ -3,9 +3,9 @@ import { jsx } from '@emotion/react';
|
|
|
3
3
|
export declare const ROOT_ID = "ATLASKIT_NESTED_ROOT";
|
|
4
4
|
export interface NestableNavigationContentProps {
|
|
5
5
|
/**
|
|
6
|
-
* The NestableNavigationContent wraps the entire navigation hierarchy of a side
|
|
6
|
+
* The NestableNavigationContent wraps the entire navigation hierarchy of a side navigation.
|
|
7
7
|
* Using this component is only needed if you want to enable nested views with [nesting items](/packages/navigation/side-navigation/docs/nesting-item),
|
|
8
|
-
*
|
|
8
|
+
* otherwise you should use [navigation content](/packages/navigation/side-navigation/docs/navigation-content) instead.
|
|
9
9
|
*/
|
|
10
10
|
children: JSX.Element | JSX.Element[];
|
|
11
11
|
/**
|
|
@@ -19,13 +19,13 @@ export interface NestableNavigationContentProps {
|
|
|
19
19
|
*/
|
|
20
20
|
testId?: string;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* This forces the top scroll indicator to be shown. Use this prop when you need to
|
|
23
23
|
* distinctly separate the side navigation header from the side navigation content.
|
|
24
24
|
*/
|
|
25
25
|
showTopScrollIndicator?: boolean;
|
|
26
26
|
/**
|
|
27
27
|
* Array of the initial stack you want to show.
|
|
28
|
-
*
|
|
28
|
+
* This is useful when you want to set the initial nested view but don't want to opt into a controlled state.
|
|
29
29
|
* Make sure to have all intermediate navigation pages line up.
|
|
30
30
|
*/
|
|
31
31
|
initialStack?: string[];
|
|
@@ -38,13 +38,13 @@ export interface NestableNavigationContentProps {
|
|
|
38
38
|
stack?: string[];
|
|
39
39
|
/**
|
|
40
40
|
* Allows you to react based on transitions between [nesting items](/packages/navigation/side-navigation/docs/nesting-item).
|
|
41
|
-
* It will be called everytime a
|
|
41
|
+
* It will be called everytime a person navigates from one [nesting item](/packages/navigation/side-navigation/docs/nesting-item) to another,
|
|
42
42
|
* both up or down the navigation hierarchy.
|
|
43
43
|
* This prop should be used with the `stack` prop for controlled behavior.
|
|
44
44
|
*/
|
|
45
45
|
onChange?: (stack: string[]) => void;
|
|
46
46
|
/**
|
|
47
|
-
* Called when a nesting
|
|
47
|
+
* Called when a nesting ID that does not exist among `<NestingItem>`s is pushed to the stack. Use this callback to be notified when there is an undefined nesting state.
|
|
48
48
|
* Provides you with the stack which led to the undefined state, with the top of the stack (last item in array) being the invalid item.
|
|
49
49
|
*/
|
|
50
50
|
onUnknownNest?: (stack: string[]) => void;
|
|
@@ -16,8 +16,8 @@ interface NestingItemOverrides extends Overrides {
|
|
|
16
16
|
}
|
|
17
17
|
export interface NestingItemProps<TCustomComponentProps = CustomItemComponentProps> {
|
|
18
18
|
/**
|
|
19
|
-
* A
|
|
20
|
-
* Every nesting item component needs a unique
|
|
19
|
+
* A unique identifier for the nesting item.
|
|
20
|
+
* Every nesting item component needs a unique ID, or else undefined behavior will occur.
|
|
21
21
|
*/
|
|
22
22
|
id: string;
|
|
23
23
|
/**
|
|
@@ -52,16 +52,16 @@ export interface NestingItemProps<TCustomComponentProps = CustomItemComponentPro
|
|
|
52
52
|
cssFn?: CSSFn;
|
|
53
53
|
/**
|
|
54
54
|
* Element to render before the item text.
|
|
55
|
-
* Generally should be an [icon](https://
|
|
55
|
+
* Generally should be an [icon](https://atlassian.design/components/icon/icon-explorer) component.
|
|
56
56
|
*/
|
|
57
57
|
iconBefore?: React.ReactNode;
|
|
58
58
|
/**
|
|
59
59
|
* Element to render after the item text.
|
|
60
|
-
* Generally should be an [icon](https://
|
|
60
|
+
* Generally should be an [icon](https://atlassian.design/components/icon/icon-explorer) component.
|
|
61
61
|
*/
|
|
62
62
|
iconAfter?: React.ReactNode;
|
|
63
63
|
/**
|
|
64
|
-
* Event that is triggered when the element
|
|
64
|
+
* Event that is triggered when a person clicks the element.
|
|
65
65
|
*/
|
|
66
66
|
onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
67
67
|
/**
|
|
@@ -70,7 +70,7 @@ export interface NestingItemProps<TCustomComponentProps = CustomItemComponentPro
|
|
|
70
70
|
*/
|
|
71
71
|
description?: string | JSX.Element;
|
|
72
72
|
/**
|
|
73
|
-
* Makes the element appear disabled
|
|
73
|
+
* Makes the element appear disabled and removes interactivity. Be aware that disabled UI does not appear to people who use assistive technology, so avoid using this if it still needs to appear in the tab order.
|
|
74
74
|
*/
|
|
75
75
|
isDisabled?: boolean;
|
|
76
76
|
/**
|
|
@@ -4,7 +4,7 @@ export type { HeadingItemProps } from '@atlaskit/menu';
|
|
|
4
4
|
/**
|
|
5
5
|
* __Heading item__
|
|
6
6
|
*
|
|
7
|
-
* Available for advanced use cases, for most situations providing a title to
|
|
7
|
+
* Available for advanced use cases, for most situations providing a `title` to `section` should be enough.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
declare const HeadingItem: (props: HeadingItemProps) => JSX.Element | null;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface SectionProps {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* should generally be item or heading components.
|
|
4
|
+
* The children of the section.
|
|
5
|
+
* These should generally be item or heading components.
|
|
6
6
|
*/
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
/**
|
|
9
9
|
* The text passed to heading.
|
|
10
|
-
* If a title
|
|
10
|
+
* If you don't provide a title, then the heading won't be rendered.
|
|
11
11
|
*/
|
|
12
12
|
title?: string;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* This will render a border at the top of the section.
|
|
15
15
|
*/
|
|
16
16
|
hasSeparator?: boolean;
|
|
17
17
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface SideNavigationProps {
|
|
3
3
|
/**
|
|
4
|
-
* Describes the specific role of this navigation component for
|
|
5
|
-
*
|
|
4
|
+
* Describes the specific role of this navigation component for people viewing the page with assistive technology.
|
|
5
|
+
* This differentiates the navigation from other navigation components on a page.
|
|
6
6
|
*/
|
|
7
7
|
label: string;
|
|
8
8
|
/**
|
|
@@ -16,7 +16,7 @@ export type HeaderProps = {
|
|
|
16
16
|
cssFn?: CSSFn;
|
|
17
17
|
/**
|
|
18
18
|
* Element to render before the item text.
|
|
19
|
-
* Generally should be an [icon](https://
|
|
19
|
+
* Generally should be an [icon](https://atlassian.design/components/icon/icon-explorer) component.
|
|
20
20
|
*/
|
|
21
21
|
iconBefore?: React.ReactNode;
|
|
22
22
|
/**
|
|
@@ -11,8 +11,8 @@ export interface LoadingItemsProps {
|
|
|
11
11
|
*/
|
|
12
12
|
fallback: React.ReactNode;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* Use this to show either the loading fallback or the loaded contents.
|
|
15
|
+
* It will cross fade between children and fallback when the value is flipped.
|
|
16
16
|
*/
|
|
17
17
|
isLoading?: boolean;
|
|
18
18
|
/**
|
|
@@ -3,9 +3,9 @@ import { jsx } from '@emotion/react';
|
|
|
3
3
|
export declare const ROOT_ID = "ATLASKIT_NESTED_ROOT";
|
|
4
4
|
export interface NestableNavigationContentProps {
|
|
5
5
|
/**
|
|
6
|
-
* The NestableNavigationContent wraps the entire navigation hierarchy of a side
|
|
6
|
+
* The NestableNavigationContent wraps the entire navigation hierarchy of a side navigation.
|
|
7
7
|
* Using this component is only needed if you want to enable nested views with [nesting items](/packages/navigation/side-navigation/docs/nesting-item),
|
|
8
|
-
*
|
|
8
|
+
* otherwise you should use [navigation content](/packages/navigation/side-navigation/docs/navigation-content) instead.
|
|
9
9
|
*/
|
|
10
10
|
children: JSX.Element | JSX.Element[];
|
|
11
11
|
/**
|
|
@@ -19,13 +19,13 @@ export interface NestableNavigationContentProps {
|
|
|
19
19
|
*/
|
|
20
20
|
testId?: string;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* This forces the top scroll indicator to be shown. Use this prop when you need to
|
|
23
23
|
* distinctly separate the side navigation header from the side navigation content.
|
|
24
24
|
*/
|
|
25
25
|
showTopScrollIndicator?: boolean;
|
|
26
26
|
/**
|
|
27
27
|
* Array of the initial stack you want to show.
|
|
28
|
-
*
|
|
28
|
+
* This is useful when you want to set the initial nested view but don't want to opt into a controlled state.
|
|
29
29
|
* Make sure to have all intermediate navigation pages line up.
|
|
30
30
|
*/
|
|
31
31
|
initialStack?: string[];
|
|
@@ -38,13 +38,13 @@ export interface NestableNavigationContentProps {
|
|
|
38
38
|
stack?: string[];
|
|
39
39
|
/**
|
|
40
40
|
* Allows you to react based on transitions between [nesting items](/packages/navigation/side-navigation/docs/nesting-item).
|
|
41
|
-
* It will be called everytime a
|
|
41
|
+
* It will be called everytime a person navigates from one [nesting item](/packages/navigation/side-navigation/docs/nesting-item) to another,
|
|
42
42
|
* both up or down the navigation hierarchy.
|
|
43
43
|
* This prop should be used with the `stack` prop for controlled behavior.
|
|
44
44
|
*/
|
|
45
45
|
onChange?: (stack: string[]) => void;
|
|
46
46
|
/**
|
|
47
|
-
* Called when a nesting
|
|
47
|
+
* Called when a nesting ID that does not exist among `<NestingItem>`s is pushed to the stack. Use this callback to be notified when there is an undefined nesting state.
|
|
48
48
|
* Provides you with the stack which led to the undefined state, with the top of the stack (last item in array) being the invalid item.
|
|
49
49
|
*/
|
|
50
50
|
onUnknownNest?: (stack: string[]) => void;
|
|
@@ -16,8 +16,8 @@ interface NestingItemOverrides extends Overrides {
|
|
|
16
16
|
}
|
|
17
17
|
export interface NestingItemProps<TCustomComponentProps = CustomItemComponentProps> {
|
|
18
18
|
/**
|
|
19
|
-
* A
|
|
20
|
-
* Every nesting item component needs a unique
|
|
19
|
+
* A unique identifier for the nesting item.
|
|
20
|
+
* Every nesting item component needs a unique ID, or else undefined behavior will occur.
|
|
21
21
|
*/
|
|
22
22
|
id: string;
|
|
23
23
|
/**
|
|
@@ -52,16 +52,16 @@ export interface NestingItemProps<TCustomComponentProps = CustomItemComponentPro
|
|
|
52
52
|
cssFn?: CSSFn;
|
|
53
53
|
/**
|
|
54
54
|
* Element to render before the item text.
|
|
55
|
-
* Generally should be an [icon](https://
|
|
55
|
+
* Generally should be an [icon](https://atlassian.design/components/icon/icon-explorer) component.
|
|
56
56
|
*/
|
|
57
57
|
iconBefore?: React.ReactNode;
|
|
58
58
|
/**
|
|
59
59
|
* Element to render after the item text.
|
|
60
|
-
* Generally should be an [icon](https://
|
|
60
|
+
* Generally should be an [icon](https://atlassian.design/components/icon/icon-explorer) component.
|
|
61
61
|
*/
|
|
62
62
|
iconAfter?: React.ReactNode;
|
|
63
63
|
/**
|
|
64
|
-
* Event that is triggered when the element
|
|
64
|
+
* Event that is triggered when a person clicks the element.
|
|
65
65
|
*/
|
|
66
66
|
onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
67
67
|
/**
|
|
@@ -70,7 +70,7 @@ export interface NestingItemProps<TCustomComponentProps = CustomItemComponentPro
|
|
|
70
70
|
*/
|
|
71
71
|
description?: string | JSX.Element;
|
|
72
72
|
/**
|
|
73
|
-
* Makes the element appear disabled
|
|
73
|
+
* Makes the element appear disabled and removes interactivity. Be aware that disabled UI does not appear to people who use assistive technology, so avoid using this if it still needs to appear in the tab order.
|
|
74
74
|
*/
|
|
75
75
|
isDisabled?: boolean;
|
|
76
76
|
/**
|
|
@@ -4,7 +4,7 @@ export type { HeadingItemProps } from '@atlaskit/menu';
|
|
|
4
4
|
/**
|
|
5
5
|
* __Heading item__
|
|
6
6
|
*
|
|
7
|
-
* Available for advanced use cases, for most situations providing a title to
|
|
7
|
+
* Available for advanced use cases, for most situations providing a `title` to `section` should be enough.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
declare const HeadingItem: (props: HeadingItemProps) => JSX.Element | null;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface SectionProps {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* should generally be item or heading components.
|
|
4
|
+
* The children of the section.
|
|
5
|
+
* These should generally be item or heading components.
|
|
6
6
|
*/
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
/**
|
|
9
9
|
* The text passed to heading.
|
|
10
|
-
* If a title
|
|
10
|
+
* If you don't provide a title, then the heading won't be rendered.
|
|
11
11
|
*/
|
|
12
12
|
title?: string;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* This will render a border at the top of the section.
|
|
15
15
|
*/
|
|
16
16
|
hasSeparator?: boolean;
|
|
17
17
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface SideNavigationProps {
|
|
3
3
|
/**
|
|
4
|
-
* Describes the specific role of this navigation component for
|
|
5
|
-
*
|
|
4
|
+
* Describes the specific role of this navigation component for people viewing the page with assistive technology.
|
|
5
|
+
* This differentiates the navigation from other navigation components on a page.
|
|
6
6
|
*/
|
|
7
7
|
label: string;
|
|
8
8
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/side-navigation",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "A highly composable side navigation component that supports nested views.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -26,22 +26,23 @@
|
|
|
26
26
|
"website": {
|
|
27
27
|
"name": "Side navigation",
|
|
28
28
|
"category": "Components"
|
|
29
|
-
}
|
|
29
|
+
},
|
|
30
|
+
"runReact18": true
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
|
-
"@atlaskit/ds-explorations": "^3.
|
|
33
|
-
"@atlaskit/ds-lib": "^2.
|
|
33
|
+
"@atlaskit/ds-explorations": "^3.5.0",
|
|
34
|
+
"@atlaskit/ds-lib": "^2.3.0",
|
|
34
35
|
"@atlaskit/icon": "^22.1.0",
|
|
35
|
-
"@atlaskit/menu": "^2.
|
|
36
|
+
"@atlaskit/menu": "^2.2.0",
|
|
36
37
|
"@atlaskit/motion": "^1.5.0",
|
|
37
|
-
"@atlaskit/primitives": "^5.
|
|
38
|
-
"@atlaskit/theme": "^12.
|
|
39
|
-
"@atlaskit/tokens": "^1.
|
|
38
|
+
"@atlaskit/primitives": "^5.7.0",
|
|
39
|
+
"@atlaskit/theme": "^12.7.0",
|
|
40
|
+
"@atlaskit/tokens": "^1.44.0",
|
|
40
41
|
"@babel/runtime": "^7.0.0",
|
|
41
42
|
"@emotion/react": "^11.7.1"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
|
-
"react": "^16.8.0"
|
|
45
|
+
"react": "^16.8.0 || ^17.0.0 || ~18.2.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@af/accessibility-testing": "*",
|