@atlaskit/dropdown-menu 11.14.1 → 11.14.3
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 +13 -0
- package/dist/cjs/dropdown-menu.js +3 -2
- package/dist/cjs/internal/components/menu-wrapper.js +26 -22
- package/dist/es2019/dropdown-menu.js +3 -2
- package/dist/es2019/internal/components/menu-wrapper.js +24 -19
- package/dist/esm/dropdown-menu.js +3 -2
- package/dist/esm/internal/components/menu-wrapper.js +25 -22
- package/dist/types/internal/components/menu-wrapper.d.ts +1 -1
- package/dist/types-ts4.5/internal/components/menu-wrapper.d.ts +1 -1
- package/package.json +3 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/dropdown-menu
|
|
2
2
|
|
|
3
|
+
## 11.14.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a54578d2ea9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a54578d2ea9) - This removes the feature flag for the `shouldRenderToParent` prop. The prop is available for use.
|
|
8
|
+
|
|
9
|
+
## 11.14.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`9623c04c020`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9623c04c020) - [ux] Adds context to loading state for assistive technologies.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 11.14.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -185,7 +185,7 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
185
185
|
fallbackPlacements: fallbackPlacements,
|
|
186
186
|
testId: testId && "".concat(testId, "--content"),
|
|
187
187
|
shouldUseCaptureOnOutsideClick: true,
|
|
188
|
-
shouldRenderToParent:
|
|
188
|
+
shouldRenderToParent: shouldRenderToParent,
|
|
189
189
|
trigger: function trigger(triggerProps) {
|
|
190
190
|
if (typeof _trigger === 'function') {
|
|
191
191
|
var ref = triggerProps.ref,
|
|
@@ -236,7 +236,8 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
236
236
|
onUpdate: update,
|
|
237
237
|
isLoading: isLoading,
|
|
238
238
|
statusLabel: statusLabel,
|
|
239
|
-
setInitialFocusRef: isTriggeredUsingKeyboard || autoFocus ? setInitialFocusRef : undefined
|
|
239
|
+
setInitialFocusRef: isTriggeredUsingKeyboard || autoFocus ? setInitialFocusRef : undefined,
|
|
240
|
+
testId: testId && "".concat(testId, "--menu-wrapper")
|
|
240
241
|
}, children));
|
|
241
242
|
}
|
|
242
243
|
}));
|
|
@@ -5,19 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
8
|
var _react = require("react");
|
|
11
9
|
var _react2 = require("@emotion/react");
|
|
12
10
|
var _menuGroup = _interopRequireDefault(require("@atlaskit/menu/menu-group"));
|
|
13
11
|
var _primitives = require("@atlaskit/primitives");
|
|
14
12
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
15
|
-
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
16
13
|
var _focusManager = require("../components/focus-manager");
|
|
17
14
|
var _isCheckboxItem = _interopRequireDefault(require("../utils/is-checkbox-item"));
|
|
18
15
|
var _isRadioItem = _interopRequireDefault(require("../utils/is-radio-item"));
|
|
19
|
-
var _excluded = ["onClose", "onUpdate", "isLoading", "statusLabel", "setInitialFocusRef", "children"];
|
|
20
16
|
/** @jsx jsx */
|
|
17
|
+
|
|
21
18
|
var spinnerContainerStyles = (0, _primitives.xcss)({
|
|
22
19
|
display: 'flex',
|
|
23
20
|
minWidth: '160px',
|
|
@@ -26,14 +23,15 @@ var spinnerContainerStyles = (0, _primitives.xcss)({
|
|
|
26
23
|
});
|
|
27
24
|
var LoadingIndicator = function LoadingIndicator(_ref) {
|
|
28
25
|
var _ref$statusLabel = _ref.statusLabel,
|
|
29
|
-
statusLabel = _ref$statusLabel === void 0 ? 'Loading' : _ref$statusLabel
|
|
26
|
+
statusLabel = _ref$statusLabel === void 0 ? 'Loading' : _ref$statusLabel,
|
|
27
|
+
testId = _ref.testId;
|
|
30
28
|
return (0, _react2.jsx)(_primitives.Box, {
|
|
31
29
|
xcss: spinnerContainerStyles
|
|
32
30
|
}, (0, _react2.jsx)(_spinner.default, {
|
|
33
|
-
size: "small"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
31
|
+
size: "small",
|
|
32
|
+
label: statusLabel,
|
|
33
|
+
testId: testId
|
|
34
|
+
}));
|
|
37
35
|
};
|
|
38
36
|
/**
|
|
39
37
|
*
|
|
@@ -43,13 +41,16 @@ var LoadingIndicator = function LoadingIndicator(_ref) {
|
|
|
43
41
|
* It also sets focus to the first menu item when opened.
|
|
44
42
|
*/
|
|
45
43
|
var MenuWrapper = function MenuWrapper(_ref2) {
|
|
46
|
-
var
|
|
47
|
-
onUpdate = _ref2.onUpdate,
|
|
44
|
+
var children = _ref2.children,
|
|
48
45
|
isLoading = _ref2.isLoading,
|
|
46
|
+
maxHeight = _ref2.maxHeight,
|
|
47
|
+
maxWidth = _ref2.maxWidth,
|
|
48
|
+
onClose = _ref2.onClose,
|
|
49
|
+
onUpdate = _ref2.onUpdate,
|
|
49
50
|
statusLabel = _ref2.statusLabel,
|
|
50
51
|
setInitialFocusRef = _ref2.setInitialFocusRef,
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
spacing = _ref2.spacing,
|
|
53
|
+
testId = _ref2.testId;
|
|
53
54
|
var _useContext = (0, _react.useContext)(_focusManager.FocusManagerContext),
|
|
54
55
|
menuItemRefs = _useContext.menuItemRefs;
|
|
55
56
|
var closeOnMenuItemClick = function closeOnMenuItemClick(e) {
|
|
@@ -80,15 +81,18 @@ var MenuWrapper = function MenuWrapper(_ref2) {
|
|
|
80
81
|
})) !== null && _menuItemRefs$find !== void 0 ? _menuItemRefs$find : null;
|
|
81
82
|
setInitialFocusRef === null || setInitialFocusRef === void 0 ? void 0 : setInitialFocusRef(firstFocusableRef);
|
|
82
83
|
}, [menuItemRefs, setInitialFocusRef]);
|
|
83
|
-
return (
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
)
|
|
84
|
+
return (0, _react2.jsx)(_menuGroup.default, {
|
|
85
|
+
isLoading: isLoading,
|
|
86
|
+
maxHeight: maxHeight,
|
|
87
|
+
maxWidth: maxWidth,
|
|
88
|
+
onClick: closeOnMenuItemClick,
|
|
89
|
+
role: "menu",
|
|
90
|
+
spacing: spacing,
|
|
91
|
+
testId: testId && "".concat(testId, "--menu-group")
|
|
92
|
+
}, isLoading ? (0, _react2.jsx)(LoadingIndicator, {
|
|
93
|
+
statusLabel: statusLabel,
|
|
94
|
+
testId: testId && "".concat(testId, "--loading-indicator")
|
|
95
|
+
}) : children);
|
|
92
96
|
};
|
|
93
97
|
var _default = MenuWrapper;
|
|
94
98
|
exports.default = _default;
|
|
@@ -157,7 +157,7 @@ const DropdownMenu = props => {
|
|
|
157
157
|
fallbackPlacements: fallbackPlacements,
|
|
158
158
|
testId: testId && `${testId}--content`,
|
|
159
159
|
shouldUseCaptureOnOutsideClick: true,
|
|
160
|
-
shouldRenderToParent:
|
|
160
|
+
shouldRenderToParent: shouldRenderToParent,
|
|
161
161
|
trigger: triggerProps => {
|
|
162
162
|
if (typeof trigger === 'function') {
|
|
163
163
|
const {
|
|
@@ -212,7 +212,8 @@ const DropdownMenu = props => {
|
|
|
212
212
|
onUpdate: update,
|
|
213
213
|
isLoading: isLoading,
|
|
214
214
|
statusLabel: statusLabel,
|
|
215
|
-
setInitialFocusRef: isTriggeredUsingKeyboard || autoFocus ? setInitialFocusRef : undefined
|
|
215
|
+
setInitialFocusRef: isTriggeredUsingKeyboard || autoFocus ? setInitialFocusRef : undefined,
|
|
216
|
+
testId: testId && `${testId}--menu-wrapper`
|
|
216
217
|
}, children))
|
|
217
218
|
}));
|
|
218
219
|
};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
/** @jsx jsx */
|
|
3
2
|
import { useContext, useEffect, useLayoutEffect } from 'react';
|
|
4
3
|
import { jsx } from '@emotion/react';
|
|
5
4
|
import MenuGroup from '@atlaskit/menu/menu-group';
|
|
6
5
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
7
6
|
import Spinner from '@atlaskit/spinner';
|
|
8
|
-
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
9
7
|
import { FocusManagerContext } from '../components/focus-manager';
|
|
10
8
|
import isCheckboxItem from '../utils/is-checkbox-item';
|
|
11
9
|
import isRadioItem from '../utils/is-radio-item';
|
|
@@ -16,14 +14,15 @@ const spinnerContainerStyles = xcss({
|
|
|
16
14
|
justifyContent: 'center'
|
|
17
15
|
});
|
|
18
16
|
const LoadingIndicator = ({
|
|
19
|
-
statusLabel = 'Loading'
|
|
17
|
+
statusLabel = 'Loading',
|
|
18
|
+
testId
|
|
20
19
|
}) => jsx(Box, {
|
|
21
20
|
xcss: spinnerContainerStyles
|
|
22
21
|
}, jsx(Spinner, {
|
|
23
|
-
size: "small"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
22
|
+
size: "small",
|
|
23
|
+
label: statusLabel,
|
|
24
|
+
testId: testId
|
|
25
|
+
}));
|
|
27
26
|
/**
|
|
28
27
|
*
|
|
29
28
|
* MenuWrapper wraps all the menu items.
|
|
@@ -32,13 +31,16 @@ const LoadingIndicator = ({
|
|
|
32
31
|
* It also sets focus to the first menu item when opened.
|
|
33
32
|
*/
|
|
34
33
|
const MenuWrapper = ({
|
|
34
|
+
children,
|
|
35
|
+
isLoading,
|
|
36
|
+
maxHeight,
|
|
37
|
+
maxWidth,
|
|
35
38
|
onClose,
|
|
36
39
|
onUpdate,
|
|
37
|
-
isLoading,
|
|
38
40
|
statusLabel,
|
|
39
41
|
setInitialFocusRef,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
spacing,
|
|
43
|
+
testId
|
|
42
44
|
}) => {
|
|
43
45
|
const {
|
|
44
46
|
menuItemRefs
|
|
@@ -69,14 +71,17 @@ const MenuWrapper = ({
|
|
|
69
71
|
const firstFocusableRef = (_menuItemRefs$find = menuItemRefs.find(ref => !ref.hasAttribute('disabled'))) !== null && _menuItemRefs$find !== void 0 ? _menuItemRefs$find : null;
|
|
70
72
|
setInitialFocusRef === null || setInitialFocusRef === void 0 ? void 0 : setInitialFocusRef(firstFocusableRef);
|
|
71
73
|
}, [menuItemRefs, setInitialFocusRef]);
|
|
72
|
-
return (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
return jsx(MenuGroup, {
|
|
75
|
+
isLoading: isLoading,
|
|
76
|
+
maxHeight: maxHeight,
|
|
77
|
+
maxWidth: maxWidth,
|
|
78
|
+
onClick: closeOnMenuItemClick,
|
|
79
|
+
role: "menu",
|
|
80
|
+
spacing: spacing,
|
|
81
|
+
testId: testId && `${testId}--menu-group`
|
|
82
|
+
}, isLoading ? jsx(LoadingIndicator, {
|
|
83
|
+
statusLabel: statusLabel,
|
|
84
|
+
testId: testId && `${testId}--loading-indicator`
|
|
85
|
+
}) : children);
|
|
81
86
|
};
|
|
82
87
|
export default MenuWrapper;
|
|
@@ -176,7 +176,7 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
176
176
|
fallbackPlacements: fallbackPlacements,
|
|
177
177
|
testId: testId && "".concat(testId, "--content"),
|
|
178
178
|
shouldUseCaptureOnOutsideClick: true,
|
|
179
|
-
shouldRenderToParent:
|
|
179
|
+
shouldRenderToParent: shouldRenderToParent,
|
|
180
180
|
trigger: function trigger(triggerProps) {
|
|
181
181
|
if (typeof _trigger === 'function') {
|
|
182
182
|
var ref = triggerProps.ref,
|
|
@@ -227,7 +227,8 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
227
227
|
onUpdate: update,
|
|
228
228
|
isLoading: isLoading,
|
|
229
229
|
statusLabel: statusLabel,
|
|
230
|
-
setInitialFocusRef: isTriggeredUsingKeyboard || autoFocus ? setInitialFocusRef : undefined
|
|
230
|
+
setInitialFocusRef: isTriggeredUsingKeyboard || autoFocus ? setInitialFocusRef : undefined,
|
|
231
|
+
testId: testId && "".concat(testId, "--menu-wrapper")
|
|
231
232
|
}, children));
|
|
232
233
|
}
|
|
233
234
|
}));
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["onClose", "onUpdate", "isLoading", "statusLabel", "setInitialFocusRef", "children"];
|
|
4
1
|
/** @jsx jsx */
|
|
5
2
|
import { useContext, useEffect, useLayoutEffect } from 'react';
|
|
6
3
|
import { jsx } from '@emotion/react';
|
|
7
4
|
import MenuGroup from '@atlaskit/menu/menu-group';
|
|
8
5
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
9
6
|
import Spinner from '@atlaskit/spinner';
|
|
10
|
-
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
11
7
|
import { FocusManagerContext } from '../components/focus-manager';
|
|
12
8
|
import isCheckboxItem from '../utils/is-checkbox-item';
|
|
13
9
|
import isRadioItem from '../utils/is-radio-item';
|
|
@@ -19,14 +15,15 @@ var spinnerContainerStyles = xcss({
|
|
|
19
15
|
});
|
|
20
16
|
var LoadingIndicator = function LoadingIndicator(_ref) {
|
|
21
17
|
var _ref$statusLabel = _ref.statusLabel,
|
|
22
|
-
statusLabel = _ref$statusLabel === void 0 ? 'Loading' : _ref$statusLabel
|
|
18
|
+
statusLabel = _ref$statusLabel === void 0 ? 'Loading' : _ref$statusLabel,
|
|
19
|
+
testId = _ref.testId;
|
|
23
20
|
return jsx(Box, {
|
|
24
21
|
xcss: spinnerContainerStyles
|
|
25
22
|
}, jsx(Spinner, {
|
|
26
|
-
size: "small"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
23
|
+
size: "small",
|
|
24
|
+
label: statusLabel,
|
|
25
|
+
testId: testId
|
|
26
|
+
}));
|
|
30
27
|
};
|
|
31
28
|
/**
|
|
32
29
|
*
|
|
@@ -36,13 +33,16 @@ var LoadingIndicator = function LoadingIndicator(_ref) {
|
|
|
36
33
|
* It also sets focus to the first menu item when opened.
|
|
37
34
|
*/
|
|
38
35
|
var MenuWrapper = function MenuWrapper(_ref2) {
|
|
39
|
-
var
|
|
40
|
-
onUpdate = _ref2.onUpdate,
|
|
36
|
+
var children = _ref2.children,
|
|
41
37
|
isLoading = _ref2.isLoading,
|
|
38
|
+
maxHeight = _ref2.maxHeight,
|
|
39
|
+
maxWidth = _ref2.maxWidth,
|
|
40
|
+
onClose = _ref2.onClose,
|
|
41
|
+
onUpdate = _ref2.onUpdate,
|
|
42
42
|
statusLabel = _ref2.statusLabel,
|
|
43
43
|
setInitialFocusRef = _ref2.setInitialFocusRef,
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
spacing = _ref2.spacing,
|
|
45
|
+
testId = _ref2.testId;
|
|
46
46
|
var _useContext = useContext(FocusManagerContext),
|
|
47
47
|
menuItemRefs = _useContext.menuItemRefs;
|
|
48
48
|
var closeOnMenuItemClick = function closeOnMenuItemClick(e) {
|
|
@@ -73,14 +73,17 @@ var MenuWrapper = function MenuWrapper(_ref2) {
|
|
|
73
73
|
})) !== null && _menuItemRefs$find !== void 0 ? _menuItemRefs$find : null;
|
|
74
74
|
setInitialFocusRef === null || setInitialFocusRef === void 0 ? void 0 : setInitialFocusRef(firstFocusableRef);
|
|
75
75
|
}, [menuItemRefs, setInitialFocusRef]);
|
|
76
|
-
return (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
return jsx(MenuGroup, {
|
|
77
|
+
isLoading: isLoading,
|
|
78
|
+
maxHeight: maxHeight,
|
|
79
|
+
maxWidth: maxWidth,
|
|
80
|
+
onClick: closeOnMenuItemClick,
|
|
81
|
+
role: "menu",
|
|
82
|
+
spacing: spacing,
|
|
83
|
+
testId: testId && "".concat(testId, "--menu-group")
|
|
84
|
+
}, isLoading ? jsx(LoadingIndicator, {
|
|
85
|
+
statusLabel: statusLabel,
|
|
86
|
+
testId: testId && "".concat(testId, "--loading-indicator")
|
|
87
|
+
}) : children);
|
|
85
88
|
};
|
|
86
89
|
export default MenuWrapper;
|
|
@@ -7,5 +7,5 @@ import { MenuWrapperProps } from '../../types';
|
|
|
7
7
|
* if a CheckboxItem or RadioItem is clicked.
|
|
8
8
|
* It also sets focus to the first menu item when opened.
|
|
9
9
|
*/
|
|
10
|
-
declare const MenuWrapper: ({ onClose, onUpdate,
|
|
10
|
+
declare const MenuWrapper: ({ children, isLoading, maxHeight, maxWidth, onClose, onUpdate, statusLabel, setInitialFocusRef, spacing, testId, }: MenuWrapperProps) => jsx.JSX.Element;
|
|
11
11
|
export default MenuWrapper;
|
|
@@ -7,5 +7,5 @@ import { MenuWrapperProps } from '../../types';
|
|
|
7
7
|
* if a CheckboxItem or RadioItem is clicked.
|
|
8
8
|
* It also sets focus to the first menu item when opened.
|
|
9
9
|
*/
|
|
10
|
-
declare const MenuWrapper: ({ onClose, onUpdate,
|
|
10
|
+
declare const MenuWrapper: ({ children, isLoading, maxHeight, maxWidth, onClose, onUpdate, statusLabel, setInitialFocusRef, spacing, testId, }: MenuWrapperProps) => jsx.JSX.Element;
|
|
11
11
|
export default MenuWrapper;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/dropdown-menu",
|
|
3
|
-
"version": "11.14.
|
|
3
|
+
"version": "11.14.3",
|
|
4
4
|
"description": "A dropdown menu displays a list of actions or options to a user.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,14 +36,13 @@
|
|
|
36
36
|
"@atlaskit/ds-lib": "^2.2.0",
|
|
37
37
|
"@atlaskit/icon": "^21.12.0",
|
|
38
38
|
"@atlaskit/layering": "^0.2.0",
|
|
39
|
-
"@atlaskit/menu": "^1.
|
|
39
|
+
"@atlaskit/menu": "^1.11.0",
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^0.2.2",
|
|
41
41
|
"@atlaskit/popup": "^1.10.0",
|
|
42
42
|
"@atlaskit/primitives": "^1.6.0",
|
|
43
|
-
"@atlaskit/spinner": "^15.
|
|
43
|
+
"@atlaskit/spinner": "^15.6.0",
|
|
44
44
|
"@atlaskit/theme": "^12.6.0",
|
|
45
45
|
"@atlaskit/tokens": "^1.25.0",
|
|
46
|
-
"@atlaskit/visually-hidden": "^1.2.0",
|
|
47
46
|
"@babel/runtime": "^7.0.0",
|
|
48
47
|
"@emotion/react": "^11.7.1",
|
|
49
48
|
"bind-event-listener": "^2.1.1"
|
|
@@ -105,9 +104,6 @@
|
|
|
105
104
|
"platform.design-system-team.menu-selected-state-change_0see9": {
|
|
106
105
|
"type": "boolean"
|
|
107
106
|
},
|
|
108
|
-
"platform.design-system-team.render-popup-in-parent_f73ij": {
|
|
109
|
-
"type": "boolean"
|
|
110
|
-
},
|
|
111
107
|
"platform.design-system-team.border-checkbox_nyoiu": {
|
|
112
108
|
"type": "boolean"
|
|
113
109
|
},
|