@atlaskit/side-navigation 1.1.2
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 +517 -0
- package/LICENSE +13 -0
- package/README.md +16 -0
- package/build/tsconfig.json +17 -0
- package/codemods/0.8.0-change-css-fn-prop.ts +184 -0
- package/codemods/__tests__/0.8.0-change-css-fn-prop.ts +360 -0
- package/codemods/helpers/generic.ts +674 -0
- package/dist/cjs/common/constants.js +10 -0
- package/dist/cjs/common/styles.js +104 -0
- package/dist/cjs/components/Footer/index.js +67 -0
- package/dist/cjs/components/Header/index.js +73 -0
- package/dist/cjs/components/Item/button-item.js +47 -0
- package/dist/cjs/components/Item/custom-item.js +52 -0
- package/dist/cjs/components/Item/go-back-item.js +65 -0
- package/dist/cjs/components/Item/index.js +47 -0
- package/dist/cjs/components/Item/link-item.js +47 -0
- package/dist/cjs/components/Item/skeleton-item.js +43 -0
- package/dist/cjs/components/LoadingItems/index.js +51 -0
- package/dist/cjs/components/NavigationContent/index.js +52 -0
- package/dist/cjs/components/NavigationContent/styles.js +152 -0
- package/dist/cjs/components/NavigationFooter/index.js +27 -0
- package/dist/cjs/components/NavigationHeader/index.js +27 -0
- package/dist/cjs/components/NestableNavigationContent/context.js +51 -0
- package/dist/cjs/components/NestableNavigationContent/index.js +182 -0
- package/dist/cjs/components/NestableNavigationContent/nesting-motion.js +40 -0
- package/dist/cjs/components/NestingItem/hack-for-ert.js +8 -0
- package/dist/cjs/components/NestingItem/index.js +173 -0
- package/dist/cjs/components/NestingItem/styles.js +47 -0
- package/dist/cjs/components/Section/heading-item.js +35 -0
- package/dist/cjs/components/Section/index.js +31 -0
- package/dist/cjs/components/Section/section.js +45 -0
- package/dist/cjs/components/Section/skeleton-heading-item.js +39 -0
- package/dist/cjs/components/SideNavigation/index.js +41 -0
- package/dist/cjs/components/index.js +131 -0
- package/dist/cjs/index.js +131 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/common/constants.js +2 -0
- package/dist/es2019/common/styles.js +78 -0
- package/dist/es2019/components/Footer/index.js +52 -0
- package/dist/es2019/components/Header/index.js +46 -0
- package/dist/es2019/components/Item/button-item.js +25 -0
- package/dist/es2019/components/Item/custom-item.js +31 -0
- package/dist/es2019/components/Item/go-back-item.js +34 -0
- package/dist/es2019/components/Item/index.js +5 -0
- package/dist/es2019/components/Item/link-item.js +25 -0
- package/dist/es2019/components/Item/skeleton-item.js +28 -0
- package/dist/es2019/components/LoadingItems/index.js +38 -0
- package/dist/es2019/components/NavigationContent/index.js +38 -0
- package/dist/es2019/components/NavigationContent/styles.js +120 -0
- package/dist/es2019/components/NavigationFooter/index.js +18 -0
- package/dist/es2019/components/NavigationHeader/index.js +20 -0
- package/dist/es2019/components/NestableNavigationContent/context.js +41 -0
- package/dist/es2019/components/NestableNavigationContent/index.js +148 -0
- package/dist/es2019/components/NestableNavigationContent/nesting-motion.js +21 -0
- package/dist/es2019/components/NestingItem/hack-for-ert.js +1 -0
- package/dist/es2019/components/NestingItem/index.js +128 -0
- package/dist/es2019/components/NestingItem/styles.js +39 -0
- package/dist/es2019/components/Section/heading-item.js +22 -0
- package/dist/es2019/components/Section/index.js +3 -0
- package/dist/es2019/components/Section/section.js +25 -0
- package/dist/es2019/components/Section/skeleton-heading-item.js +24 -0
- package/dist/es2019/components/SideNavigation/index.js +30 -0
- package/dist/es2019/components/index.js +11 -0
- package/dist/es2019/index.js +3 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/common/constants.js +2 -0
- package/dist/esm/common/styles.js +82 -0
- package/dist/esm/components/Footer/index.js +51 -0
- package/dist/esm/components/Header/index.js +50 -0
- package/dist/esm/components/Item/button-item.js +25 -0
- package/dist/esm/components/Item/custom-item.js +31 -0
- package/dist/esm/components/Item/go-back-item.js +41 -0
- package/dist/esm/components/Item/index.js +5 -0
- package/dist/esm/components/Item/link-item.js +25 -0
- package/dist/esm/components/Item/skeleton-item.js +29 -0
- package/dist/esm/components/LoadingItems/index.js +39 -0
- package/dist/esm/components/NavigationContent/index.js +37 -0
- package/dist/esm/components/NavigationContent/styles.js +130 -0
- package/dist/esm/components/NavigationFooter/index.js +17 -0
- package/dist/esm/components/NavigationHeader/index.js +18 -0
- package/dist/esm/components/NestableNavigationContent/context.js +36 -0
- package/dist/esm/components/NestableNavigationContent/index.js +163 -0
- package/dist/esm/components/NestableNavigationContent/nesting-motion.js +28 -0
- package/dist/esm/components/NestingItem/hack-for-ert.js +1 -0
- package/dist/esm/components/NestingItem/index.js +144 -0
- package/dist/esm/components/NestingItem/styles.js +34 -0
- package/dist/esm/components/Section/heading-item.js +21 -0
- package/dist/esm/components/Section/index.js +3 -0
- package/dist/esm/components/Section/section.js +24 -0
- package/dist/esm/components/Section/skeleton-heading-item.js +25 -0
- package/dist/esm/components/SideNavigation/index.js +28 -0
- package/dist/esm/components/index.js +11 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/styles.d.ts +10 -0
- package/dist/types/components/Footer/index.d.ts +4 -0
- package/dist/types/components/Header/index.d.ts +43 -0
- package/dist/types/components/Item/button-item.d.ts +5 -0
- package/dist/types/components/Item/custom-item.d.ts +13 -0
- package/dist/types/components/Item/go-back-item.d.ts +5 -0
- package/dist/types/components/Item/index.d.ts +10 -0
- package/dist/types/components/Item/link-item.d.ts +5 -0
- package/dist/types/components/Item/skeleton-item.d.ts +4 -0
- package/dist/types/components/LoadingItems/index.d.ts +30 -0
- package/dist/types/components/NavigationContent/index.d.ts +17 -0
- package/dist/types/components/NavigationContent/styles.d.ts +91 -0
- package/dist/types/components/NavigationFooter/index.d.ts +7 -0
- package/dist/types/components/NavigationHeader/index.d.ts +5 -0
- package/dist/types/components/NestableNavigationContent/context.d.ts +20 -0
- package/dist/types/components/NestableNavigationContent/index.d.ts +58 -0
- package/dist/types/components/NestableNavigationContent/nesting-motion.d.ts +18 -0
- package/dist/types/components/NestingItem/hack-for-ert.d.ts +2 -0
- package/dist/types/components/NestingItem/index.d.ts +91 -0
- package/dist/types/components/NestingItem/styles.d.ts +28 -0
- package/dist/types/components/Section/heading-item.d.ts +4 -0
- package/dist/types/components/Section/index.d.ts +6 -0
- package/dist/types/components/Section/section.d.ts +25 -0
- package/dist/types/components/Section/skeleton-heading-item.d.ts +4 -0
- package/dist/types/components/SideNavigation/index.d.ts +23 -0
- package/dist/types/components/index.d.ts +22 -0
- package/dist/types/index.d.ts +4 -0
- package/docs/00-intro.tsx +70 -0
- package/docs/01-side-navigation.tsx +33 -0
- package/docs/02-navigation-header.tsx +39 -0
- package/docs/03-navigation-content.tsx +40 -0
- package/docs/04-nestable-navigation-content.tsx +95 -0
- package/docs/05-navigation-footer.tsx +38 -0
- package/docs/99-loading-states.tsx +95 -0
- package/docs/button-item.tsx +38 -0
- package/docs/custom-item.tsx +45 -0
- package/docs/go-back-item.tsx +31 -0
- package/docs/heading-item.tsx +30 -0
- package/docs/link-item.tsx +39 -0
- package/docs/nesting-item.tsx +52 -0
- package/docs/section.tsx +40 -0
- package/docs/skeleton-heading-item.tsx +30 -0
- package/docs/skeleton-item.tsx +30 -0
- package/package.json +71 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as ButtonItem } from './button-item';
|
|
2
|
+
export type { ButtonItemProps } from './button-item';
|
|
3
|
+
export { default as CustomItem } from './custom-item';
|
|
4
|
+
export type { CustomItemProps, CustomItemComponentProps } from './custom-item';
|
|
5
|
+
export { default as GoBackItem } from './go-back-item';
|
|
6
|
+
export type { GoBackItemProps } from './go-back-item';
|
|
7
|
+
export { default as LinkItem } from './link-item';
|
|
8
|
+
export type { LinkItemProps } from './link-item';
|
|
9
|
+
export { default as SkeletonItem } from './skeleton-item';
|
|
10
|
+
export type { SkeletonItemProps } from './skeleton-item';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface LoadingItemsProps {
|
|
3
|
+
/**
|
|
4
|
+
* Child items that will be loaded asynchronously.
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Fallback you want to show when loading.
|
|
9
|
+
* You'll want to use the supplied [skeleton item](/packages/navigation/side-navigation/docs/skeleton-item)
|
|
10
|
+
* or [skeleton heading item](/packages/navigation/side-navigation/docs/skeleton-heading-item) components.
|
|
11
|
+
*/
|
|
12
|
+
fallback: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Used to show either the loading fallback or the loaded contents.
|
|
15
|
+
* Will cross fade between children and fallback when this is flipped.
|
|
16
|
+
*/
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* A `testId` prop is provided for specified elements,
|
|
20
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
21
|
+
* serving as a hook for automated tests.
|
|
22
|
+
|
|
23
|
+
* Will set these elements when defined:
|
|
24
|
+
* - The entering container - `{testId}--entering`
|
|
25
|
+
* - The exiting container - `{testId}--exiting`
|
|
26
|
+
*/
|
|
27
|
+
testId?: string;
|
|
28
|
+
}
|
|
29
|
+
declare const LoadingItems: ({ children, isLoading, fallback, testId, }: LoadingItemsProps) => JSX.Element;
|
|
30
|
+
export default LoadingItems;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
export interface NavigationContentProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* Forces the top scroll indicator to be shown all the time.
|
|
7
|
+
*/
|
|
8
|
+
showTopScrollIndicator?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* A `testId` prop is provided for specified elements,
|
|
11
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
12
|
+
* serving as a hook for automated tests.
|
|
13
|
+
*/
|
|
14
|
+
testId?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const NavigationContent: import("react").ForwardRefExoticComponent<NavigationContentProps & HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>>;
|
|
17
|
+
export default NavigationContent;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
interface StyleOpts {
|
|
2
|
+
showTopScrollIndicator?: boolean;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* This outer container css contains the "real" scroll indicators which are
|
|
6
|
+
* always rendered to the screen.
|
|
7
|
+
* They are "conditionally" shown from the users perspective using the inner container CSS
|
|
8
|
+
* which has other pseudo elements which "mask" the "real" scroll indicators.
|
|
9
|
+
*/
|
|
10
|
+
export declare const outerContainerCSS: (opts: StyleOpts & {
|
|
11
|
+
scrollbarWidth: number;
|
|
12
|
+
}) => {
|
|
13
|
+
readonly display: "flex";
|
|
14
|
+
readonly height: "100%";
|
|
15
|
+
readonly overflow: "hidden";
|
|
16
|
+
readonly position: "relative";
|
|
17
|
+
readonly '&::before': {
|
|
18
|
+
readonly content: "''";
|
|
19
|
+
readonly display: "block";
|
|
20
|
+
readonly left: number;
|
|
21
|
+
readonly right: number;
|
|
22
|
+
readonly height: 2;
|
|
23
|
+
readonly borderRadius: 1;
|
|
24
|
+
readonly backgroundColor: string;
|
|
25
|
+
readonly position: "absolute";
|
|
26
|
+
readonly zIndex: 1;
|
|
27
|
+
};
|
|
28
|
+
readonly '&::after': {
|
|
29
|
+
readonly content: "''";
|
|
30
|
+
readonly position: "absolute";
|
|
31
|
+
readonly display: "block";
|
|
32
|
+
readonly borderRadius: 1;
|
|
33
|
+
readonly flexShrink: 0;
|
|
34
|
+
readonly height: 2;
|
|
35
|
+
readonly left: number;
|
|
36
|
+
readonly right: number;
|
|
37
|
+
readonly bottom: 0;
|
|
38
|
+
readonly zIndex: 1;
|
|
39
|
+
readonly backgroundColor: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* This inner container css contains the "mask" logic for the scroll indicators.
|
|
44
|
+
* Essentially they cover (mask) the "real" scroll indicators when the user is scrolled
|
|
45
|
+
* to the top or bottom of the container.
|
|
46
|
+
*/
|
|
47
|
+
export declare const innerContainerCSS: (opts: StyleOpts) => {
|
|
48
|
+
readonly '&::after': {
|
|
49
|
+
readonly borderRadius: 1;
|
|
50
|
+
readonly content: "''";
|
|
51
|
+
readonly display: "block";
|
|
52
|
+
readonly flexShrink: 0;
|
|
53
|
+
readonly height: 2;
|
|
54
|
+
readonly marginTop: "auto";
|
|
55
|
+
readonly position: "relative";
|
|
56
|
+
readonly zIndex: 2;
|
|
57
|
+
readonly backgroundColor: string;
|
|
58
|
+
};
|
|
59
|
+
readonly '&::before'?: {
|
|
60
|
+
readonly borderRadius: 1;
|
|
61
|
+
readonly content: "''";
|
|
62
|
+
readonly left: 0;
|
|
63
|
+
readonly right: 0;
|
|
64
|
+
readonly height: 2;
|
|
65
|
+
readonly backgroundColor: string;
|
|
66
|
+
readonly position: "absolute";
|
|
67
|
+
readonly display: "block";
|
|
68
|
+
readonly zIndex: 2;
|
|
69
|
+
};
|
|
70
|
+
readonly display: "flex";
|
|
71
|
+
readonly overflow: "auto";
|
|
72
|
+
readonly width: "100%";
|
|
73
|
+
readonly position: "relative";
|
|
74
|
+
readonly boxSizing: "border-box";
|
|
75
|
+
readonly flexDirection: "column";
|
|
76
|
+
};
|
|
77
|
+
export declare const containerCSS: (opts: StyleOpts) => {
|
|
78
|
+
readonly marginTop: 0 | 2;
|
|
79
|
+
readonly marginLeft: number;
|
|
80
|
+
readonly marginRight: number;
|
|
81
|
+
readonly position: "relative";
|
|
82
|
+
readonly '& [data-ds--menu--heading-item]': {
|
|
83
|
+
readonly marginTop: number;
|
|
84
|
+
readonly marginBottom: number;
|
|
85
|
+
};
|
|
86
|
+
readonly '& [data-ds--menu--skeleton-heading-item]': {
|
|
87
|
+
readonly marginTop: number;
|
|
88
|
+
readonly marginBottom: number;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface NestedContext {
|
|
3
|
+
currentStackId: string;
|
|
4
|
+
onNest: (id: string) => void;
|
|
5
|
+
onUnNest: () => void;
|
|
6
|
+
stack: string[];
|
|
7
|
+
parentId: string;
|
|
8
|
+
backButton?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const NestedContext: import("react").Context<NestedContext | undefined>;
|
|
11
|
+
export declare const useNestedContext: () => NestedContext;
|
|
12
|
+
/**
|
|
13
|
+
* Used by children of the NestableNavigationContent component to see if they should render or not.
|
|
14
|
+
* If `shouldRender` returns `true` - return your nodes.
|
|
15
|
+
* If it returns `false` - either return `null` or `children` if you have children.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useShouldNestedElementRender: () => {
|
|
18
|
+
shouldRender: boolean;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ROOT_ID = "ATLASKIT_NESTED_ROOT";
|
|
3
|
+
export interface NestableNavigationContentProps {
|
|
4
|
+
/**
|
|
5
|
+
* The NestableNavigationContent wraps the entire navigation hierarchy of a side-navigation.
|
|
6
|
+
* Using this component is only needed if you want to enable nested views with [nesting items](/packages/navigation/side-navigation/docs/nesting-item),
|
|
7
|
+
* else you should use [navigation content](/packages/navigation/side-navigation/docs/navigation-content) instead.
|
|
8
|
+
*/
|
|
9
|
+
children: JSX.Element | JSX.Element[];
|
|
10
|
+
/**
|
|
11
|
+
* A `testId` prop is provided for specified elements,
|
|
12
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
13
|
+
* serving as a hook for automated tests.
|
|
14
|
+
|
|
15
|
+
* Will set these elements when defined:
|
|
16
|
+
* - This wrapper - `{testId}`
|
|
17
|
+
* - The back item (displayed when inside a nested view) - `{testId}--go-back-item`
|
|
18
|
+
*/
|
|
19
|
+
testId?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Array of the initial stack you want to show.
|
|
22
|
+
* Useful when wanting to set the initial nested view but not wanting to opt into controlled state.
|
|
23
|
+
* Make sure to have all intermediate navigation pages line up.
|
|
24
|
+
*/
|
|
25
|
+
initialStack?: string[];
|
|
26
|
+
/**
|
|
27
|
+
* Enables you to control the stack of navigation views you want to show.
|
|
28
|
+
* Do not jump between controlled and uncontrolled else undefined behaviour will occur.
|
|
29
|
+
* This means either using `initialStack` OR `stack` but not both.
|
|
30
|
+
* Make sure your stack array has a stable reference and does not change between renders.
|
|
31
|
+
*/
|
|
32
|
+
stack?: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Allows you to react based on transitions between [nesting items](/packages/navigation/side-navigation/docs/nesting-item).
|
|
35
|
+
* It will be called everytime a user navigates from one [nesting item](/packages/navigation/side-navigation/docs/nesting-item) to another,
|
|
36
|
+
* both up or down the navigation hierarchy.
|
|
37
|
+
* This prop should be used with the `stack` prop for controlled behavior.
|
|
38
|
+
*/
|
|
39
|
+
onChange?: (stack: string[]) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Custom overrides for the composed components.
|
|
42
|
+
*/
|
|
43
|
+
overrides?: {
|
|
44
|
+
/**
|
|
45
|
+
* Use this to override the default back button displayed when navigation is nested.
|
|
46
|
+
* You'll want to import the [go back item](/packages/navigation/docs/go-back-item) component and use it here.
|
|
47
|
+
* This will be displayed for all children [nesting items](/packages/navigation/side-navigation/docs/nesting-item) unless they define their own.
|
|
48
|
+
*/
|
|
49
|
+
GoBackItem?: {
|
|
50
|
+
render?: (props: {
|
|
51
|
+
onClick: () => void;
|
|
52
|
+
testId?: string;
|
|
53
|
+
}) => React.ReactNode;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
declare const NestableNavigationContent: (props: NestableNavigationContentProps) => JSX.Element;
|
|
58
|
+
export default NestableNavigationContent;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Ref } from 'react';
|
|
3
|
+
import { Direction } from '@atlaskit/motion';
|
|
4
|
+
interface ChildrenAsFunctionProps {
|
|
5
|
+
'data-enter-from': string;
|
|
6
|
+
'data-exit-to': string;
|
|
7
|
+
'data-testid'?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
ref: Ref<any>;
|
|
10
|
+
}
|
|
11
|
+
interface NestingMotionProps {
|
|
12
|
+
enterFrom: Direction;
|
|
13
|
+
exitTo: Direction;
|
|
14
|
+
children: (props: ChildrenAsFunctionProps) => React.ReactNode;
|
|
15
|
+
testId?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const NestingMotion: (props: NestingMotionProps) => JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { CSSFn, CustomItemComponentProps, Overrides } from '@atlaskit/menu';
|
|
4
|
+
interface NestingItemOverrides extends Overrides {
|
|
5
|
+
/**
|
|
6
|
+
* Use this to override the back button displayed when navigation is nested.
|
|
7
|
+
* You'll want to import the [go back item](/packages/navigation/side-navigation/docs/go-back-item) component and use it here.
|
|
8
|
+
* This will be displayed for all children nesting item components unless they define their own.
|
|
9
|
+
*/
|
|
10
|
+
GoBackItem?: {
|
|
11
|
+
render?: (props: {
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
testId?: string;
|
|
14
|
+
}) => React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface NestingItemProps<TCustomComponentProps = CustomItemComponentProps> {
|
|
18
|
+
/**
|
|
19
|
+
* A **unique identifier** for the nesting item.
|
|
20
|
+
* Every nesting item component needs a unique id else undefined behavior will occur.
|
|
21
|
+
*/
|
|
22
|
+
id: string;
|
|
23
|
+
/**
|
|
24
|
+
* Text to display when the nesting item is rendered as a interactable element.
|
|
25
|
+
*/
|
|
26
|
+
title: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* The view that should be shown when this nesting item is visible.
|
|
29
|
+
*/
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Used to customize the rendered component when shown as an item.
|
|
33
|
+
* You can use this for example to change it to a SPA link.
|
|
34
|
+
*/
|
|
35
|
+
component?: React.ComponentType<TCustomComponentProps>;
|
|
36
|
+
/**
|
|
37
|
+
* A `testId` prop is provided for specified elements,
|
|
38
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
39
|
+
* serving as a hook for automated tests.
|
|
40
|
+
|
|
41
|
+
* Will set these elements when defined:
|
|
42
|
+
* - The container - `{testId}--container`
|
|
43
|
+
* - The nesting item - `{testId}--item`
|
|
44
|
+
* - The go back item - `{testId}--go-back-item` (only used if you pass in a override).
|
|
45
|
+
* - The nesting item default right arrow icon - `{testId}--item--right-arrow`
|
|
46
|
+
*/
|
|
47
|
+
testId?: string;
|
|
48
|
+
/**
|
|
49
|
+
* A function that can be used to override the styles of the component.
|
|
50
|
+
* It receives the current styles and state and expects a styles object.
|
|
51
|
+
*/
|
|
52
|
+
cssFn?: CSSFn;
|
|
53
|
+
/**
|
|
54
|
+
* Element to render before the item text.
|
|
55
|
+
* Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
|
|
56
|
+
*/
|
|
57
|
+
iconBefore?: React.ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* Element to render after the item text.
|
|
60
|
+
* Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
|
|
61
|
+
*/
|
|
62
|
+
iconAfter?: React.ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* Event that is triggered when the element is clicked.
|
|
65
|
+
*/
|
|
66
|
+
onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Description of the item.
|
|
69
|
+
* This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
|
|
70
|
+
*/
|
|
71
|
+
description?: string | JSX.Element;
|
|
72
|
+
/**
|
|
73
|
+
* Makes the element appear disabled as well as removing interactivity.
|
|
74
|
+
*/
|
|
75
|
+
isDisabled?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Makes the element appear selected.
|
|
78
|
+
*/
|
|
79
|
+
isSelected?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Custom overrides for the composed components.
|
|
82
|
+
*/
|
|
83
|
+
overrides?: NestingItemOverrides;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* NestingItem will render itself differently depending in what context it is rendered in.
|
|
87
|
+
* When not open - it will render itself as an item.
|
|
88
|
+
* When open - it will render its children.
|
|
89
|
+
*/
|
|
90
|
+
declare const NestingItem: <TCustomComponentProps extends CustomItemComponentProps>(props: NestingItemProps<TCustomComponentProps> & Pick<TCustomComponentProps, Exclude<keyof TCustomComponentProps, "ref" | "children" | "onClick" | "onMouseDown" | "className" | "data-testid" | "onDragStart" | "draggable" | "tabIndex" | "disabled">>) => JSX.Element;
|
|
91
|
+
export default NestingItem;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CSSFn } from '@atlaskit/menu';
|
|
2
|
+
export declare const enabledCSS: {
|
|
3
|
+
"&:hover [data-custom-icon]": {
|
|
4
|
+
display: string;
|
|
5
|
+
};
|
|
6
|
+
"&:active [data-custom-icon]": {
|
|
7
|
+
display: string;
|
|
8
|
+
};
|
|
9
|
+
"&:focus [data-custom-icon]": {
|
|
10
|
+
display: string;
|
|
11
|
+
};
|
|
12
|
+
"& [data-custom-icon]": {
|
|
13
|
+
display: string;
|
|
14
|
+
};
|
|
15
|
+
"&:hover [data-right-arrow]": {
|
|
16
|
+
display: string;
|
|
17
|
+
};
|
|
18
|
+
"&:active [data-right-arrow]": {
|
|
19
|
+
display: string;
|
|
20
|
+
};
|
|
21
|
+
"&:focus [data-right-arrow]": {
|
|
22
|
+
display: string;
|
|
23
|
+
};
|
|
24
|
+
"& [data-right-arrow]": {
|
|
25
|
+
display: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare const nestingItemStyle: CSSFn;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as HeadingItem } from './heading-item';
|
|
2
|
+
export type { HeadingItemProps } from './heading-item';
|
|
3
|
+
export { default as Section } from './section';
|
|
4
|
+
export type { SectionProps } from './section';
|
|
5
|
+
export { default as SkeletonHeadingItem } from './skeleton-heading-item';
|
|
6
|
+
export type { SkeletonHeadingItemProps } from './skeleton-heading-item';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SectionProps {
|
|
3
|
+
/**
|
|
4
|
+
* Children of the section,
|
|
5
|
+
* should generally be item or heading components.
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The text passed to heading.
|
|
10
|
+
* If a title is not provided no heading will be rendered.
|
|
11
|
+
*/
|
|
12
|
+
title?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Will render a border at the top of the section.
|
|
15
|
+
*/
|
|
16
|
+
hasSeparator?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* A `testId` prop is provided for specified elements,
|
|
19
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
20
|
+
* serving as a hook for automated tests.
|
|
21
|
+
*/
|
|
22
|
+
testId?: string;
|
|
23
|
+
}
|
|
24
|
+
declare const Section: React.ForwardRefExoticComponent<SectionProps & React.RefAttributes<HTMLElement>>;
|
|
25
|
+
export default Section;
|