@atlaskit/menu 1.4.7 → 1.4.8
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/entry-points/menu-item/button-item.js +0 -2
- package/dist/cjs/entry-points/menu-item/custom-item.js +0 -2
- package/dist/cjs/entry-points/menu-item/heading-item.js +0 -2
- package/dist/cjs/entry-points/menu-item/link-item.js +0 -2
- package/dist/cjs/entry-points/menu-item/skeleton-heading-item.js +0 -2
- package/dist/cjs/entry-points/menu-item/skeleton-item.js +0 -2
- package/dist/cjs/entry-points/menu-section/menu-group.js +0 -2
- package/dist/cjs/entry-points/menu-section/popup-menu-group.js +0 -2
- package/dist/cjs/entry-points/menu-section/section.js +0 -2
- package/dist/cjs/index.js +0 -10
- package/dist/cjs/internal/components/menu-item-primitive.js +25 -34
- package/dist/cjs/internal/components/skeleton-shimmer.js +4 -8
- package/dist/cjs/menu-item/button-item.js +21 -30
- package/dist/cjs/menu-item/custom-item.js +24 -32
- package/dist/cjs/menu-item/heading-item.js +8 -17
- package/dist/cjs/menu-item/link-item.js +23 -33
- package/dist/cjs/menu-item/skeleton-heading-item.js +11 -16
- package/dist/cjs/menu-item/skeleton-item.js +11 -17
- package/dist/cjs/menu-section/menu-group.js +10 -17
- package/dist/cjs/menu-section/popup-menu-group.js +6 -13
- package/dist/cjs/menu-section/section.js +16 -24
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/internal/components/menu-item-primitive.js +9 -12
- package/dist/es2019/internal/components/skeleton-shimmer.js +3 -4
- package/dist/es2019/menu-item/button-item.js +4 -6
- package/dist/es2019/menu-item/custom-item.js +8 -7
- package/dist/es2019/menu-item/heading-item.js +3 -3
- package/dist/es2019/menu-item/link-item.js +5 -8
- package/dist/es2019/menu-item/skeleton-heading-item.js +6 -5
- package/dist/es2019/menu-item/skeleton-item.js +4 -3
- package/dist/es2019/menu-section/menu-group.js +4 -6
- package/dist/es2019/menu-section/popup-menu-group.js +3 -4
- package/dist/es2019/menu-section/section.js +9 -8
- package/dist/es2019/version.json +1 -1
- package/dist/esm/internal/components/menu-item-primitive.js +24 -27
- package/dist/esm/internal/components/skeleton-shimmer.js +5 -6
- package/dist/esm/menu-item/button-item.js +21 -24
- package/dist/esm/menu-item/custom-item.js +26 -26
- package/dist/esm/menu-item/heading-item.js +8 -9
- package/dist/esm/menu-item/link-item.js +23 -27
- package/dist/esm/menu-item/skeleton-heading-item.js +11 -10
- package/dist/esm/menu-item/skeleton-item.js +11 -10
- package/dist/esm/menu-section/menu-group.js +10 -13
- package/dist/esm/menu-section/popup-menu-group.js +7 -9
- package/dist/esm/menu-section/section.js +16 -16
- package/dist/esm/version.json +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { memo } from 'react';
|
|
5
4
|
import { css, jsx } from '@emotion/react';
|
|
@@ -19,6 +18,7 @@ const headingStyles = css({
|
|
|
19
18
|
lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
|
|
20
19
|
textTransform: 'uppercase'
|
|
21
20
|
});
|
|
21
|
+
|
|
22
22
|
/**
|
|
23
23
|
* __Heading item__
|
|
24
24
|
*
|
|
@@ -27,7 +27,6 @@ const headingStyles = css({
|
|
|
27
27
|
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/heading-item)
|
|
28
28
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
30
|
const HeadingItem = /*#__PURE__*/memo(({
|
|
32
31
|
children,
|
|
33
32
|
testId,
|
|
@@ -36,7 +35,8 @@ const HeadingItem = /*#__PURE__*/memo(({
|
|
|
36
35
|
...rest
|
|
37
36
|
}) => {
|
|
38
37
|
return jsx("div", _extends({
|
|
39
|
-
css: [headingStyles,
|
|
38
|
+
css: [headingStyles,
|
|
39
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
40
40
|
css(cssFn(undefined))],
|
|
41
41
|
"data-testid": testId,
|
|
42
42
|
"data-ds--menu--heading-item": true,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { forwardRef, memo } from 'react';
|
|
5
4
|
import { jsx } from '@emotion/react';
|
|
6
5
|
import noop from '@atlaskit/ds-lib/noop';
|
|
7
6
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
8
|
-
|
|
9
7
|
const preventEvent = e => {
|
|
10
8
|
e.preventDefault();
|
|
11
9
|
};
|
|
10
|
+
|
|
12
11
|
/**
|
|
13
12
|
* __Link item__
|
|
14
13
|
*
|
|
@@ -17,9 +16,8 @@ const preventEvent = e => {
|
|
|
17
16
|
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/link-item)
|
|
18
17
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
19
18
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef( // Type needed on props to extract types with extract react types.
|
|
19
|
+
const LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
20
|
+
// Type needed on props to extract types with extract react types.
|
|
23
21
|
(props, ref) => {
|
|
24
22
|
const {
|
|
25
23
|
children,
|
|
@@ -39,11 +37,9 @@ const LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef( // Type needed on p
|
|
|
39
37
|
...rest
|
|
40
38
|
} = props;
|
|
41
39
|
const onMouseDownHandler = onMouseDown;
|
|
42
|
-
|
|
43
40
|
if (!children) {
|
|
44
41
|
return null;
|
|
45
42
|
}
|
|
46
|
-
|
|
47
43
|
return jsx(MenuItemPrimitive, _extends({}, rest, {
|
|
48
44
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
49
45
|
overrides: overrides,
|
|
@@ -54,7 +50,8 @@ const LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef( // Type needed on p
|
|
|
54
50
|
description: description,
|
|
55
51
|
shouldTitleWrap: shouldTitleWrap,
|
|
56
52
|
shouldDescriptionWrap: shouldDescriptionWrap,
|
|
57
|
-
css:
|
|
53
|
+
css:
|
|
54
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
58
55
|
cssFn({
|
|
59
56
|
isSelected,
|
|
60
57
|
isDisabled
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
|
|
2
3
|
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import noop from '@atlaskit/ds-lib/noop';
|
|
4
5
|
import { N20A } from '@atlaskit/theme/colors';
|
|
5
6
|
import SkeletonShimmer from '../internal/components/skeleton-shimmer';
|
|
6
7
|
const skeletonStyles = css({
|
|
7
|
-
padding: `${"var(--ds-
|
|
8
|
+
padding: `${"var(--ds-space-0, 0px)"} ${"var(--ds-space-250, 20px)"}`,
|
|
8
9
|
'::after': {
|
|
9
10
|
display: 'block',
|
|
10
11
|
width: '30%',
|
|
11
|
-
height: "var(--ds-
|
|
12
|
+
height: "var(--ds-space-100, 8px)",
|
|
12
13
|
backgroundColor: `var(--ds-skeleton, ${N20A})`,
|
|
13
14
|
borderRadius: 100,
|
|
14
15
|
content: '""'
|
|
@@ -24,6 +25,7 @@ const customWidthStyles = css({
|
|
|
24
25
|
width: 'var(--width)'
|
|
25
26
|
}
|
|
26
27
|
});
|
|
28
|
+
|
|
27
29
|
/**
|
|
28
30
|
* __Skeleton heading item__
|
|
29
31
|
*
|
|
@@ -32,7 +34,6 @@ const customWidthStyles = css({
|
|
|
32
34
|
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/skeleton-heading-item)
|
|
33
35
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
34
36
|
*/
|
|
35
|
-
|
|
36
37
|
const SkeletonHeadingItem = ({
|
|
37
38
|
isShimmering = false,
|
|
38
39
|
testId,
|
|
@@ -47,10 +48,10 @@ const SkeletonHeadingItem = ({
|
|
|
47
48
|
style: {
|
|
48
49
|
'--width': width
|
|
49
50
|
},
|
|
50
|
-
css: [skeletonStyles, width ? customWidthStyles : defaultWidthStyles,
|
|
51
|
+
css: [skeletonStyles, width ? customWidthStyles : defaultWidthStyles,
|
|
52
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
51
53
|
css(cssFn(undefined))],
|
|
52
54
|
"data-ds--menu--skeleton-heading-item": true,
|
|
53
55
|
"data-testid": testId
|
|
54
56
|
}));
|
|
55
|
-
|
|
56
57
|
export default SkeletonHeadingItem;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
|
|
2
3
|
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import noop from '@atlaskit/ds-lib/noop';
|
|
4
5
|
import { N20A } from '@atlaskit/theme/colors';
|
|
@@ -78,6 +79,7 @@ const iconStyles = css({
|
|
|
78
79
|
borderRadius
|
|
79
80
|
}
|
|
80
81
|
});
|
|
82
|
+
|
|
81
83
|
/**
|
|
82
84
|
* __Skeleton item__
|
|
83
85
|
*
|
|
@@ -86,7 +88,6 @@ const iconStyles = css({
|
|
|
86
88
|
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/skeleton-item)
|
|
87
89
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
88
90
|
*/
|
|
89
|
-
|
|
90
91
|
const SkeletonItem = ({
|
|
91
92
|
hasAvatar,
|
|
92
93
|
hasIcon,
|
|
@@ -103,9 +104,9 @@ const SkeletonItem = ({
|
|
|
103
104
|
style: {
|
|
104
105
|
'--width': width
|
|
105
106
|
},
|
|
106
|
-
css: [skeletonStyles, (hasAvatar || hasIcon) && beforeElementStyles, hasAvatar && avatarStyles, hasIcon && iconStyles, width ? customWidthStyles : defaultWidthStyles,
|
|
107
|
+
css: [skeletonStyles, (hasAvatar || hasIcon) && beforeElementStyles, hasAvatar && avatarStyles, hasIcon && iconStyles, width ? customWidthStyles : defaultWidthStyles,
|
|
108
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
107
109
|
css(cssFn())],
|
|
108
110
|
"data-testid": testId
|
|
109
111
|
}));
|
|
110
|
-
|
|
111
112
|
export default SkeletonItem;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { jsx } from '@emotion/react';
|
|
5
4
|
import { UNSAFE_Box as Box } from '@atlaskit/ds-explorations';
|
|
6
|
-
|
|
7
5
|
/**
|
|
8
6
|
* __Menu group__
|
|
9
7
|
*
|
|
@@ -20,7 +18,8 @@ const MenuGroup = ({
|
|
|
20
18
|
testId,
|
|
21
19
|
role,
|
|
22
20
|
...rest
|
|
23
|
-
}) =>
|
|
21
|
+
}) =>
|
|
22
|
+
// @ts-ignore type of rest/children needs to be made stricter to fit in Box -- string shouldn't be allowed
|
|
24
23
|
jsx(Box, _extends({
|
|
25
24
|
UNSAFE_style: {
|
|
26
25
|
minWidth,
|
|
@@ -33,8 +32,7 @@ jsx(Box, _extends({
|
|
|
33
32
|
overflow: "auto",
|
|
34
33
|
testId: testId,
|
|
35
34
|
role: role,
|
|
36
|
-
position: "static"
|
|
37
|
-
|
|
35
|
+
position: "static"
|
|
36
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
38
37
|
}, rest));
|
|
39
|
-
|
|
40
38
|
export default MenuGroup;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { jsx } from '@emotion/react';
|
|
5
4
|
import MenuGroup from './menu-group';
|
|
5
|
+
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
9
|
const PopupMenuGroup = ({
|
|
11
10
|
maxWidth = 800,
|
|
12
11
|
minWidth = 320,
|
|
13
12
|
...rest
|
|
14
|
-
}) =>
|
|
13
|
+
}) =>
|
|
14
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
15
15
|
jsx(MenuGroup, _extends({
|
|
16
16
|
maxWidth: maxWidth,
|
|
17
17
|
minWidth: minWidth
|
|
18
18
|
}, rest));
|
|
19
|
-
|
|
20
19
|
export default PopupMenuGroup;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { forwardRef, Fragment } from 'react';
|
|
5
4
|
import { css, jsx } from '@emotion/react';
|
|
@@ -9,15 +8,15 @@ import { headingSizes } from '@atlaskit/theme/typography';
|
|
|
9
8
|
import HeadingItem from '../menu-item/heading-item';
|
|
10
9
|
const gridSize = gridSizeFn();
|
|
11
10
|
const itemHeadingTopMargin = gridSize * 2.5;
|
|
12
|
-
const itemHeadingBottomMargin = gridSize * 0.75;
|
|
11
|
+
const itemHeadingBottomMargin = gridSize * 0.75;
|
|
12
|
+
// Skeleton content is slightly shorter than the real content.
|
|
13
13
|
// Because of that we slightly increase the top margin to offset this so the
|
|
14
14
|
// containing size both real and skeleton always equal approx 30px.
|
|
15
|
-
|
|
16
15
|
const itemHeadingContentHeight = headingSizes.h100.lineHeight;
|
|
17
16
|
const skeletonHeadingHeight = gridSize;
|
|
18
17
|
const skeletonHeadingMarginOffset = 3;
|
|
19
|
-
const skeletonHeadingTopMargin = itemHeadingTopMargin + (itemHeadingContentHeight - skeletonHeadingHeight) - skeletonHeadingMarginOffset;
|
|
20
|
-
|
|
18
|
+
const skeletonHeadingTopMargin = itemHeadingTopMargin + (itemHeadingContentHeight - skeletonHeadingHeight) - skeletonHeadingMarginOffset;
|
|
19
|
+
// We want to move the entire body up by 3px without affecting the height of the skeleton container.
|
|
21
20
|
const skeletonHeadingBottomMargin = itemHeadingBottomMargin + skeletonHeadingMarginOffset;
|
|
22
21
|
const sectionPaddingTopBottom = gridSize * 0.75;
|
|
23
22
|
const VAR_SEPARATOR_COLOR = '--ds-menu-seperator-color';
|
|
@@ -68,6 +67,7 @@ const noSeparatorStyles = css({
|
|
|
68
67
|
marginTop: -6
|
|
69
68
|
}
|
|
70
69
|
});
|
|
70
|
+
|
|
71
71
|
/**
|
|
72
72
|
* __Section__
|
|
73
73
|
*
|
|
@@ -76,7 +76,6 @@ const noSeparatorStyles = css({
|
|
|
76
76
|
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/section)
|
|
77
77
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
78
78
|
*/
|
|
79
|
-
|
|
80
79
|
const Section = /*#__PURE__*/forwardRef(({
|
|
81
80
|
children,
|
|
82
81
|
overrides,
|
|
@@ -87,14 +86,16 @@ const Section = /*#__PURE__*/forwardRef(({
|
|
|
87
86
|
id,
|
|
88
87
|
...rest
|
|
89
88
|
}, ref) => {
|
|
90
|
-
const childrenMarkup = title !== undefined ? jsx(Fragment, null, jsx(HeadingItem
|
|
89
|
+
const childrenMarkup = title !== undefined ? jsx(Fragment, null, jsx(HeadingItem
|
|
90
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
91
91
|
, {
|
|
92
92
|
cssFn: overrides && overrides.HeadingItem && overrides.HeadingItem.cssFn,
|
|
93
93
|
testId: testId && `${testId}--heading`,
|
|
94
94
|
"aria-hidden": true
|
|
95
95
|
}, title), children) : children;
|
|
96
96
|
return jsx("div", _extends({}, rest, {
|
|
97
|
-
id: id
|
|
97
|
+
id: id
|
|
98
|
+
// NOTE: Firefox allows elements that have "overflow: auto" to gain focus (as if it had tab-index="0")
|
|
98
99
|
// We have made a deliberate choice to leave this behaviour as is.
|
|
99
100
|
,
|
|
100
101
|
css: [sectionStyles, isScrollable ? scrollableStyles : unscrollableStyles, hasSeparator ? separatorStyles : noSeparatorStyles],
|
package/dist/es2019/version.json
CHANGED
|
@@ -5,24 +5,23 @@ import FocusRing from '@atlaskit/focus-ring';
|
|
|
5
5
|
import { N20, N200, N30 } from '@atlaskit/theme/colors';
|
|
6
6
|
import { fontSize as fontSizeFn } from '@atlaskit/theme/constants';
|
|
7
7
|
import { headingSizes } from '@atlaskit/theme/typography';
|
|
8
|
-
|
|
9
8
|
var defaultRender = function defaultRender(Component, props) {
|
|
10
|
-
return (
|
|
9
|
+
return (
|
|
10
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
11
11
|
jsx(Component, props)
|
|
12
12
|
);
|
|
13
13
|
};
|
|
14
|
-
|
|
15
14
|
var fontSize = fontSizeFn();
|
|
16
|
-
var itemMinHeight = "var(--ds-
|
|
15
|
+
var itemMinHeight = "var(--ds-space-500, 40px)";
|
|
17
16
|
var beforeElementStyles = css({
|
|
18
17
|
display: 'flex',
|
|
19
|
-
marginRight: "var(--ds-
|
|
18
|
+
marginRight: "var(--ds-space-150, 12px)",
|
|
20
19
|
alignItems: 'center',
|
|
21
20
|
flexShrink: 0
|
|
22
21
|
});
|
|
23
22
|
var afterElementStyles = css({
|
|
24
23
|
display: 'flex',
|
|
25
|
-
marginLeft: "var(--ds-
|
|
24
|
+
marginLeft: "var(--ds-space-150, 12px)",
|
|
26
25
|
alignItems: 'center',
|
|
27
26
|
flexShrink: 0
|
|
28
27
|
});
|
|
@@ -48,7 +47,7 @@ var wordBreakStyles = css({
|
|
|
48
47
|
wordBreak: 'break-word'
|
|
49
48
|
});
|
|
50
49
|
var descriptionStyles = css({
|
|
51
|
-
marginTop: "var(--ds-
|
|
50
|
+
marginTop: "var(--ds-space-050, 3px)",
|
|
52
51
|
color: "var(--ds-text-subtlest, ".concat(N200, ")"),
|
|
53
52
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
|
|
54
53
|
fontSize: headingSizes.h200.size
|
|
@@ -61,10 +60,9 @@ var primitiveStyles = css({
|
|
|
61
60
|
boxSizing: 'border-box',
|
|
62
61
|
width: '100%',
|
|
63
62
|
minHeight: itemMinHeight,
|
|
64
|
-
|
|
65
|
-
margin: "var(--ds-scale-0, 0px)",
|
|
63
|
+
margin: "var(--ds-space-0, 0px)",
|
|
66
64
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
|
|
67
|
-
padding: "var(--ds-
|
|
65
|
+
padding: "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-250, 20px)"),
|
|
68
66
|
alignItems: 'center',
|
|
69
67
|
border: 0,
|
|
70
68
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
|
|
@@ -121,6 +119,7 @@ var selectedStyles = css({
|
|
|
121
119
|
color: "var(--ds-text-selected, currentColor)"
|
|
122
120
|
}
|
|
123
121
|
});
|
|
122
|
+
|
|
124
123
|
/**
|
|
125
124
|
* __Menu item primitive__
|
|
126
125
|
*
|
|
@@ -135,27 +134,26 @@ var selectedStyles = css({
|
|
|
135
134
|
* </MenuItemPrimitive>
|
|
136
135
|
* ```
|
|
137
136
|
*/
|
|
138
|
-
|
|
139
137
|
var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
140
138
|
var children = _ref.children,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
139
|
+
title = _ref.title,
|
|
140
|
+
description = _ref.description,
|
|
141
|
+
iconAfter = _ref.iconAfter,
|
|
142
|
+
iconBefore = _ref.iconBefore,
|
|
143
|
+
overrides = _ref.overrides,
|
|
144
|
+
className = _ref.className,
|
|
145
|
+
_ref$shouldTitleWrap = _ref.shouldTitleWrap,
|
|
146
|
+
shouldTitleWrap = _ref$shouldTitleWrap === void 0 ? false : _ref$shouldTitleWrap,
|
|
147
|
+
_ref$shouldDescriptio = _ref.shouldDescriptionWrap,
|
|
148
|
+
shouldDescriptionWrap = _ref$shouldDescriptio === void 0 ? false : _ref$shouldDescriptio,
|
|
149
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
150
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
151
|
+
_ref$isSelected = _ref.isSelected,
|
|
152
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected;
|
|
155
153
|
var renderTitle = overrides && overrides.Title && overrides.Title.render || defaultRender;
|
|
156
154
|
return jsx(ClassNames, null, function (_ref2) {
|
|
157
155
|
var cn = _ref2.css,
|
|
158
|
-
|
|
156
|
+
cx = _ref2.cx;
|
|
159
157
|
return jsx(FocusRing, {
|
|
160
158
|
isInset: true
|
|
161
159
|
}, children({
|
|
@@ -179,5 +177,4 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
|
179
177
|
}));
|
|
180
178
|
});
|
|
181
179
|
};
|
|
182
|
-
|
|
183
180
|
export default MenuItemPrimitive;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
|
|
2
3
|
import { ClassNames, css, jsx, keyframes } from '@emotion/react';
|
|
3
4
|
import { N20A, N30A } from '@atlaskit/theme/colors';
|
|
4
|
-
|
|
5
5
|
/**
|
|
6
6
|
* These keyframes are mirrored in:
|
|
7
7
|
* packages/design-system/theme/src/constants.tsx
|
|
@@ -16,13 +16,13 @@ var shimmerKeyframes = keyframes({
|
|
|
16
16
|
backgroundColor: "var(--ds-skeleton-subtle, ".concat(N30A, ")")
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
+
|
|
19
20
|
/**
|
|
20
21
|
* These styles are mirrored in:
|
|
21
22
|
* packages/design-system/theme/src/constants.tsx
|
|
22
23
|
*
|
|
23
24
|
* Please update both.
|
|
24
25
|
*/
|
|
25
|
-
|
|
26
26
|
var shimmerStyles = css({
|
|
27
27
|
'::before, ::after': {
|
|
28
28
|
animationDirection: 'alternate',
|
|
@@ -33,6 +33,7 @@ var shimmerStyles = css({
|
|
|
33
33
|
backgroundColor: "var(--ds-skeleton, ".concat(N20A, ")")
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
|
|
36
37
|
/**
|
|
37
38
|
* __Skeleton shimmer__
|
|
38
39
|
*
|
|
@@ -46,11 +47,10 @@ var shimmerStyles = css({
|
|
|
46
47
|
*
|
|
47
48
|
* @internal
|
|
48
49
|
*/
|
|
49
|
-
|
|
50
50
|
var SkeletonShimmer = function SkeletonShimmer(_ref) {
|
|
51
51
|
var children = _ref.children,
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
_ref$isShimmering = _ref.isShimmering,
|
|
53
|
+
isShimmering = _ref$isShimmering === void 0 ? false : _ref$isShimmering;
|
|
54
54
|
return jsx(ClassNames, null, function (_ref2) {
|
|
55
55
|
var css = _ref2.css;
|
|
56
56
|
return children({
|
|
@@ -58,5 +58,4 @@ var SkeletonShimmer = function SkeletonShimmer(_ref) {
|
|
|
58
58
|
});
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
|
-
|
|
62
61
|
export default SkeletonShimmer;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["children", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap"];
|
|
4
|
-
|
|
5
4
|
/** @jsx jsx */
|
|
6
5
|
import { forwardRef, memo } from 'react';
|
|
7
6
|
import { jsx } from '@emotion/react';
|
|
8
7
|
import noop from '@atlaskit/ds-lib/noop';
|
|
9
8
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
10
|
-
|
|
11
9
|
/**
|
|
12
10
|
* __Button item__
|
|
13
11
|
*
|
|
@@ -16,32 +14,30 @@ import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
|
16
14
|
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/button-item)
|
|
17
15
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
18
16
|
*/
|
|
19
|
-
var ButtonItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
17
|
+
var ButtonItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
18
|
+
// Type needed on props to extract types with extract react types.
|
|
20
19
|
function (props, ref) {
|
|
21
20
|
var children = props.children,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
_props$cssFn = props.cssFn,
|
|
22
|
+
cssFn = _props$cssFn === void 0 ? noop : _props$cssFn,
|
|
23
|
+
description = props.description,
|
|
24
|
+
iconAfter = props.iconAfter,
|
|
25
|
+
iconBefore = props.iconBefore,
|
|
26
|
+
_props$isDisabled = props.isDisabled,
|
|
27
|
+
isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
|
|
28
|
+
_props$isSelected = props.isSelected,
|
|
29
|
+
isSelected = _props$isSelected === void 0 ? false : _props$isSelected,
|
|
30
|
+
onClick = props.onClick,
|
|
31
|
+
testId = props.testId,
|
|
32
|
+
overrides = props.overrides,
|
|
33
|
+
onMouseDown = props.onMouseDown,
|
|
34
|
+
shouldTitleWrap = props.shouldTitleWrap,
|
|
35
|
+
shouldDescriptionWrap = props.shouldDescriptionWrap,
|
|
36
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
39
37
|
var onMouseDownHandler = onMouseDown;
|
|
40
|
-
|
|
41
38
|
if (!children) {
|
|
42
39
|
return null;
|
|
43
40
|
}
|
|
44
|
-
|
|
45
41
|
return jsx(MenuItemPrimitive, _extends({}, rest, {
|
|
46
42
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
47
43
|
overrides: overrides,
|
|
@@ -53,14 +49,15 @@ function (props, ref) {
|
|
|
53
49
|
title: children,
|
|
54
50
|
shouldTitleWrap: shouldTitleWrap,
|
|
55
51
|
shouldDescriptionWrap: shouldDescriptionWrap,
|
|
56
|
-
css:
|
|
52
|
+
css:
|
|
53
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
57
54
|
cssFn({
|
|
58
55
|
isSelected: isSelected,
|
|
59
56
|
isDisabled: isDisabled
|
|
60
57
|
})
|
|
61
58
|
}), function (_ref) {
|
|
62
59
|
var children = _ref.children,
|
|
63
|
-
|
|
60
|
+
className = _ref.className;
|
|
64
61
|
return jsx("button", _extends({
|
|
65
62
|
"data-testid": testId
|
|
66
63
|
}, rest, {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["component", "cssFn", "isDisabled", "isSelected", "onClick", "testId", "children", "description", "iconAfter", "iconBefore", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap"];
|
|
4
|
-
|
|
5
4
|
/** @jsx jsx */
|
|
5
|
+
|
|
6
6
|
import { forwardRef, memo } from 'react';
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
8
|
import noop from '@atlaskit/ds-lib/noop';
|
|
9
9
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
10
|
-
|
|
11
10
|
var preventEvent = function preventEvent(e) {
|
|
12
11
|
e.preventDefault();
|
|
13
|
-
};
|
|
12
|
+
};
|
|
14
13
|
|
|
14
|
+
// Dirty hack to get generics working with forward ref [1/2]
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* __Custom item__
|
|
@@ -23,30 +23,27 @@ var preventEvent = function preventEvent(e) {
|
|
|
23
23
|
*/
|
|
24
24
|
var CustomItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
25
25
|
var Component = _ref.component,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
26
|
+
_ref$cssFn = _ref.cssFn,
|
|
27
|
+
cssFn = _ref$cssFn === void 0 ? noop : _ref$cssFn,
|
|
28
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
29
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
30
|
+
_ref$isSelected = _ref.isSelected,
|
|
31
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
32
|
+
onClick = _ref.onClick,
|
|
33
|
+
testId = _ref.testId,
|
|
34
|
+
children = _ref.children,
|
|
35
|
+
description = _ref.description,
|
|
36
|
+
iconAfter = _ref.iconAfter,
|
|
37
|
+
iconBefore = _ref.iconBefore,
|
|
38
|
+
overrides = _ref.overrides,
|
|
39
|
+
onMouseDown = _ref.onMouseDown,
|
|
40
|
+
shouldTitleWrap = _ref.shouldTitleWrap,
|
|
41
|
+
shouldDescriptionWrap = _ref.shouldDescriptionWrap,
|
|
42
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
44
43
|
var onMouseDownHandler = onMouseDown;
|
|
45
|
-
|
|
46
44
|
if (!Component) {
|
|
47
45
|
return null;
|
|
48
46
|
}
|
|
49
|
-
|
|
50
47
|
return jsx(MenuItemPrimitive, _extends({}, rest, {
|
|
51
48
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
52
49
|
overrides: overrides,
|
|
@@ -57,7 +54,8 @@ var CustomItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref)
|
|
|
57
54
|
isSelected: isSelected,
|
|
58
55
|
isDisabled: isDisabled,
|
|
59
56
|
shouldTitleWrap: shouldTitleWrap,
|
|
60
|
-
shouldDescriptionWrap: shouldDescriptionWrap
|
|
57
|
+
shouldDescriptionWrap: shouldDescriptionWrap
|
|
58
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
61
59
|
,
|
|
62
60
|
css: css(cssFn({
|
|
63
61
|
isDisabled: isDisabled,
|
|
@@ -65,7 +63,7 @@ var CustomItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref)
|
|
|
65
63
|
}))
|
|
66
64
|
}), function (_ref2) {
|
|
67
65
|
var children = _ref2.children,
|
|
68
|
-
|
|
66
|
+
className = _ref2.className;
|
|
69
67
|
return jsx(Component, _extends({
|
|
70
68
|
"data-testid": testId
|
|
71
69
|
}, rest, {
|
|
@@ -79,6 +77,8 @@ var CustomItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref)
|
|
|
79
77
|
"aria-disabled": isDisabled
|
|
80
78
|
}), children);
|
|
81
79
|
});
|
|
82
|
-
})
|
|
80
|
+
})
|
|
81
|
+
// Dirty hack to get generics working with forward ref [2/2]
|
|
83
82
|
);
|
|
83
|
+
|
|
84
84
|
export default CustomItem;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["children", "testId", "id", "cssFn"];
|
|
4
|
-
|
|
5
4
|
/** @jsx jsx */
|
|
6
5
|
import { memo } from 'react';
|
|
7
6
|
import { css, jsx } from '@emotion/react';
|
|
@@ -21,6 +20,7 @@ var headingStyles = css({
|
|
|
21
20
|
lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
|
|
22
21
|
textTransform: 'uppercase'
|
|
23
22
|
});
|
|
23
|
+
|
|
24
24
|
/**
|
|
25
25
|
* __Heading item__
|
|
26
26
|
*
|
|
@@ -29,17 +29,16 @@ var headingStyles = css({
|
|
|
29
29
|
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/heading-item)
|
|
30
30
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
31
31
|
*/
|
|
32
|
-
|
|
33
32
|
var HeadingItem = /*#__PURE__*/memo(function (_ref) {
|
|
34
33
|
var children = _ref.children,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
testId = _ref.testId,
|
|
35
|
+
id = _ref.id,
|
|
36
|
+
_ref$cssFn = _ref.cssFn,
|
|
37
|
+
cssFn = _ref$cssFn === void 0 ? noop : _ref$cssFn,
|
|
38
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
41
39
|
return jsx("div", _extends({
|
|
42
|
-
css: [headingStyles,
|
|
40
|
+
css: [headingStyles,
|
|
41
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
43
42
|
css(cssFn(undefined))],
|
|
44
43
|
"data-testid": testId,
|
|
45
44
|
"data-ds--menu--heading-item": true,
|