@atlaskit/menu 1.4.10 → 1.5.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 +17 -0
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/internal/components/menu-context.js +16 -0
- package/dist/cjs/internal/components/menu-item-primitive.js +40 -26
- package/dist/cjs/menu-item/heading-item.js +2 -1
- package/dist/cjs/menu-item/skeleton-heading-item.js +2 -1
- package/dist/cjs/menu-section/menu-group.js +21 -19
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/internal/components/menu-context.js +9 -0
- package/dist/es2019/internal/components/menu-item-primitive.js +41 -27
- package/dist/es2019/menu-item/heading-item.js +2 -1
- package/dist/es2019/menu-item/skeleton-heading-item.js +2 -1
- package/dist/es2019/menu-section/menu-group.js +6 -4
- package/dist/es2019/menu-section/section.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/internal/components/menu-context.js +9 -0
- package/dist/esm/internal/components/menu-item-primitive.js +41 -27
- package/dist/esm/menu-item/heading-item.js +2 -1
- package/dist/esm/menu-item/skeleton-heading-item.js +2 -1
- package/dist/esm/menu-section/menu-group.js +21 -19
- package/dist/esm/menu-section/section.js +1 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/internal/components/menu-context.d.ts +10 -0
- package/dist/types/menu-section/menu-group.d.ts +1 -1
- package/dist/types/types.d.ts +5 -0
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/menu
|
|
2
2
|
|
|
3
|
+
## 1.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`261420360ec`](https://bitbucket.org/atlassian/atlassian-frontend/commits/261420360ec) - Upgrades component types to support React 18.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 1.5.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`93d761786d6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/93d761786d6) - [ux] Default spacing for all menu items has been changed from 20px inline padding to 16px.
|
|
15
|
+
|
|
16
|
+
Adds a new spacing prop to on `MenuGroup`. The prop can be used to control the content density of the component and its children.
|
|
17
|
+
|
|
18
|
+
Adds a new internal export `SpacingContext`. This should not be used directly.
|
|
19
|
+
|
|
3
20
|
## 1.4.10
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -58,10 +58,17 @@ Object.defineProperty(exports, "SkeletonItem", {
|
|
|
58
58
|
return _skeletonItem.default;
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
|
+
Object.defineProperty(exports, "SpacingContext", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function get() {
|
|
64
|
+
return _menuContext.SpacingContext;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
61
67
|
var _buttonItem = _interopRequireDefault(require("./menu-item/button-item"));
|
|
62
68
|
var _linkItem = _interopRequireDefault(require("./menu-item/link-item"));
|
|
63
69
|
var _customItem = _interopRequireDefault(require("./menu-item/custom-item"));
|
|
64
70
|
var _skeletonItem = _interopRequireDefault(require("./menu-item/skeleton-item"));
|
|
71
|
+
var _menuContext = require("./internal/components/menu-context");
|
|
65
72
|
var _headingItem = _interopRequireDefault(require("./menu-item/heading-item"));
|
|
66
73
|
var _skeletonHeadingItem = _interopRequireDefault(require("./menu-item/skeleton-heading-item"));
|
|
67
74
|
var _section = _interopRequireDefault(require("./menu-section/section"));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SpacingContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* __Spacing context__
|
|
10
|
+
*
|
|
11
|
+
* The spacing context is used to provide spacing values to menu item primitives.
|
|
12
|
+
*
|
|
13
|
+
* @internal Do not use directly.
|
|
14
|
+
*/
|
|
15
|
+
var SpacingContext = /*#__PURE__*/(0, _react.createContext)('cozy');
|
|
16
|
+
exports.SpacingContext = SpacingContext;
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _react2 = require("@emotion/react");
|
|
10
|
+
var _inline = _interopRequireDefault(require("@atlaskit/ds-explorations/inline"));
|
|
10
11
|
var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
|
|
11
12
|
var _colors = require("@atlaskit/theme/colors");
|
|
12
|
-
var
|
|
13
|
-
var _typography = require("@atlaskit/theme/typography");
|
|
13
|
+
var _menuContext = require("./menu-context");
|
|
14
14
|
/** @jsx jsx */
|
|
15
15
|
|
|
16
16
|
var defaultRender = function defaultRender(Component, props) {
|
|
@@ -19,18 +19,10 @@ var defaultRender = function defaultRender(Component, props) {
|
|
|
19
19
|
(0, _react2.jsx)(Component, props)
|
|
20
20
|
);
|
|
21
21
|
};
|
|
22
|
-
var
|
|
23
|
-
var itemMinHeight = "var(--ds-space-500, 40px)";
|
|
24
|
-
var beforeElementStyles = (0, _react2.css)({
|
|
22
|
+
var beforeAfterElementStyles = (0, _react2.css)({
|
|
25
23
|
display: 'flex',
|
|
26
|
-
marginRight: "var(--ds-space-150, 12px)",
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
flexShrink: 0
|
|
29
|
-
});
|
|
30
|
-
var afterElementStyles = (0, _react2.css)({
|
|
31
|
-
display: 'flex',
|
|
32
|
-
marginLeft: "var(--ds-space-150, 12px)",
|
|
33
24
|
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center',
|
|
34
26
|
flexShrink: 0
|
|
35
27
|
});
|
|
36
28
|
var contentStyles = (0, _react2.css)({
|
|
@@ -39,8 +31,7 @@ var contentStyles = (0, _react2.css)({
|
|
|
39
31
|
flexDirection: 'column',
|
|
40
32
|
flexGrow: 1,
|
|
41
33
|
// Fix - avoid clipped text descenders when using standard 16px line-height
|
|
42
|
-
|
|
43
|
-
lineHeight: 1.22,
|
|
34
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)",
|
|
44
35
|
outline: 'none',
|
|
45
36
|
overflow: 'hidden',
|
|
46
37
|
textAlign: 'left'
|
|
@@ -55,10 +46,9 @@ var wordBreakStyles = (0, _react2.css)({
|
|
|
55
46
|
wordBreak: 'break-word'
|
|
56
47
|
});
|
|
57
48
|
var descriptionStyles = (0, _react2.css)({
|
|
58
|
-
marginTop: "var(--ds-space-050,
|
|
49
|
+
marginTop: "var(--ds-space-050, 4px)",
|
|
59
50
|
color: "var(--ds-text-subtlest, ".concat(_colors.N200, ")"),
|
|
60
|
-
|
|
61
|
-
fontSize: _typography.headingSizes.h200.size
|
|
51
|
+
fontSize: "var(--ds-font-size-075, 12px)"
|
|
62
52
|
});
|
|
63
53
|
var disabledDescriptionStyles = (0, _react2.css)({
|
|
64
54
|
color: "var(--ds-text-disabled, ".concat(_colors.N200, ")")
|
|
@@ -67,14 +57,11 @@ var primitiveStyles = (0, _react2.css)({
|
|
|
67
57
|
display: 'flex',
|
|
68
58
|
boxSizing: 'border-box',
|
|
69
59
|
width: '100%',
|
|
70
|
-
minHeight:
|
|
60
|
+
minHeight: 40,
|
|
71
61
|
margin: "var(--ds-space-0, 0px)",
|
|
72
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
|
|
73
|
-
padding: "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-250, 20px)"),
|
|
74
62
|
alignItems: 'center',
|
|
75
63
|
border: 0,
|
|
76
|
-
|
|
77
|
-
fontSize: fontSize,
|
|
64
|
+
fontSize: "var(--ds-font-size-100, 14px)",
|
|
78
65
|
outline: 0,
|
|
79
66
|
textDecoration: 'none',
|
|
80
67
|
userSelect: 'none',
|
|
@@ -85,6 +72,20 @@ var primitiveStyles = (0, _react2.css)({
|
|
|
85
72
|
textDecoration: 'none'
|
|
86
73
|
}
|
|
87
74
|
});
|
|
75
|
+
var spacingMapStyles = {
|
|
76
|
+
cozy: (0, _react2.css)({
|
|
77
|
+
// 8 * 2 (16) + icon (24) === 40
|
|
78
|
+
paddingBlock: "var(--ds-space-100, 8px)",
|
|
79
|
+
paddingInline: "var(--ds-space-200, 16px)"
|
|
80
|
+
}),
|
|
81
|
+
compact: (0, _react2.css)({
|
|
82
|
+
minHeight: 32,
|
|
83
|
+
maxHeight: 32,
|
|
84
|
+
// 4 * 2 (8) + icon (24) === 32
|
|
85
|
+
paddingBlock: "var(--ds-space-050, 4px)",
|
|
86
|
+
paddingInline: "var(--ds-space-150, 12px)"
|
|
87
|
+
})
|
|
88
|
+
};
|
|
88
89
|
var interactiveStyles = (0, _react2.css)({
|
|
89
90
|
cursor: 'pointer'
|
|
90
91
|
});
|
|
@@ -127,6 +128,10 @@ var selectedStyles = (0, _react2.css)({
|
|
|
127
128
|
color: "var(--ds-text-selected, currentColor)"
|
|
128
129
|
}
|
|
129
130
|
});
|
|
131
|
+
var gapMap = {
|
|
132
|
+
compact: 'space.100',
|
|
133
|
+
cozy: 'space.150'
|
|
134
|
+
};
|
|
130
135
|
|
|
131
136
|
/**
|
|
132
137
|
* __Menu item primitive__
|
|
@@ -158,6 +163,7 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
|
158
163
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
159
164
|
_ref$isSelected = _ref.isSelected,
|
|
160
165
|
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected;
|
|
166
|
+
var spacing = (0, _react.useContext)(_menuContext.SpacingContext);
|
|
161
167
|
var renderTitle = overrides && overrides.Title && overrides.Title.render || defaultRender;
|
|
162
168
|
return (0, _react2.jsx)(_react2.ClassNames, null, function (_ref2) {
|
|
163
169
|
var cn = _ref2.css,
|
|
@@ -165,10 +171,18 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
|
165
171
|
return (0, _react2.jsx)(_focusRing.default, {
|
|
166
172
|
isInset: true
|
|
167
173
|
}, children({
|
|
168
|
-
className: cx([cn([primitiveStyles, !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && selectedStyles, isDisabled ? disabledStyles : interactiveStyles]), className]),
|
|
169
|
-
children: (0, _react2.jsx)(
|
|
174
|
+
className: cx([cn([primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && selectedStyles, isDisabled ? disabledStyles : interactiveStyles]), className]),
|
|
175
|
+
children: (0, _react2.jsx)(_inline.default, {
|
|
176
|
+
justifyContent: "space-between",
|
|
177
|
+
alignItems: "center",
|
|
178
|
+
gap: gapMap[spacing],
|
|
179
|
+
UNSAFE_style: {
|
|
180
|
+
flexGrow: 1,
|
|
181
|
+
width: '100%'
|
|
182
|
+
}
|
|
183
|
+
}, iconBefore && (0, _react2.jsx)("span", {
|
|
170
184
|
"data-item-elem-before": true,
|
|
171
|
-
css:
|
|
185
|
+
css: beforeAfterElementStyles
|
|
172
186
|
}, iconBefore), title && (0, _react2.jsx)("span", {
|
|
173
187
|
css: contentStyles
|
|
174
188
|
}, renderTitle('span', {
|
|
@@ -180,7 +194,7 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
|
180
194
|
css: [descriptionStyles, isDisabled && disabledDescriptionStyles, shouldDescriptionWrap ? wordBreakStyles : truncateStyles]
|
|
181
195
|
}, description)), iconAfter && (0, _react2.jsx)("span", {
|
|
182
196
|
"data-item-elem-after": true,
|
|
183
|
-
css:
|
|
197
|
+
css: beforeAfterElementStyles
|
|
184
198
|
}, iconAfter))
|
|
185
199
|
}));
|
|
186
200
|
});
|
|
@@ -16,11 +16,12 @@ var _excluded = ["children", "testId", "id", "cssFn"];
|
|
|
16
16
|
var itemHeadingContentHeight = _typography.headingSizes.h100.lineHeight;
|
|
17
17
|
var itemHeadingFontSize = _typography.headingSizes.h100.size;
|
|
18
18
|
var headingStyles = (0, _react2.css)({
|
|
19
|
-
padding: "0 ".concat("var(--ds-space-250, 20px)"),
|
|
20
19
|
color: "var(--ds-text-subtle, ".concat(_colors.N300, ")"),
|
|
21
20
|
fontSize: itemHeadingFontSize,
|
|
22
21
|
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
23
22
|
lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
|
|
23
|
+
paddingBlock: "var(--ds-space-0, 0px)",
|
|
24
|
+
paddingInline: "var(--ds-space-200, 16px)",
|
|
24
25
|
textTransform: 'uppercase'
|
|
25
26
|
});
|
|
26
27
|
|
|
@@ -12,7 +12,8 @@ var _skeletonShimmer = _interopRequireDefault(require("../internal/components/sk
|
|
|
12
12
|
/** @jsx jsx */
|
|
13
13
|
|
|
14
14
|
var skeletonStyles = (0, _react.css)({
|
|
15
|
-
|
|
15
|
+
paddingBlock: "var(--ds-space-0, 0px)",
|
|
16
|
+
paddingInline: "var(--ds-space-200, 16px)",
|
|
16
17
|
'::after': {
|
|
17
18
|
display: 'block',
|
|
18
19
|
width: '30%',
|
|
@@ -9,7 +9,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = require("@emotion/react");
|
|
11
11
|
var _dsExplorations = require("@atlaskit/ds-explorations");
|
|
12
|
-
var
|
|
12
|
+
var _menuContext = require("../internal/components/menu-context");
|
|
13
|
+
var _excluded = ["maxWidth", "minWidth", "minHeight", "maxHeight", "testId", "role", "spacing"];
|
|
13
14
|
/**
|
|
14
15
|
* __Menu group__
|
|
15
16
|
*
|
|
@@ -25,25 +26,26 @@ var MenuGroup = function MenuGroup(_ref) {
|
|
|
25
26
|
maxHeight = _ref.maxHeight,
|
|
26
27
|
testId = _ref.testId,
|
|
27
28
|
role = _ref.role,
|
|
29
|
+
_ref$spacing = _ref.spacing,
|
|
30
|
+
spacing = _ref$spacing === void 0 ? 'cozy' : _ref$spacing,
|
|
28
31
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
29
|
-
return (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
);
|
|
32
|
+
return (0, _react.jsx)(_menuContext.SpacingContext.Provider, {
|
|
33
|
+
value: spacing
|
|
34
|
+
}, (0, _react.jsx)(_dsExplorations.UNSAFE_Box, (0, _extends2.default)({
|
|
35
|
+
UNSAFE_style: {
|
|
36
|
+
minWidth: minWidth,
|
|
37
|
+
maxWidth: maxWidth,
|
|
38
|
+
minHeight: minHeight,
|
|
39
|
+
maxHeight: maxHeight
|
|
40
|
+
},
|
|
41
|
+
display: "flex",
|
|
42
|
+
flexDirection: "column",
|
|
43
|
+
overflow: "auto",
|
|
44
|
+
testId: testId,
|
|
45
|
+
role: role,
|
|
46
|
+
position: "static"
|
|
47
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
48
|
+
}, rest)));
|
|
47
49
|
};
|
|
48
50
|
var _default = MenuGroup;
|
|
49
51
|
exports.default = _default;
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { default as ButtonItem } from './menu-item/button-item';
|
|
|
2
2
|
export { default as LinkItem } from './menu-item/link-item';
|
|
3
3
|
export { default as CustomItem } from './menu-item/custom-item';
|
|
4
4
|
export { default as SkeletonItem } from './menu-item/skeleton-item';
|
|
5
|
+
export { SpacingContext } from './internal/components/menu-context';
|
|
5
6
|
export { default as HeadingItem } from './menu-item/heading-item';
|
|
6
7
|
export { default as SkeletonHeadingItem } from './menu-item/skeleton-heading-item';
|
|
7
8
|
export { default as Section } from './menu-section/section';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __Spacing context__
|
|
4
|
+
*
|
|
5
|
+
* The spacing context is used to provide spacing values to menu item primitives.
|
|
6
|
+
*
|
|
7
|
+
* @internal Do not use directly.
|
|
8
|
+
*/
|
|
9
|
+
export const SpacingContext = /*#__PURE__*/createContext('cozy');
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import {
|
|
2
|
+
import { useContext } from 'react';
|
|
3
3
|
import { ClassNames, css, jsx } from '@emotion/react';
|
|
4
|
+
import Inline from '@atlaskit/ds-explorations/inline';
|
|
4
5
|
import FocusRing from '@atlaskit/focus-ring';
|
|
5
6
|
import { N20, N200, N30 } from '@atlaskit/theme/colors';
|
|
6
|
-
import {
|
|
7
|
-
import { headingSizes } from '@atlaskit/theme/typography';
|
|
7
|
+
import { SpacingContext } from './menu-context';
|
|
8
8
|
const defaultRender = (Component, props) =>
|
|
9
9
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
10
10
|
jsx(Component, props);
|
|
11
|
-
const
|
|
12
|
-
const itemMinHeight = "var(--ds-space-500, 40px)";
|
|
13
|
-
const beforeElementStyles = css({
|
|
11
|
+
const beforeAfterElementStyles = css({
|
|
14
12
|
display: 'flex',
|
|
15
|
-
marginRight: "var(--ds-space-150, 12px)",
|
|
16
|
-
alignItems: 'center',
|
|
17
|
-
flexShrink: 0
|
|
18
|
-
});
|
|
19
|
-
const afterElementStyles = css({
|
|
20
|
-
display: 'flex',
|
|
21
|
-
marginLeft: "var(--ds-space-150, 12px)",
|
|
22
13
|
alignItems: 'center',
|
|
14
|
+
justifyContent: 'center',
|
|
23
15
|
flexShrink: 0
|
|
24
16
|
});
|
|
25
17
|
const contentStyles = css({
|
|
@@ -28,8 +20,7 @@ const contentStyles = css({
|
|
|
28
20
|
flexDirection: 'column',
|
|
29
21
|
flexGrow: 1,
|
|
30
22
|
// Fix - avoid clipped text descenders when using standard 16px line-height
|
|
31
|
-
|
|
32
|
-
lineHeight: 1.22,
|
|
23
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)",
|
|
33
24
|
outline: 'none',
|
|
34
25
|
overflow: 'hidden',
|
|
35
26
|
textAlign: 'left'
|
|
@@ -44,10 +35,9 @@ const wordBreakStyles = css({
|
|
|
44
35
|
wordBreak: 'break-word'
|
|
45
36
|
});
|
|
46
37
|
const descriptionStyles = css({
|
|
47
|
-
marginTop: "var(--ds-space-050,
|
|
38
|
+
marginTop: "var(--ds-space-050, 4px)",
|
|
48
39
|
color: `var(--ds-text-subtlest, ${N200})`,
|
|
49
|
-
|
|
50
|
-
fontSize: headingSizes.h200.size
|
|
40
|
+
fontSize: "var(--ds-font-size-075, 12px)"
|
|
51
41
|
});
|
|
52
42
|
const disabledDescriptionStyles = css({
|
|
53
43
|
color: `var(--ds-text-disabled, ${N200})`
|
|
@@ -56,14 +46,11 @@ const primitiveStyles = css({
|
|
|
56
46
|
display: 'flex',
|
|
57
47
|
boxSizing: 'border-box',
|
|
58
48
|
width: '100%',
|
|
59
|
-
minHeight:
|
|
49
|
+
minHeight: 40,
|
|
60
50
|
margin: "var(--ds-space-0, 0px)",
|
|
61
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
|
|
62
|
-
padding: `${"var(--ds-space-100, 8px)"} ${"var(--ds-space-250, 20px)"}`,
|
|
63
51
|
alignItems: 'center',
|
|
64
52
|
border: 0,
|
|
65
|
-
|
|
66
|
-
fontSize: fontSize,
|
|
53
|
+
fontSize: "var(--ds-font-size-100, 14px)",
|
|
67
54
|
outline: 0,
|
|
68
55
|
textDecoration: 'none',
|
|
69
56
|
userSelect: 'none',
|
|
@@ -74,6 +61,20 @@ const primitiveStyles = css({
|
|
|
74
61
|
textDecoration: 'none'
|
|
75
62
|
}
|
|
76
63
|
});
|
|
64
|
+
const spacingMapStyles = {
|
|
65
|
+
cozy: css({
|
|
66
|
+
// 8 * 2 (16) + icon (24) === 40
|
|
67
|
+
paddingBlock: "var(--ds-space-100, 8px)",
|
|
68
|
+
paddingInline: "var(--ds-space-200, 16px)"
|
|
69
|
+
}),
|
|
70
|
+
compact: css({
|
|
71
|
+
minHeight: 32,
|
|
72
|
+
maxHeight: 32,
|
|
73
|
+
// 4 * 2 (8) + icon (24) === 32
|
|
74
|
+
paddingBlock: "var(--ds-space-050, 4px)",
|
|
75
|
+
paddingInline: "var(--ds-space-150, 12px)"
|
|
76
|
+
})
|
|
77
|
+
};
|
|
77
78
|
const interactiveStyles = css({
|
|
78
79
|
cursor: 'pointer'
|
|
79
80
|
});
|
|
@@ -116,6 +117,10 @@ const selectedStyles = css({
|
|
|
116
117
|
color: "var(--ds-text-selected, currentColor)"
|
|
117
118
|
}
|
|
118
119
|
});
|
|
120
|
+
const gapMap = {
|
|
121
|
+
compact: 'space.100',
|
|
122
|
+
cozy: 'space.150'
|
|
123
|
+
};
|
|
119
124
|
|
|
120
125
|
/**
|
|
121
126
|
* __Menu item primitive__
|
|
@@ -144,6 +149,7 @@ const MenuItemPrimitive = ({
|
|
|
144
149
|
isDisabled = false,
|
|
145
150
|
isSelected = false
|
|
146
151
|
}) => {
|
|
152
|
+
const spacing = useContext(SpacingContext);
|
|
147
153
|
const renderTitle = overrides && overrides.Title && overrides.Title.render || defaultRender;
|
|
148
154
|
return jsx(ClassNames, null, ({
|
|
149
155
|
css: cn,
|
|
@@ -152,10 +158,18 @@ const MenuItemPrimitive = ({
|
|
|
152
158
|
return jsx(FocusRing, {
|
|
153
159
|
isInset: true
|
|
154
160
|
}, children({
|
|
155
|
-
className: cx([cn([primitiveStyles, !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && selectedStyles, isDisabled ? disabledStyles : interactiveStyles]), className]),
|
|
156
|
-
children: jsx(
|
|
161
|
+
className: cx([cn([primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && selectedStyles, isDisabled ? disabledStyles : interactiveStyles]), className]),
|
|
162
|
+
children: jsx(Inline, {
|
|
163
|
+
justifyContent: "space-between",
|
|
164
|
+
alignItems: "center",
|
|
165
|
+
gap: gapMap[spacing],
|
|
166
|
+
UNSAFE_style: {
|
|
167
|
+
flexGrow: 1,
|
|
168
|
+
width: '100%'
|
|
169
|
+
}
|
|
170
|
+
}, iconBefore && jsx("span", {
|
|
157
171
|
"data-item-elem-before": true,
|
|
158
|
-
css:
|
|
172
|
+
css: beforeAfterElementStyles
|
|
159
173
|
}, iconBefore), title && jsx("span", {
|
|
160
174
|
css: contentStyles
|
|
161
175
|
}, renderTitle('span', {
|
|
@@ -167,7 +181,7 @@ const MenuItemPrimitive = ({
|
|
|
167
181
|
css: [descriptionStyles, isDisabled && disabledDescriptionStyles, shouldDescriptionWrap ? wordBreakStyles : truncateStyles]
|
|
168
182
|
}, description)), iconAfter && jsx("span", {
|
|
169
183
|
"data-item-elem-after": true,
|
|
170
|
-
css:
|
|
184
|
+
css: beforeAfterElementStyles
|
|
171
185
|
}, iconAfter))
|
|
172
186
|
}));
|
|
173
187
|
});
|
|
@@ -8,11 +8,12 @@ import { headingSizes } from '@atlaskit/theme/typography';
|
|
|
8
8
|
const itemHeadingContentHeight = headingSizes.h100.lineHeight;
|
|
9
9
|
const itemHeadingFontSize = headingSizes.h100.size;
|
|
10
10
|
const headingStyles = css({
|
|
11
|
-
padding: `0 ${"var(--ds-space-250, 20px)"}`,
|
|
12
11
|
color: `var(--ds-text-subtle, ${N300})`,
|
|
13
12
|
fontSize: itemHeadingFontSize,
|
|
14
13
|
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
15
14
|
lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
|
|
15
|
+
paddingBlock: "var(--ds-space-0, 0px)",
|
|
16
|
+
paddingInline: "var(--ds-space-200, 16px)",
|
|
16
17
|
textTransform: 'uppercase'
|
|
17
18
|
});
|
|
18
19
|
|
|
@@ -5,7 +5,8 @@ import noop from '@atlaskit/ds-lib/noop';
|
|
|
5
5
|
import { N20A } from '@atlaskit/theme/colors';
|
|
6
6
|
import SkeletonShimmer from '../internal/components/skeleton-shimmer';
|
|
7
7
|
const skeletonStyles = css({
|
|
8
|
-
|
|
8
|
+
paddingBlock: "var(--ds-space-0, 0px)",
|
|
9
|
+
paddingInline: "var(--ds-space-200, 16px)",
|
|
9
10
|
'::after': {
|
|
10
11
|
display: 'block',
|
|
11
12
|
width: '30%',
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import { UNSAFE_Box as Box } from '@atlaskit/ds-explorations';
|
|
5
|
+
import { SpacingContext } from '../internal/components/menu-context';
|
|
5
6
|
/**
|
|
6
7
|
* __Menu group__
|
|
7
8
|
*
|
|
@@ -17,10 +18,11 @@ const MenuGroup = ({
|
|
|
17
18
|
maxHeight,
|
|
18
19
|
testId,
|
|
19
20
|
role,
|
|
21
|
+
spacing = 'cozy',
|
|
20
22
|
...rest
|
|
21
|
-
}) =>
|
|
22
|
-
|
|
23
|
-
jsx(Box, _extends({
|
|
23
|
+
}) => jsx(SpacingContext.Provider, {
|
|
24
|
+
value: spacing
|
|
25
|
+
}, jsx(Box, _extends({
|
|
24
26
|
UNSAFE_style: {
|
|
25
27
|
minWidth,
|
|
26
28
|
maxWidth,
|
|
@@ -34,5 +36,5 @@ jsx(Box, _extends({
|
|
|
34
36
|
role: role,
|
|
35
37
|
position: "static"
|
|
36
38
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
37
|
-
}, rest));
|
|
39
|
+
}, rest)));
|
|
38
40
|
export default MenuGroup;
|
|
@@ -4,6 +4,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
import { forwardRef, Fragment } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { N30A } from '@atlaskit/theme/colors';
|
|
7
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
7
8
|
import { gridSize as gridSizeFn } from '@atlaskit/theme/constants';
|
|
8
9
|
import { headingSizes } from '@atlaskit/theme/typography';
|
|
9
10
|
import HeadingItem from '../menu-item/heading-item';
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { default as ButtonItem } from './menu-item/button-item';
|
|
|
2
2
|
export { default as LinkItem } from './menu-item/link-item';
|
|
3
3
|
export { default as CustomItem } from './menu-item/custom-item';
|
|
4
4
|
export { default as SkeletonItem } from './menu-item/skeleton-item';
|
|
5
|
+
export { SpacingContext } from './internal/components/menu-context';
|
|
5
6
|
export { default as HeadingItem } from './menu-item/heading-item';
|
|
6
7
|
export { default as SkeletonHeadingItem } from './menu-item/skeleton-heading-item';
|
|
7
8
|
export { default as Section } from './menu-section/section';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __Spacing context__
|
|
4
|
+
*
|
|
5
|
+
* The spacing context is used to provide spacing values to menu item primitives.
|
|
6
|
+
*
|
|
7
|
+
* @internal Do not use directly.
|
|
8
|
+
*/
|
|
9
|
+
export var SpacingContext = /*#__PURE__*/createContext('cozy');
|
|
@@ -1,28 +1,20 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import {
|
|
2
|
+
import { useContext } from 'react';
|
|
3
3
|
import { ClassNames, css, jsx } from '@emotion/react';
|
|
4
|
+
import Inline from '@atlaskit/ds-explorations/inline';
|
|
4
5
|
import FocusRing from '@atlaskit/focus-ring';
|
|
5
6
|
import { N20, N200, N30 } from '@atlaskit/theme/colors';
|
|
6
|
-
import {
|
|
7
|
-
import { headingSizes } from '@atlaskit/theme/typography';
|
|
7
|
+
import { SpacingContext } from './menu-context';
|
|
8
8
|
var defaultRender = function defaultRender(Component, props) {
|
|
9
9
|
return (
|
|
10
10
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
11
11
|
jsx(Component, props)
|
|
12
12
|
);
|
|
13
13
|
};
|
|
14
|
-
var
|
|
15
|
-
var itemMinHeight = "var(--ds-space-500, 40px)";
|
|
16
|
-
var beforeElementStyles = css({
|
|
14
|
+
var beforeAfterElementStyles = css({
|
|
17
15
|
display: 'flex',
|
|
18
|
-
marginRight: "var(--ds-space-150, 12px)",
|
|
19
|
-
alignItems: 'center',
|
|
20
|
-
flexShrink: 0
|
|
21
|
-
});
|
|
22
|
-
var afterElementStyles = css({
|
|
23
|
-
display: 'flex',
|
|
24
|
-
marginLeft: "var(--ds-space-150, 12px)",
|
|
25
16
|
alignItems: 'center',
|
|
17
|
+
justifyContent: 'center',
|
|
26
18
|
flexShrink: 0
|
|
27
19
|
});
|
|
28
20
|
var contentStyles = css({
|
|
@@ -31,8 +23,7 @@ var contentStyles = css({
|
|
|
31
23
|
flexDirection: 'column',
|
|
32
24
|
flexGrow: 1,
|
|
33
25
|
// Fix - avoid clipped text descenders when using standard 16px line-height
|
|
34
|
-
|
|
35
|
-
lineHeight: 1.22,
|
|
26
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)",
|
|
36
27
|
outline: 'none',
|
|
37
28
|
overflow: 'hidden',
|
|
38
29
|
textAlign: 'left'
|
|
@@ -47,10 +38,9 @@ var wordBreakStyles = css({
|
|
|
47
38
|
wordBreak: 'break-word'
|
|
48
39
|
});
|
|
49
40
|
var descriptionStyles = css({
|
|
50
|
-
marginTop: "var(--ds-space-050,
|
|
41
|
+
marginTop: "var(--ds-space-050, 4px)",
|
|
51
42
|
color: "var(--ds-text-subtlest, ".concat(N200, ")"),
|
|
52
|
-
|
|
53
|
-
fontSize: headingSizes.h200.size
|
|
43
|
+
fontSize: "var(--ds-font-size-075, 12px)"
|
|
54
44
|
});
|
|
55
45
|
var disabledDescriptionStyles = css({
|
|
56
46
|
color: "var(--ds-text-disabled, ".concat(N200, ")")
|
|
@@ -59,14 +49,11 @@ var primitiveStyles = css({
|
|
|
59
49
|
display: 'flex',
|
|
60
50
|
boxSizing: 'border-box',
|
|
61
51
|
width: '100%',
|
|
62
|
-
minHeight:
|
|
52
|
+
minHeight: 40,
|
|
63
53
|
margin: "var(--ds-space-0, 0px)",
|
|
64
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
|
|
65
|
-
padding: "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-250, 20px)"),
|
|
66
54
|
alignItems: 'center',
|
|
67
55
|
border: 0,
|
|
68
|
-
|
|
69
|
-
fontSize: fontSize,
|
|
56
|
+
fontSize: "var(--ds-font-size-100, 14px)",
|
|
70
57
|
outline: 0,
|
|
71
58
|
textDecoration: 'none',
|
|
72
59
|
userSelect: 'none',
|
|
@@ -77,6 +64,20 @@ var primitiveStyles = css({
|
|
|
77
64
|
textDecoration: 'none'
|
|
78
65
|
}
|
|
79
66
|
});
|
|
67
|
+
var spacingMapStyles = {
|
|
68
|
+
cozy: css({
|
|
69
|
+
// 8 * 2 (16) + icon (24) === 40
|
|
70
|
+
paddingBlock: "var(--ds-space-100, 8px)",
|
|
71
|
+
paddingInline: "var(--ds-space-200, 16px)"
|
|
72
|
+
}),
|
|
73
|
+
compact: css({
|
|
74
|
+
minHeight: 32,
|
|
75
|
+
maxHeight: 32,
|
|
76
|
+
// 4 * 2 (8) + icon (24) === 32
|
|
77
|
+
paddingBlock: "var(--ds-space-050, 4px)",
|
|
78
|
+
paddingInline: "var(--ds-space-150, 12px)"
|
|
79
|
+
})
|
|
80
|
+
};
|
|
80
81
|
var interactiveStyles = css({
|
|
81
82
|
cursor: 'pointer'
|
|
82
83
|
});
|
|
@@ -119,6 +120,10 @@ var selectedStyles = css({
|
|
|
119
120
|
color: "var(--ds-text-selected, currentColor)"
|
|
120
121
|
}
|
|
121
122
|
});
|
|
123
|
+
var gapMap = {
|
|
124
|
+
compact: 'space.100',
|
|
125
|
+
cozy: 'space.150'
|
|
126
|
+
};
|
|
122
127
|
|
|
123
128
|
/**
|
|
124
129
|
* __Menu item primitive__
|
|
@@ -150,6 +155,7 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
|
150
155
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
151
156
|
_ref$isSelected = _ref.isSelected,
|
|
152
157
|
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected;
|
|
158
|
+
var spacing = useContext(SpacingContext);
|
|
153
159
|
var renderTitle = overrides && overrides.Title && overrides.Title.render || defaultRender;
|
|
154
160
|
return jsx(ClassNames, null, function (_ref2) {
|
|
155
161
|
var cn = _ref2.css,
|
|
@@ -157,10 +163,18 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
|
157
163
|
return jsx(FocusRing, {
|
|
158
164
|
isInset: true
|
|
159
165
|
}, children({
|
|
160
|
-
className: cx([cn([primitiveStyles, !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && selectedStyles, isDisabled ? disabledStyles : interactiveStyles]), className]),
|
|
161
|
-
children: jsx(
|
|
166
|
+
className: cx([cn([primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && selectedStyles, isDisabled ? disabledStyles : interactiveStyles]), className]),
|
|
167
|
+
children: jsx(Inline, {
|
|
168
|
+
justifyContent: "space-between",
|
|
169
|
+
alignItems: "center",
|
|
170
|
+
gap: gapMap[spacing],
|
|
171
|
+
UNSAFE_style: {
|
|
172
|
+
flexGrow: 1,
|
|
173
|
+
width: '100%'
|
|
174
|
+
}
|
|
175
|
+
}, iconBefore && jsx("span", {
|
|
162
176
|
"data-item-elem-before": true,
|
|
163
|
-
css:
|
|
177
|
+
css: beforeAfterElementStyles
|
|
164
178
|
}, iconBefore), title && jsx("span", {
|
|
165
179
|
css: contentStyles
|
|
166
180
|
}, renderTitle('span', {
|
|
@@ -172,7 +186,7 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
|
172
186
|
css: [descriptionStyles, isDisabled && disabledDescriptionStyles, shouldDescriptionWrap ? wordBreakStyles : truncateStyles]
|
|
173
187
|
}, description)), iconAfter && jsx("span", {
|
|
174
188
|
"data-item-elem-after": true,
|
|
175
|
-
css:
|
|
189
|
+
css: beforeAfterElementStyles
|
|
176
190
|
}, iconAfter))
|
|
177
191
|
}));
|
|
178
192
|
});
|
|
@@ -10,11 +10,12 @@ import { headingSizes } from '@atlaskit/theme/typography';
|
|
|
10
10
|
var itemHeadingContentHeight = headingSizes.h100.lineHeight;
|
|
11
11
|
var itemHeadingFontSize = headingSizes.h100.size;
|
|
12
12
|
var headingStyles = css({
|
|
13
|
-
padding: "0 ".concat("var(--ds-space-250, 20px)"),
|
|
14
13
|
color: "var(--ds-text-subtle, ".concat(N300, ")"),
|
|
15
14
|
fontSize: itemHeadingFontSize,
|
|
16
15
|
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
17
16
|
lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
|
|
17
|
+
paddingBlock: "var(--ds-space-0, 0px)",
|
|
18
|
+
paddingInline: "var(--ds-space-200, 16px)",
|
|
18
19
|
textTransform: 'uppercase'
|
|
19
20
|
});
|
|
20
21
|
|
|
@@ -5,7 +5,8 @@ import noop from '@atlaskit/ds-lib/noop';
|
|
|
5
5
|
import { N20A } from '@atlaskit/theme/colors';
|
|
6
6
|
import SkeletonShimmer from '../internal/components/skeleton-shimmer';
|
|
7
7
|
var skeletonStyles = css({
|
|
8
|
-
|
|
8
|
+
paddingBlock: "var(--ds-space-0, 0px)",
|
|
9
|
+
paddingInline: "var(--ds-space-200, 16px)",
|
|
9
10
|
'::after': {
|
|
10
11
|
display: 'block',
|
|
11
12
|
width: '30%',
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["maxWidth", "minWidth", "minHeight", "maxHeight", "testId", "role"];
|
|
3
|
+
var _excluded = ["maxWidth", "minWidth", "minHeight", "maxHeight", "testId", "role", "spacing"];
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import { UNSAFE_Box as Box } from '@atlaskit/ds-explorations';
|
|
7
|
+
import { SpacingContext } from '../internal/components/menu-context';
|
|
7
8
|
/**
|
|
8
9
|
* __Menu group__
|
|
9
10
|
*
|
|
@@ -19,24 +20,25 @@ var MenuGroup = function MenuGroup(_ref) {
|
|
|
19
20
|
maxHeight = _ref.maxHeight,
|
|
20
21
|
testId = _ref.testId,
|
|
21
22
|
role = _ref.role,
|
|
23
|
+
_ref$spacing = _ref.spacing,
|
|
24
|
+
spacing = _ref$spacing === void 0 ? 'cozy' : _ref$spacing,
|
|
22
25
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
-
return (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
);
|
|
26
|
+
return jsx(SpacingContext.Provider, {
|
|
27
|
+
value: spacing
|
|
28
|
+
}, jsx(Box, _extends({
|
|
29
|
+
UNSAFE_style: {
|
|
30
|
+
minWidth: minWidth,
|
|
31
|
+
maxWidth: maxWidth,
|
|
32
|
+
minHeight: minHeight,
|
|
33
|
+
maxHeight: maxHeight
|
|
34
|
+
},
|
|
35
|
+
display: "flex",
|
|
36
|
+
flexDirection: "column",
|
|
37
|
+
overflow: "auto",
|
|
38
|
+
testId: testId,
|
|
39
|
+
role: role,
|
|
40
|
+
position: "static"
|
|
41
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
42
|
+
}, rest)));
|
|
41
43
|
};
|
|
42
44
|
export default MenuGroup;
|
|
@@ -6,6 +6,7 @@ var _excluded = ["children", "overrides", "title", "testId", "isScrollable", "ha
|
|
|
6
6
|
import { forwardRef, Fragment } from 'react';
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
8
|
import { N30A } from '@atlaskit/theme/colors';
|
|
9
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
9
10
|
import { gridSize as gridSizeFn } from '@atlaskit/theme/constants';
|
|
10
11
|
import { headingSizes } from '@atlaskit/theme/typography';
|
|
11
12
|
import HeadingItem from '../menu-item/heading-item';
|
package/dist/esm/version.json
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { default as ButtonItem } from './menu-item/button-item';
|
|
|
2
2
|
export { default as LinkItem } from './menu-item/link-item';
|
|
3
3
|
export { default as CustomItem } from './menu-item/custom-item';
|
|
4
4
|
export { default as SkeletonItem } from './menu-item/skeleton-item';
|
|
5
|
+
export { SpacingContext } from './internal/components/menu-context';
|
|
5
6
|
export { default as HeadingItem } from './menu-item/heading-item';
|
|
6
7
|
export { default as SkeletonHeadingItem } from './menu-item/skeleton-heading-item';
|
|
7
8
|
export { default as Section } from './menu-section/section';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare 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>;
|
|
@@ -9,5 +9,5 @@ import type { MenuGroupProps } from '../types';
|
|
|
9
9
|
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/menu-group)
|
|
10
10
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
11
11
|
*/
|
|
12
|
-
declare const MenuGroup: ({ maxWidth, minWidth, minHeight, maxHeight, testId, role, ...rest }: MenuGroupProps) => jsx.JSX.Element;
|
|
12
|
+
declare const MenuGroup: ({ maxWidth, minWidth, minHeight, maxHeight, testId, role, spacing, ...rest }: MenuGroupProps) => jsx.JSX.Element;
|
|
13
13
|
export default MenuGroup;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentType, ReactNode, Ref } from 'react';
|
|
2
2
|
import { CSSObject } from '@emotion/react';
|
|
3
|
+
import type { SpacingMode } from './internal/components/menu-context';
|
|
3
4
|
export interface RenderFunction<TProps = {}> {
|
|
4
5
|
(Component: ComponentType | string, props: TProps): React.ReactNode;
|
|
5
6
|
}
|
|
@@ -45,6 +46,10 @@ export interface MenuGroupProps extends MenuGroupSizing {
|
|
|
45
46
|
* should generally be `Section` components.
|
|
46
47
|
*/
|
|
47
48
|
children: React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Configure the density of the MenuGroup content.
|
|
51
|
+
*/
|
|
52
|
+
spacing?: SpacingMode;
|
|
48
53
|
/**
|
|
49
54
|
* Used to override the accessibility role for the element.
|
|
50
55
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/menu",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.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/"
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"sideEffects": false,
|
|
16
16
|
"atlaskit:src": "src/index.tsx",
|
|
17
17
|
"atlassian": {
|
|
18
|
-
"disableProductCI": true,
|
|
19
18
|
"team": "Design System Team",
|
|
20
19
|
"releaseModel": "scheduled",
|
|
21
20
|
"website": {
|
|
@@ -40,8 +39,8 @@
|
|
|
40
39
|
"@atlaskit/ds-explorations": "^2.0.0",
|
|
41
40
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
42
41
|
"@atlaskit/focus-ring": "^1.2.0",
|
|
43
|
-
"@atlaskit/theme": "^12.
|
|
44
|
-
"@atlaskit/tokens": "^1.
|
|
42
|
+
"@atlaskit/theme": "^12.3.0",
|
|
43
|
+
"@atlaskit/tokens": "^1.2.0",
|
|
45
44
|
"@babel/runtime": "^7.0.0",
|
|
46
45
|
"@emotion/react": "^11.7.1"
|
|
47
46
|
},
|
|
@@ -50,7 +49,7 @@
|
|
|
50
49
|
"react-dom": "^16.8.0"
|
|
51
50
|
},
|
|
52
51
|
"devDependencies": {
|
|
53
|
-
"@atlaskit/avatar": "^21.
|
|
52
|
+
"@atlaskit/avatar": "^21.2.0",
|
|
54
53
|
"@atlaskit/button": "^16.5.0",
|
|
55
54
|
"@atlaskit/docs": "*",
|
|
56
55
|
"@atlaskit/icon": "^21.11.0",
|