@atlaskit/menu 2.0.0 → 2.0.1
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 +6 -0
- package/dist/cjs/internal/components/menu-item-primitive.js +14 -26
- package/dist/es2019/internal/components/menu-item-primitive.js +14 -26
- package/dist/esm/internal/components/menu-item-primitive.js +14 -26
- package/dist/types-ts4.5/entry-points/menu-item/button-item.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-item/custom-item.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-item/heading-item.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-item/link-item.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-item/skeleton-heading-item.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-item/skeleton-item.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-section/menu-group.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-section/popup-menu-group.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-section/section.d.ts +1 -0
- package/dist/types-ts4.5/index.d.ts +11 -0
- package/dist/types-ts4.5/internal/components/menu-context.d.ts +18 -0
- package/dist/types-ts4.5/internal/components/menu-item-primitive.d.ts +18 -0
- package/dist/types-ts4.5/internal/components/skeleton-shimmer.d.ts +24 -0
- package/dist/types-ts4.5/menu-item/button-item.d.ts +12 -0
- package/dist/types-ts4.5/menu-item/custom-item.d.ts +18 -0
- package/dist/types-ts4.5/menu-item/heading-item.d.ts +13 -0
- package/dist/types-ts4.5/menu-item/link-item.d.ts +12 -0
- package/dist/types-ts4.5/menu-item/skeleton-heading-item.d.ts +12 -0
- package/dist/types-ts4.5/menu-item/skeleton-item.d.ts +12 -0
- package/dist/types-ts4.5/menu-section/menu-group.d.ts +13 -0
- package/dist/types-ts4.5/menu-section/popup-menu-group.d.ts +8 -0
- package/dist/types-ts4.5/menu-section/section.d.ts +12 -0
- package/dist/types-ts4.5/types.d.ts +396 -0
- package/package.json +2 -2
- package/tmp/api-report-tmp.d.ts +222 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/menu
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#40650](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40650) [`07aa588c8a4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/07aa588c8a4) - Reverts the fix to text descender cut-off, due to incompatibilities with Firefox and Safari.
|
|
8
|
+
|
|
3
9
|
## 2.0.0
|
|
4
10
|
|
|
5
11
|
### Major Changes
|
|
@@ -34,34 +34,22 @@ var contentStyles = (0, _react2.css)({
|
|
|
34
34
|
flexGrow: 1,
|
|
35
35
|
lineHeight: "var(--ds-font-lineHeight-100, 16px)",
|
|
36
36
|
outline: 'none',
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
'@supports not (overflow-x: clip)': {
|
|
40
|
-
overflow: 'hidden'
|
|
41
|
-
},
|
|
42
|
-
'@supports (overflow-x: clip)': {
|
|
43
|
-
overflowX: 'clip'
|
|
44
|
-
}
|
|
37
|
+
overflow: 'hidden',
|
|
38
|
+
textAlign: 'left'
|
|
45
39
|
});
|
|
46
40
|
var truncateStyles = (0, _react2.css)({
|
|
47
41
|
display: 'block',
|
|
42
|
+
overflow: 'hidden',
|
|
48
43
|
textOverflow: 'ellipsis',
|
|
49
|
-
whiteSpace: 'nowrap'
|
|
50
|
-
// Use "clip" overflow to allow ellipses on x-axis without clipping descenders
|
|
51
|
-
'@supports not (overflow-x: clip)': {
|
|
52
|
-
overflow: 'hidden'
|
|
53
|
-
},
|
|
54
|
-
'@supports (overflow-x: clip)': {
|
|
55
|
-
overflowX: 'clip'
|
|
56
|
-
}
|
|
44
|
+
whiteSpace: 'nowrap'
|
|
57
45
|
});
|
|
58
46
|
var wordBreakStyles = (0, _react2.css)({
|
|
59
47
|
wordBreak: 'break-word'
|
|
60
48
|
});
|
|
61
49
|
var descriptionStyles = (0, _react2.css)({
|
|
50
|
+
marginTop: "var(--ds-space-050, 4px)",
|
|
62
51
|
color: "var(--ds-text-subtlest, ".concat(_colors.N200, ")"),
|
|
63
|
-
fontSize: "var(--ds-font-size-075, 12px)"
|
|
64
|
-
marginBlockStart: "var(--ds-space-050, 4px)"
|
|
52
|
+
fontSize: "var(--ds-font-size-075, 12px)"
|
|
65
53
|
});
|
|
66
54
|
var disabledDescriptionStyles = (0, _react2.css)({
|
|
67
55
|
color: "var(--ds-text-disabled, ".concat(_colors.N200, ")")
|
|
@@ -131,23 +119,23 @@ var selectedBorderStyles = (0, _react2.css)({
|
|
|
131
119
|
'&::before': {
|
|
132
120
|
width: 2,
|
|
133
121
|
position: 'absolute',
|
|
122
|
+
top: 0,
|
|
123
|
+
bottom: 0,
|
|
124
|
+
left: 0,
|
|
134
125
|
background: "var(--ds-border-selected, transparent)",
|
|
135
|
-
content: '""'
|
|
136
|
-
insetBlockEnd: 0,
|
|
137
|
-
insetBlockStart: 0,
|
|
138
|
-
insetInlineStart: 0
|
|
126
|
+
content: '""'
|
|
139
127
|
}
|
|
140
128
|
});
|
|
141
129
|
var selectedNotchStyles = (0, _react2.css)({
|
|
142
130
|
'&::before': {
|
|
143
131
|
width: 4,
|
|
144
132
|
position: 'absolute',
|
|
133
|
+
top: "var(--ds-space-150, 12px)",
|
|
134
|
+
bottom: "var(--ds-space-150, 12px)",
|
|
135
|
+
left: 0,
|
|
145
136
|
background: "var(--ds-border-selected, transparent)",
|
|
146
137
|
borderRadius: "0 ".concat("var(--ds-border-radius, 4px)", " ", "var(--ds-border-radius, 4px)", " 0"),
|
|
147
|
-
content: '""'
|
|
148
|
-
insetBlockEnd: "var(--ds-space-150, 12px)",
|
|
149
|
-
insetBlockStart: "var(--ds-space-150, 12px)",
|
|
150
|
-
insetInlineStart: 0
|
|
138
|
+
content: '""'
|
|
151
139
|
}
|
|
152
140
|
});
|
|
153
141
|
var selectedStyles = (0, _react2.css)({
|
|
@@ -23,34 +23,22 @@ const contentStyles = css({
|
|
|
23
23
|
flexGrow: 1,
|
|
24
24
|
lineHeight: "var(--ds-font-lineHeight-100, 16px)",
|
|
25
25
|
outline: 'none',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
'@supports not (overflow-x: clip)': {
|
|
29
|
-
overflow: 'hidden'
|
|
30
|
-
},
|
|
31
|
-
'@supports (overflow-x: clip)': {
|
|
32
|
-
overflowX: 'clip'
|
|
33
|
-
}
|
|
26
|
+
overflow: 'hidden',
|
|
27
|
+
textAlign: 'left'
|
|
34
28
|
});
|
|
35
29
|
const truncateStyles = css({
|
|
36
30
|
display: 'block',
|
|
31
|
+
overflow: 'hidden',
|
|
37
32
|
textOverflow: 'ellipsis',
|
|
38
|
-
whiteSpace: 'nowrap'
|
|
39
|
-
// Use "clip" overflow to allow ellipses on x-axis without clipping descenders
|
|
40
|
-
'@supports not (overflow-x: clip)': {
|
|
41
|
-
overflow: 'hidden'
|
|
42
|
-
},
|
|
43
|
-
'@supports (overflow-x: clip)': {
|
|
44
|
-
overflowX: 'clip'
|
|
45
|
-
}
|
|
33
|
+
whiteSpace: 'nowrap'
|
|
46
34
|
});
|
|
47
35
|
const wordBreakStyles = css({
|
|
48
36
|
wordBreak: 'break-word'
|
|
49
37
|
});
|
|
50
38
|
const descriptionStyles = css({
|
|
39
|
+
marginTop: "var(--ds-space-050, 4px)",
|
|
51
40
|
color: `var(--ds-text-subtlest, ${N200})`,
|
|
52
|
-
fontSize: "var(--ds-font-size-075, 12px)"
|
|
53
|
-
marginBlockStart: "var(--ds-space-050, 4px)"
|
|
41
|
+
fontSize: "var(--ds-font-size-075, 12px)"
|
|
54
42
|
});
|
|
55
43
|
const disabledDescriptionStyles = css({
|
|
56
44
|
color: `var(--ds-text-disabled, ${N200})`
|
|
@@ -120,23 +108,23 @@ const selectedBorderStyles = css({
|
|
|
120
108
|
'&::before': {
|
|
121
109
|
width: 2,
|
|
122
110
|
position: 'absolute',
|
|
111
|
+
top: 0,
|
|
112
|
+
bottom: 0,
|
|
113
|
+
left: 0,
|
|
123
114
|
background: "var(--ds-border-selected, transparent)",
|
|
124
|
-
content: '""'
|
|
125
|
-
insetBlockEnd: 0,
|
|
126
|
-
insetBlockStart: 0,
|
|
127
|
-
insetInlineStart: 0
|
|
115
|
+
content: '""'
|
|
128
116
|
}
|
|
129
117
|
});
|
|
130
118
|
const selectedNotchStyles = css({
|
|
131
119
|
'&::before': {
|
|
132
120
|
width: 4,
|
|
133
121
|
position: 'absolute',
|
|
122
|
+
top: "var(--ds-space-150, 12px)",
|
|
123
|
+
bottom: "var(--ds-space-150, 12px)",
|
|
124
|
+
left: 0,
|
|
134
125
|
background: "var(--ds-border-selected, transparent)",
|
|
135
126
|
borderRadius: `0 ${"var(--ds-border-radius, 4px)"} ${"var(--ds-border-radius, 4px)"} 0`,
|
|
136
|
-
content: '""'
|
|
137
|
-
insetBlockEnd: "var(--ds-space-150, 12px)",
|
|
138
|
-
insetBlockStart: "var(--ds-space-150, 12px)",
|
|
139
|
-
insetInlineStart: 0
|
|
127
|
+
content: '""'
|
|
140
128
|
}
|
|
141
129
|
});
|
|
142
130
|
const selectedStyles = css({
|
|
@@ -26,34 +26,22 @@ var contentStyles = css({
|
|
|
26
26
|
flexGrow: 1,
|
|
27
27
|
lineHeight: "var(--ds-font-lineHeight-100, 16px)",
|
|
28
28
|
outline: 'none',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
'@supports not (overflow-x: clip)': {
|
|
32
|
-
overflow: 'hidden'
|
|
33
|
-
},
|
|
34
|
-
'@supports (overflow-x: clip)': {
|
|
35
|
-
overflowX: 'clip'
|
|
36
|
-
}
|
|
29
|
+
overflow: 'hidden',
|
|
30
|
+
textAlign: 'left'
|
|
37
31
|
});
|
|
38
32
|
var truncateStyles = css({
|
|
39
33
|
display: 'block',
|
|
34
|
+
overflow: 'hidden',
|
|
40
35
|
textOverflow: 'ellipsis',
|
|
41
|
-
whiteSpace: 'nowrap'
|
|
42
|
-
// Use "clip" overflow to allow ellipses on x-axis without clipping descenders
|
|
43
|
-
'@supports not (overflow-x: clip)': {
|
|
44
|
-
overflow: 'hidden'
|
|
45
|
-
},
|
|
46
|
-
'@supports (overflow-x: clip)': {
|
|
47
|
-
overflowX: 'clip'
|
|
48
|
-
}
|
|
36
|
+
whiteSpace: 'nowrap'
|
|
49
37
|
});
|
|
50
38
|
var wordBreakStyles = css({
|
|
51
39
|
wordBreak: 'break-word'
|
|
52
40
|
});
|
|
53
41
|
var descriptionStyles = css({
|
|
42
|
+
marginTop: "var(--ds-space-050, 4px)",
|
|
54
43
|
color: "var(--ds-text-subtlest, ".concat(N200, ")"),
|
|
55
|
-
fontSize: "var(--ds-font-size-075, 12px)"
|
|
56
|
-
marginBlockStart: "var(--ds-space-050, 4px)"
|
|
44
|
+
fontSize: "var(--ds-font-size-075, 12px)"
|
|
57
45
|
});
|
|
58
46
|
var disabledDescriptionStyles = css({
|
|
59
47
|
color: "var(--ds-text-disabled, ".concat(N200, ")")
|
|
@@ -123,23 +111,23 @@ var selectedBorderStyles = css({
|
|
|
123
111
|
'&::before': {
|
|
124
112
|
width: 2,
|
|
125
113
|
position: 'absolute',
|
|
114
|
+
top: 0,
|
|
115
|
+
bottom: 0,
|
|
116
|
+
left: 0,
|
|
126
117
|
background: "var(--ds-border-selected, transparent)",
|
|
127
|
-
content: '""'
|
|
128
|
-
insetBlockEnd: 0,
|
|
129
|
-
insetBlockStart: 0,
|
|
130
|
-
insetInlineStart: 0
|
|
118
|
+
content: '""'
|
|
131
119
|
}
|
|
132
120
|
});
|
|
133
121
|
var selectedNotchStyles = css({
|
|
134
122
|
'&::before': {
|
|
135
123
|
width: 4,
|
|
136
124
|
position: 'absolute',
|
|
125
|
+
top: "var(--ds-space-150, 12px)",
|
|
126
|
+
bottom: "var(--ds-space-150, 12px)",
|
|
127
|
+
left: 0,
|
|
137
128
|
background: "var(--ds-border-selected, transparent)",
|
|
138
129
|
borderRadius: "0 ".concat("var(--ds-border-radius, 4px)", " ", "var(--ds-border-radius, 4px)", " 0"),
|
|
139
|
-
content: '""'
|
|
140
|
-
insetBlockEnd: "var(--ds-space-150, 12px)",
|
|
141
|
-
insetBlockStart: "var(--ds-space-150, 12px)",
|
|
142
|
-
insetInlineStart: 0
|
|
130
|
+
content: '""'
|
|
143
131
|
}
|
|
144
132
|
});
|
|
145
133
|
var selectedStyles = css({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../../menu-item/button-item';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../../menu-item/custom-item';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../../menu-item/heading-item';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../../menu-item/link-item';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../../menu-item/skeleton-heading-item';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../../menu-item/skeleton-item';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../../menu-section/menu-group';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../../menu-section/popup-menu-group';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../../menu-section/section';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as ButtonItem } from './menu-item/button-item';
|
|
2
|
+
export { default as LinkItem } from './menu-item/link-item';
|
|
3
|
+
export { default as CustomItem } from './menu-item/custom-item';
|
|
4
|
+
export { default as SkeletonItem } from './menu-item/skeleton-item';
|
|
5
|
+
export { SpacingContext, SELECTION_STYLE_CONTEXT_DO_NOT_USE, } from './internal/components/menu-context';
|
|
6
|
+
export { default as HeadingItem } from './menu-item/heading-item';
|
|
7
|
+
export { default as SkeletonHeadingItem } from './menu-item/skeleton-heading-item';
|
|
8
|
+
export { default as Section } from './menu-section/section';
|
|
9
|
+
export { default as MenuGroup } from './menu-section/menu-group';
|
|
10
|
+
export { default as PopupMenuGroup } from './menu-section/popup-menu-group';
|
|
11
|
+
export type { ButtonItemProps, CSSFn, StatelessCSSFn, CustomItemComponentProps, CustomItemProps, HeadingItemProps, ItemState, LinkItemProps, MenuGroupProps, SectionProps, SkeletonHeadingItemProps, SkeletonItemProps, Dimension, MenuItemProps as BaseItemProps, Overrides, MenuGroupSizing, RenderFunction, SectionProps as SectionBaseProps, TitleOverrides, } from './types';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type SpacingMode = 'compact' | 'cozy';
|
|
3
|
+
/**
|
|
4
|
+
* __Spacing context__
|
|
5
|
+
*
|
|
6
|
+
* The spacing context is used to provide spacing values to menu item primitives.
|
|
7
|
+
*
|
|
8
|
+
* @internal Do not use directly.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SpacingContext: import("react").Context<SpacingMode>;
|
|
11
|
+
/**
|
|
12
|
+
* __Selection context__
|
|
13
|
+
*
|
|
14
|
+
* The selection context is used to set what selection mode the menu items display as.
|
|
15
|
+
*
|
|
16
|
+
* @internal Do not use directly.
|
|
17
|
+
*/
|
|
18
|
+
export declare const SELECTION_STYLE_CONTEXT_DO_NOT_USE: import("react").Context<"notch" | "border" | "none">;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import type { MenuItemPrimitiveProps } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* __Menu item primitive__
|
|
5
|
+
*
|
|
6
|
+
* Menu item primitive contains all the styles for menu items,
|
|
7
|
+
* including support for selected, disabled, and interaction states.
|
|
8
|
+
*
|
|
9
|
+
* Using children as function prop you wire up this to your own host element.
|
|
10
|
+
*
|
|
11
|
+
* ```jsx
|
|
12
|
+
* <MenuItemPrimitive>
|
|
13
|
+
* {({ children, ...props }) => <button {...props}>{children}</button>}
|
|
14
|
+
* </MenuItemPrimitive>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
declare const MenuItemPrimitive: ({ children, title, description, iconAfter, iconBefore, overrides, className: UNSAFE_externalClassName, shouldTitleWrap, shouldDescriptionWrap, isDisabled, isSelected, }: MenuItemPrimitiveProps) => jsx.JSX.Element;
|
|
18
|
+
export default MenuItemPrimitive;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
type SkeletonShimmerProps = {
|
|
5
|
+
children: ({ className }: {
|
|
6
|
+
className?: string;
|
|
7
|
+
}) => ReactNode;
|
|
8
|
+
isShimmering?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* __Skeleton shimmer__
|
|
12
|
+
*
|
|
13
|
+
* A skeleton shimmer is the animation shown on loading skeletons for
|
|
14
|
+
* perceived performance and user satisfaction.
|
|
15
|
+
*
|
|
16
|
+
* This component provides a `className` through render props. This value will
|
|
17
|
+
* have type:
|
|
18
|
+
* + `string`, when `isShimmering={true}`.
|
|
19
|
+
* + `undefined`, when `isShimmering={false}`.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
declare const SkeletonShimmer: ({ children, isShimmering, }: SkeletonShimmerProps) => jsx.JSX.Element;
|
|
24
|
+
export default SkeletonShimmer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ButtonItemProps } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* __Button item__
|
|
5
|
+
*
|
|
6
|
+
* A button item is used to populate a menu with items that are buttons.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/button-item)
|
|
9
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
10
|
+
*/
|
|
11
|
+
declare const ButtonItem: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<ButtonItemProps & import("react").RefAttributes<HTMLElement>>>;
|
|
12
|
+
export default ButtonItem;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import type { CustomItemComponentProps, CustomItemProps } from '../types';
|
|
4
|
+
interface CustomItemTypeGenericHackProps {
|
|
5
|
+
<TComponentProps>(props: CustomItemProps<TComponentProps> & {
|
|
6
|
+
ref?: any;
|
|
7
|
+
} & Omit<TComponentProps, keyof CustomItemComponentProps>): JSX.Element | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* __Custom item__
|
|
11
|
+
*
|
|
12
|
+
* A custom item is used to populate a menu with items that can be any element.
|
|
13
|
+
*
|
|
14
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/custom-item)
|
|
15
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
16
|
+
*/
|
|
17
|
+
declare const CustomItem: CustomItemTypeGenericHackProps;
|
|
18
|
+
export default CustomItem;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import type { HeadingItemProps } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* __Heading item__
|
|
6
|
+
*
|
|
7
|
+
* A heading item is used to describe sibling menu items.
|
|
8
|
+
*
|
|
9
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/heading-item)
|
|
10
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
11
|
+
*/
|
|
12
|
+
declare const HeadingItem: import("react").MemoExoticComponent<({ children, testId, id, cssFn, className: UNSAFE_className, ...rest }: HeadingItemProps) => jsx.JSX.Element>;
|
|
13
|
+
export default HeadingItem;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { LinkItemProps } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* __Link item__
|
|
5
|
+
*
|
|
6
|
+
* A link item is used to populate a menu with items that are links.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/link-item)
|
|
9
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
10
|
+
*/
|
|
11
|
+
declare const LinkItem: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<LinkItemProps & import("react").RefAttributes<HTMLElement>>>;
|
|
12
|
+
export default LinkItem;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import type { SkeletonHeadingItemProps } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* __Skeleton heading item__
|
|
5
|
+
*
|
|
6
|
+
* A skeleton heading item is used in place of a heading item when its contents it not ready.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/skeleton-heading-item)
|
|
9
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
10
|
+
*/
|
|
11
|
+
declare const SkeletonHeadingItem: ({ isShimmering, testId, width, cssFn, }: SkeletonHeadingItemProps) => jsx.JSX.Element;
|
|
12
|
+
export default SkeletonHeadingItem;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import type { SkeletonItemProps } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* __Skeleton item__
|
|
5
|
+
*
|
|
6
|
+
* A skeleton item is used in place of an item when its contents it not ready.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/skeleton-item)
|
|
9
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
10
|
+
*/
|
|
11
|
+
declare const SkeletonItem: ({ hasAvatar, hasIcon, isShimmering, testId, width, cssFn, }: SkeletonItemProps) => jsx.JSX.Element;
|
|
12
|
+
export default SkeletonItem;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import type { MenuGroupProps } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* __Menu group__
|
|
6
|
+
*
|
|
7
|
+
* A menu group includes all the actions or items in a menu.
|
|
8
|
+
*
|
|
9
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/menu-group)
|
|
10
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
11
|
+
*/
|
|
12
|
+
declare const MenuGroup: ({ isLoading, maxWidth, minWidth, minHeight, maxHeight, testId, role, spacing, className: UNSAFE_className, ...rest }: MenuGroupProps) => jsx.JSX.Element;
|
|
13
|
+
export default MenuGroup;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import type { MenuGroupProps } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
7
|
+
declare const PopupMenuGroup: ({ maxWidth, minWidth, ...rest }: MenuGroupProps) => jsx.JSX.Element;
|
|
8
|
+
export default PopupMenuGroup;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { SectionProps } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* __Section__
|
|
5
|
+
*
|
|
6
|
+
* A section includes related actions or items in a menu.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/section)
|
|
9
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
10
|
+
*/
|
|
11
|
+
declare const Section: import("react").ForwardRefExoticComponent<SectionProps & import("react").RefAttributes<HTMLElement>>;
|
|
12
|
+
export default Section;
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { ComponentType, ReactNode, Ref } from 'react';
|
|
2
|
+
import { CSSObject } from '@emotion/react';
|
|
3
|
+
import type { SpacingMode } from './internal/components/menu-context';
|
|
4
|
+
export interface RenderFunction<TProps = {}> {
|
|
5
|
+
(Component: ComponentType | string, props: TProps): React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
9
|
+
*/
|
|
10
|
+
export interface TitleOverrides {
|
|
11
|
+
render?: RenderFunction<{
|
|
12
|
+
className?: string;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
'data-item-title': boolean;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
19
|
+
*/
|
|
20
|
+
export interface Overrides {
|
|
21
|
+
Title?: TitleOverrides;
|
|
22
|
+
}
|
|
23
|
+
export type Dimension = string | number;
|
|
24
|
+
export interface MenuGroupSizing {
|
|
25
|
+
/**
|
|
26
|
+
* Useful to constrain the menu group minimum height to a specific value.
|
|
27
|
+
*/
|
|
28
|
+
minHeight?: Dimension;
|
|
29
|
+
/**
|
|
30
|
+
* Useful to constrain the menu groups height to a specific value.
|
|
31
|
+
* Needs to be set when wanting to have scrollable sections.
|
|
32
|
+
*/
|
|
33
|
+
maxHeight?: Dimension;
|
|
34
|
+
/**
|
|
35
|
+
* Useful to constrain the menu group minimum width to a specific value.
|
|
36
|
+
*/
|
|
37
|
+
minWidth?: Dimension;
|
|
38
|
+
/**
|
|
39
|
+
* Useful to constrain the menu group width to a specific value.
|
|
40
|
+
*/
|
|
41
|
+
maxWidth?: Dimension;
|
|
42
|
+
}
|
|
43
|
+
export interface MenuGroupProps extends MenuGroupSizing {
|
|
44
|
+
/**
|
|
45
|
+
* Children of the menu group,
|
|
46
|
+
* should generally be `Section` components.
|
|
47
|
+
*/
|
|
48
|
+
children: React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Used for telling assistive technologies that the menu group is loading.
|
|
51
|
+
*/
|
|
52
|
+
isLoading?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Configure the density of the MenuGroup content.
|
|
55
|
+
*/
|
|
56
|
+
spacing?: SpacingMode;
|
|
57
|
+
/**
|
|
58
|
+
* Used to override the accessibility role for the element.
|
|
59
|
+
*/
|
|
60
|
+
role?: string;
|
|
61
|
+
/**
|
|
62
|
+
* A `testId` prop is provided for specified elements,
|
|
63
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
64
|
+
* serving as a hook for automated tests.
|
|
65
|
+
*/
|
|
66
|
+
testId?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Handler called when clicking on this element,
|
|
69
|
+
* or any children elements.
|
|
70
|
+
* Useful when needing to stop propagation of child events.
|
|
71
|
+
*/
|
|
72
|
+
onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
73
|
+
}
|
|
74
|
+
export interface SectionProps {
|
|
75
|
+
/**
|
|
76
|
+
* Unique identifier for the element.
|
|
77
|
+
*/
|
|
78
|
+
id?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Enables scrolling within the section.
|
|
81
|
+
* Make sure to set `maxHeight` on the parent `MenuGroup` component else it will not work.
|
|
82
|
+
*/
|
|
83
|
+
isScrollable?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Will render a border at the top of the section.
|
|
86
|
+
*/
|
|
87
|
+
hasSeparator?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Children of the section,
|
|
90
|
+
* should generally be `Item` or `Heading` components,
|
|
91
|
+
* but can also be [`EmptyState`](https://atlaskit.atlassian.com/packages/design-system/empty-state)s when wanting to render errors.
|
|
92
|
+
*/
|
|
93
|
+
children: React.ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* A `testId` prop is provided for specified elements,
|
|
96
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
97
|
+
* serving as a hook for automated tests.
|
|
98
|
+
*/
|
|
99
|
+
testId?: string;
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
102
|
+
*/
|
|
103
|
+
overrides?: {
|
|
104
|
+
HeadingItem?: {
|
|
105
|
+
/**
|
|
106
|
+
* A function that overrides the styles of the component.
|
|
107
|
+
* It receives the current styles and state and expects a styles object.
|
|
108
|
+
*/
|
|
109
|
+
cssFn?: StatelessCSSFn;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* The text passed into the internal HeadingItem. If a title is not provided,
|
|
114
|
+
* the HeadingItem will not be rendered, and this component acts as a regular Section
|
|
115
|
+
*/
|
|
116
|
+
title?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Adds `<ul>` and `<li>` tags around the items for better semantic markup in a list of items.
|
|
119
|
+
*/
|
|
120
|
+
isList?: boolean;
|
|
121
|
+
}
|
|
122
|
+
export interface MenuItemPrimitiveProps {
|
|
123
|
+
children: (props: {
|
|
124
|
+
className: string;
|
|
125
|
+
children: React.ReactNode;
|
|
126
|
+
}) => JSX.Element;
|
|
127
|
+
title: React.ReactNode | undefined;
|
|
128
|
+
description: React.ReactNode | undefined;
|
|
129
|
+
iconAfter: React.ReactNode | undefined;
|
|
130
|
+
iconBefore: React.ReactNode | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
133
|
+
*/
|
|
134
|
+
overrides: Overrides | undefined;
|
|
135
|
+
shouldTitleWrap: boolean | undefined;
|
|
136
|
+
shouldDescriptionWrap: boolean | undefined;
|
|
137
|
+
isDisabled: boolean | undefined;
|
|
138
|
+
isSelected: boolean | undefined;
|
|
139
|
+
className?: string;
|
|
140
|
+
}
|
|
141
|
+
export interface MenuItemProps {
|
|
142
|
+
/**
|
|
143
|
+
A function that overrides the styles of the component.
|
|
144
|
+
It receives the current styles and state and expects a styles object.
|
|
145
|
+
|
|
146
|
+
@deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
147
|
+
*/
|
|
148
|
+
cssFn?: CSSFn;
|
|
149
|
+
/**
|
|
150
|
+
* Element to render before the item text.
|
|
151
|
+
* Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
|
|
152
|
+
*/
|
|
153
|
+
iconBefore?: React.ReactNode;
|
|
154
|
+
/**
|
|
155
|
+
* Element to render after the item text.
|
|
156
|
+
* Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
|
|
157
|
+
*/
|
|
158
|
+
iconAfter?: React.ReactNode;
|
|
159
|
+
/**
|
|
160
|
+
* Event that is triggered when the element is clicked.
|
|
161
|
+
*/
|
|
162
|
+
onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
163
|
+
/**
|
|
164
|
+
* Event that is triggered when the element has been pressed.
|
|
165
|
+
*/
|
|
166
|
+
onMouseDown?: React.MouseEventHandler;
|
|
167
|
+
/**
|
|
168
|
+
* Description of the item.
|
|
169
|
+
* This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
|
|
170
|
+
*/
|
|
171
|
+
description?: string | JSX.Element;
|
|
172
|
+
/**
|
|
173
|
+
* Makes the element appear disabled as well as removing interactivity.
|
|
174
|
+
*/
|
|
175
|
+
isDisabled?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Makes the element appear selected.
|
|
178
|
+
*/
|
|
179
|
+
isSelected?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Primary content for the item.
|
|
182
|
+
*/
|
|
183
|
+
children?: React.ReactNode;
|
|
184
|
+
/**
|
|
185
|
+
* A `testId` prop is provided for specified elements,
|
|
186
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
187
|
+
* serving as a hook for automated tests.
|
|
188
|
+
*/
|
|
189
|
+
testId?: string;
|
|
190
|
+
/**
|
|
191
|
+
Custom overrides for the composed components.
|
|
192
|
+
|
|
193
|
+
@deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
194
|
+
*/
|
|
195
|
+
overrides?: Overrides;
|
|
196
|
+
/**
|
|
197
|
+
* When `true` the title of the item will wrap multiple lines if it's long enough.
|
|
198
|
+
*/
|
|
199
|
+
shouldTitleWrap?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* When `true` the description of the item will wrap multiple lines if it's long enough.
|
|
202
|
+
*/
|
|
203
|
+
shouldDescriptionWrap?: boolean;
|
|
204
|
+
}
|
|
205
|
+
export interface ButtonItemProps extends MenuItemProps {
|
|
206
|
+
/**
|
|
207
|
+
* Unique identifier for the element.
|
|
208
|
+
*/
|
|
209
|
+
id?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Used to override the accessibility role for the element.
|
|
212
|
+
*/
|
|
213
|
+
role?: string;
|
|
214
|
+
}
|
|
215
|
+
export interface LinkItemProps extends MenuItemProps {
|
|
216
|
+
/**
|
|
217
|
+
* Link to another page.
|
|
218
|
+
*/
|
|
219
|
+
href?: string;
|
|
220
|
+
/**
|
|
221
|
+
* Where to display the linked URL,
|
|
222
|
+
* see [anchor information](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) on mdn for more information.
|
|
223
|
+
*/
|
|
224
|
+
target?: string;
|
|
225
|
+
/**
|
|
226
|
+
* The relationship of the linked URL as space-separated link types.
|
|
227
|
+
* Generally you'll want to set this to "noopener noreferrer" when `target` is "_blank".
|
|
228
|
+
*/
|
|
229
|
+
rel?: string;
|
|
230
|
+
/**
|
|
231
|
+
* Used to override the accessibility role for the element.
|
|
232
|
+
*/
|
|
233
|
+
role?: string;
|
|
234
|
+
}
|
|
235
|
+
export interface CustomItemComponentProps {
|
|
236
|
+
/**
|
|
237
|
+
* The children of the item.
|
|
238
|
+
*/
|
|
239
|
+
children: React.ReactNode;
|
|
240
|
+
/**
|
|
241
|
+
* Class to apply to the root container of the custom component,
|
|
242
|
+
* ensure this has been applied so the consistent item styling is applied.
|
|
243
|
+
*/
|
|
244
|
+
className: string;
|
|
245
|
+
/**
|
|
246
|
+
* Test id that is passed through to the custom component.
|
|
247
|
+
*/
|
|
248
|
+
'data-testid'?: string;
|
|
249
|
+
/**
|
|
250
|
+
* Event handler that is passed through to the custom component.
|
|
251
|
+
*/
|
|
252
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
253
|
+
/**
|
|
254
|
+
* Event handler that is passed through to the custom component.
|
|
255
|
+
*/
|
|
256
|
+
onMouseDown?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
257
|
+
/**
|
|
258
|
+
* Event handler that is passed through to the custom component.
|
|
259
|
+
* Used to disable the element from being draggable.
|
|
260
|
+
*/
|
|
261
|
+
onDragStart?: (event: React.DragEvent) => void;
|
|
262
|
+
/**
|
|
263
|
+
* Turns off the element being draggable.
|
|
264
|
+
*/
|
|
265
|
+
draggable: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* React ref for the raw DOM element,
|
|
268
|
+
* make sure to place this on the outer most DOM element.
|
|
269
|
+
*/
|
|
270
|
+
ref?: Ref<any>;
|
|
271
|
+
/**
|
|
272
|
+
* Makes the element appear disabled as well as removing interactivity.
|
|
273
|
+
*/
|
|
274
|
+
tabIndex?: number;
|
|
275
|
+
/**
|
|
276
|
+
* Disabled attribute.
|
|
277
|
+
*/
|
|
278
|
+
disabled?: boolean;
|
|
279
|
+
}
|
|
280
|
+
export interface CustomItemProps<TCustomComponentProps = CustomItemComponentProps> extends MenuItemProps {
|
|
281
|
+
/**
|
|
282
|
+
Custom component to render as an item. This can be both a functional component or a class component.
|
|
283
|
+
|
|
284
|
+
__Will return `null` if no component is defined.__
|
|
285
|
+
|
|
286
|
+
Props passed to `CustomItem` will be passed down to this component. If the props for `component` have TypeScript types,
|
|
287
|
+
CustomItem will extend them, providing type safety for your custom item.
|
|
288
|
+
|
|
289
|
+
e.g. `<CustomItem to="/link" component={RouterLink} />`
|
|
290
|
+
|
|
291
|
+
__NOTE:__ Make sure the reference for this component does not change between renders else undefined behavior may happen.
|
|
292
|
+
*/
|
|
293
|
+
component?: React.ComponentType<TCustomComponentProps>;
|
|
294
|
+
}
|
|
295
|
+
export interface SkeletonItemProps {
|
|
296
|
+
/**
|
|
297
|
+
* Renders a skeleton circle in the `iconBefore` location.
|
|
298
|
+
* Takes priority over `hasIcon.
|
|
299
|
+
*/
|
|
300
|
+
hasAvatar?: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* Renders a skeleton square in the `iconBefore` location.
|
|
303
|
+
*/
|
|
304
|
+
hasIcon?: boolean;
|
|
305
|
+
/**
|
|
306
|
+
*
|
|
307
|
+
* Width of the skeleton item.
|
|
308
|
+
* Generally you don't need to specify this as it has a staggered width based on `:nth-child` by default.
|
|
309
|
+
*/
|
|
310
|
+
width?: Dimension;
|
|
311
|
+
/**
|
|
312
|
+
* A `testId` prop is provided for specified elements,
|
|
313
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
314
|
+
* serving as a hook for automated tests.
|
|
315
|
+
*/
|
|
316
|
+
testId?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Causes to the skeleton to have a slight horizontal shimmer.
|
|
319
|
+
* Only use this when you want to bring more attention to the loading content.
|
|
320
|
+
*/
|
|
321
|
+
isShimmering?: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* A function that overrides the styles of this component.
|
|
324
|
+
* It receives the current styles and returns a customized styles object.
|
|
325
|
+
*/
|
|
326
|
+
cssFn?: StatelessCSSFn;
|
|
327
|
+
}
|
|
328
|
+
export interface HeadingItemProps {
|
|
329
|
+
/**
|
|
330
|
+
A function that overrides the styles.
|
|
331
|
+
It receives the current styles and returns a customized styles object.
|
|
332
|
+
|
|
333
|
+
@deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
334
|
+
*/
|
|
335
|
+
cssFn?: StatelessCSSFn;
|
|
336
|
+
/**
|
|
337
|
+
* The text of the heading.
|
|
338
|
+
*/
|
|
339
|
+
children: React.ReactNode;
|
|
340
|
+
/**
|
|
341
|
+
* A unique identifier that can be referenced in the `labelledby` prop of a
|
|
342
|
+
* section to allow screen readers to announce the name of groups.
|
|
343
|
+
*/
|
|
344
|
+
id?: string;
|
|
345
|
+
/**
|
|
346
|
+
* A `testId` prop is provided for specified elements,
|
|
347
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
348
|
+
* serving as a hook for automated tests.
|
|
349
|
+
*/
|
|
350
|
+
testId?: string;
|
|
351
|
+
}
|
|
352
|
+
export interface SkeletonHeadingItemProps {
|
|
353
|
+
/**
|
|
354
|
+
*
|
|
355
|
+
* Width of the skeleton heading item.
|
|
356
|
+
* Generally you don't need to specify this as it has a staggered width based on `:nth-child` by default.
|
|
357
|
+
*/
|
|
358
|
+
width?: Dimension;
|
|
359
|
+
/**
|
|
360
|
+
* A `testId` prop is provided for specified elements,
|
|
361
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
362
|
+
* serving as a hook for automated tests.
|
|
363
|
+
*/
|
|
364
|
+
testId?: string;
|
|
365
|
+
/**
|
|
366
|
+
* Causes to the skeleton to have a slight horizontal shimmer.
|
|
367
|
+
* Only use this when you want to bring more attention to the loading content.
|
|
368
|
+
*/
|
|
369
|
+
isShimmering?: boolean;
|
|
370
|
+
/**
|
|
371
|
+
A function that overrides the styles of this component.
|
|
372
|
+
It receives the current styles and returns a customized styles object.
|
|
373
|
+
|
|
374
|
+
@deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
375
|
+
*/
|
|
376
|
+
cssFn?: StatelessCSSFn;
|
|
377
|
+
}
|
|
378
|
+
export type ItemState = {
|
|
379
|
+
isSelected: boolean;
|
|
380
|
+
isDisabled: boolean;
|
|
381
|
+
};
|
|
382
|
+
/**
|
|
383
|
+
A function that overrides the styles of
|
|
384
|
+
menu components. It receives the current state
|
|
385
|
+
and should return a CSSObject.
|
|
386
|
+
|
|
387
|
+
@see @atlaskit/menu/docs/85-overriding-item-styles
|
|
388
|
+
@deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
389
|
+
*/
|
|
390
|
+
export interface CSSFn<TState = ItemState extends void ? void : ItemState> {
|
|
391
|
+
(currentState: TState): CSSObject | CSSObject[];
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
395
|
+
*/
|
|
396
|
+
export type StatelessCSSFn = CSSFn<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/menu",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "A collection of composable menu components that can be used anywhere.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
32
32
|
"@atlaskit/primitives": "^1.6.0",
|
|
33
33
|
"@atlaskit/theme": "^12.6.0",
|
|
34
|
-
"@atlaskit/tokens": "^1.
|
|
34
|
+
"@atlaskit/tokens": "^1.26.0",
|
|
35
35
|
"@babel/runtime": "^7.0.0",
|
|
36
36
|
"@emotion/react": "^11.7.1"
|
|
37
37
|
},
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/menu"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
|
|
9
|
+
import { ComponentType } from 'react';
|
|
10
|
+
import { Context } from 'react';
|
|
11
|
+
import { CSSObject } from '@emotion/react';
|
|
12
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
13
|
+
import { jsx } from '@emotion/react';
|
|
14
|
+
import { MemoExoticComponent } from 'react';
|
|
15
|
+
import { ReactNode } from 'react';
|
|
16
|
+
import { Ref } from 'react';
|
|
17
|
+
import { RefAttributes } from 'react';
|
|
18
|
+
|
|
19
|
+
// @public (undocumented)
|
|
20
|
+
export interface BaseItemProps {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
// @deprecated
|
|
23
|
+
cssFn?: CSSFn;
|
|
24
|
+
description?: JSX.Element | string;
|
|
25
|
+
iconAfter?: React.ReactNode;
|
|
26
|
+
iconBefore?: React.ReactNode;
|
|
27
|
+
isDisabled?: boolean;
|
|
28
|
+
isSelected?: boolean;
|
|
29
|
+
onClick?: (event: React.KeyboardEvent | React.MouseEvent) => void;
|
|
30
|
+
onMouseDown?: React.MouseEventHandler;
|
|
31
|
+
// @deprecated
|
|
32
|
+
overrides?: Overrides;
|
|
33
|
+
shouldDescriptionWrap?: boolean;
|
|
34
|
+
shouldTitleWrap?: boolean;
|
|
35
|
+
testId?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// @public
|
|
39
|
+
export const ButtonItem: MemoExoticComponent<ForwardRefExoticComponent<ButtonItemProps & RefAttributes<HTMLElement>>>;
|
|
40
|
+
|
|
41
|
+
// @public (undocumented)
|
|
42
|
+
export interface ButtonItemProps extends BaseItemProps {
|
|
43
|
+
id?: string;
|
|
44
|
+
role?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// @public @deprecated
|
|
48
|
+
export interface CSSFn<TState = ItemState extends void ? void : ItemState> {
|
|
49
|
+
// (undocumented)
|
|
50
|
+
(currentState: TState): CSSObject | CSSObject[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// @public
|
|
54
|
+
export const CustomItem: CustomItemTypeGenericHackProps;
|
|
55
|
+
|
|
56
|
+
// @public (undocumented)
|
|
57
|
+
export interface CustomItemComponentProps {
|
|
58
|
+
'data-testid'?: string;
|
|
59
|
+
children: React.ReactNode;
|
|
60
|
+
className: string;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
draggable: boolean;
|
|
63
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
64
|
+
onDragStart?: (event: React.DragEvent) => void;
|
|
65
|
+
onMouseDown?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
66
|
+
ref?: Ref<any>;
|
|
67
|
+
tabIndex?: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// @public (undocumented)
|
|
71
|
+
export interface CustomItemProps<TCustomComponentProps = CustomItemComponentProps> extends BaseItemProps {
|
|
72
|
+
component?: React.ComponentType<TCustomComponentProps>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// @public (undocumented)
|
|
76
|
+
interface CustomItemTypeGenericHackProps {
|
|
77
|
+
// (undocumented)
|
|
78
|
+
<TComponentProps>(props: CustomItemProps<TComponentProps> & {
|
|
79
|
+
ref?: any;
|
|
80
|
+
} & Omit<TComponentProps, keyof CustomItemComponentProps>): JSX.Element | null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// @public (undocumented)
|
|
84
|
+
export type Dimension = number | string;
|
|
85
|
+
|
|
86
|
+
// @public
|
|
87
|
+
export const HeadingItem: MemoExoticComponent<({ children, testId, id, cssFn, className: UNSAFE_className, ...rest }: HeadingItemProps) => jsx.JSX.Element>;
|
|
88
|
+
|
|
89
|
+
// @public (undocumented)
|
|
90
|
+
export interface HeadingItemProps {
|
|
91
|
+
children: React.ReactNode;
|
|
92
|
+
// @deprecated
|
|
93
|
+
cssFn?: StatelessCSSFn;
|
|
94
|
+
id?: string;
|
|
95
|
+
testId?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// @public (undocumented)
|
|
99
|
+
export type ItemState = {
|
|
100
|
+
isSelected: boolean;
|
|
101
|
+
isDisabled: boolean;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// @public
|
|
105
|
+
export const LinkItem: MemoExoticComponent<ForwardRefExoticComponent<LinkItemProps & RefAttributes<HTMLElement>>>;
|
|
106
|
+
|
|
107
|
+
// @public (undocumented)
|
|
108
|
+
export interface LinkItemProps extends BaseItemProps {
|
|
109
|
+
href?: string;
|
|
110
|
+
rel?: string;
|
|
111
|
+
role?: string;
|
|
112
|
+
target?: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// @public
|
|
116
|
+
export const MenuGroup: ({ isLoading, maxWidth, minWidth, minHeight, maxHeight, testId, role, spacing, className: UNSAFE_className, ...rest }: MenuGroupProps) => jsx.JSX.Element;
|
|
117
|
+
|
|
118
|
+
// @public (undocumented)
|
|
119
|
+
export interface MenuGroupProps extends MenuGroupSizing {
|
|
120
|
+
children: React.ReactNode;
|
|
121
|
+
isLoading?: boolean;
|
|
122
|
+
onClick?: (event: React.KeyboardEvent | React.MouseEvent) => void;
|
|
123
|
+
role?: string;
|
|
124
|
+
spacing?: SpacingMode;
|
|
125
|
+
testId?: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// @public (undocumented)
|
|
129
|
+
export interface MenuGroupSizing {
|
|
130
|
+
maxHeight?: Dimension;
|
|
131
|
+
maxWidth?: Dimension;
|
|
132
|
+
minHeight?: Dimension;
|
|
133
|
+
minWidth?: Dimension;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// @public @deprecated (undocumented)
|
|
137
|
+
export interface Overrides {
|
|
138
|
+
// (undocumented)
|
|
139
|
+
Title?: TitleOverrides;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// @public @deprecated (undocumented)
|
|
143
|
+
export const PopupMenuGroup: ({ maxWidth, minWidth, ...rest }: MenuGroupProps) => jsx.JSX.Element;
|
|
144
|
+
|
|
145
|
+
// @public (undocumented)
|
|
146
|
+
export interface RenderFunction<TProps = {}> {
|
|
147
|
+
// (undocumented)
|
|
148
|
+
(Component: ComponentType | string, props: TProps): React.ReactNode;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// @public
|
|
152
|
+
export const Section: ForwardRefExoticComponent<SectionProps & RefAttributes<HTMLElement>>;
|
|
153
|
+
|
|
154
|
+
// @public (undocumented)
|
|
155
|
+
interface SectionProps {
|
|
156
|
+
children: React.ReactNode;
|
|
157
|
+
hasSeparator?: boolean;
|
|
158
|
+
id?: string;
|
|
159
|
+
isList?: boolean;
|
|
160
|
+
isScrollable?: boolean;
|
|
161
|
+
// @deprecated (undocumented)
|
|
162
|
+
overrides?: {
|
|
163
|
+
HeadingItem?: {
|
|
164
|
+
cssFn?: StatelessCSSFn;
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
testId?: string;
|
|
168
|
+
title?: string;
|
|
169
|
+
}
|
|
170
|
+
export { SectionProps as SectionBaseProps }
|
|
171
|
+
export { SectionProps }
|
|
172
|
+
|
|
173
|
+
// @internal
|
|
174
|
+
export const SELECTION_STYLE_CONTEXT_DO_NOT_USE: Context<"border" | "none" | "notch">;
|
|
175
|
+
|
|
176
|
+
// @public
|
|
177
|
+
export const SkeletonHeadingItem: ({ isShimmering, testId, width, cssFn, }: SkeletonHeadingItemProps) => jsx.JSX.Element;
|
|
178
|
+
|
|
179
|
+
// @public (undocumented)
|
|
180
|
+
export interface SkeletonHeadingItemProps {
|
|
181
|
+
// @deprecated
|
|
182
|
+
cssFn?: StatelessCSSFn;
|
|
183
|
+
isShimmering?: boolean;
|
|
184
|
+
testId?: string;
|
|
185
|
+
width?: Dimension;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// @public
|
|
189
|
+
export const SkeletonItem: ({ hasAvatar, hasIcon, isShimmering, testId, width, cssFn, }: SkeletonItemProps) => jsx.JSX.Element;
|
|
190
|
+
|
|
191
|
+
// @public (undocumented)
|
|
192
|
+
export interface SkeletonItemProps {
|
|
193
|
+
cssFn?: StatelessCSSFn;
|
|
194
|
+
hasAvatar?: boolean;
|
|
195
|
+
hasIcon?: boolean;
|
|
196
|
+
isShimmering?: boolean;
|
|
197
|
+
testId?: string;
|
|
198
|
+
width?: Dimension;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// @internal
|
|
202
|
+
export const SpacingContext: Context<SpacingMode>;
|
|
203
|
+
|
|
204
|
+
// @public (undocumented)
|
|
205
|
+
type SpacingMode = 'compact' | 'cozy';
|
|
206
|
+
|
|
207
|
+
// @public @deprecated (undocumented)
|
|
208
|
+
export type StatelessCSSFn = CSSFn<void>;
|
|
209
|
+
|
|
210
|
+
// @public @deprecated (undocumented)
|
|
211
|
+
export interface TitleOverrides {
|
|
212
|
+
// (undocumented)
|
|
213
|
+
render?: RenderFunction<{
|
|
214
|
+
className?: string;
|
|
215
|
+
children: ReactNode;
|
|
216
|
+
'data-item-title': boolean;
|
|
217
|
+
}>;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// (No @packageDocumentation comment for this package)
|
|
221
|
+
|
|
222
|
+
```
|