@atlaskit/dropdown-menu 13.0.5 → 13.1.0

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/dropdown-menu
2
2
 
3
+ ## 13.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#134128](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/134128)
8
+ [`8255a77865aac`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8255a77865aac) -
9
+ Added support for an optional role attribute on dropdown items to allow customization of ARIA
10
+ roles. Defaults to menuitem.
11
+
12
+ ## 13.0.6
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 13.0.5
4
19
 
5
20
  ### Patch Changes
@@ -15,7 +15,7 @@ var _customItem = _interopRequireDefault(require("@atlaskit/menu/custom-item"));
15
15
  var _linkItem = _interopRequireDefault(require("@atlaskit/menu/link-item"));
16
16
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
17
  var _useRegisterItemWithFocusManager = _interopRequireDefault(require("./internal/hooks/use-register-item-with-focus-manager"));
18
- var _excluded = ["children", "component", "description", "elemAfter", "elemBefore", "href", "isDisabled", "isSelected", "onClick", "rel", "shouldDescriptionWrap", "shouldTitleWrap", "target", "testId", "UNSAFE_shouldDisableRouterLink", "returnFocusRef", "interactionName"];
18
+ var _excluded = ["children", "component", "description", "elemAfter", "elemBefore", "href", "isDisabled", "isSelected", "onClick", "rel", "shouldDescriptionWrap", "shouldTitleWrap", "target", "testId", "UNSAFE_shouldDisableRouterLink", "returnFocusRef", "interactionName", "role"];
19
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
21
  /**
@@ -47,6 +47,7 @@ var DropdownMenuItem = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
47
47
  UNSAFE_shouldDisableRouterLink = _ref.UNSAFE_shouldDisableRouterLink,
48
48
  returnFocusRef = _ref.returnFocusRef,
49
49
  interactionName = _ref.interactionName,
50
+ role = _ref.role,
50
51
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
51
52
  // if the dropdown item has aria-haspopup, we won't register with focus manager
52
53
  // since it is a nested trigger, we have registered inside dropdown-menu
@@ -111,7 +112,7 @@ var DropdownMenuItem = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
111
112
  isSelected: isSelected,
112
113
  onClick: handleItemClick,
113
114
  ref: (0, _mergeRefs.default)([ref, itemRef]),
114
- role: "menuitem",
115
+ role: role || 'menuitem',
115
116
  shouldDescriptionWrap: shouldDescriptionWrap,
116
117
  shouldTitleWrap: shouldTitleWrap,
117
118
  testId: testId
@@ -33,6 +33,7 @@ const DropdownMenuItem = /*#__PURE__*/forwardRef(({
33
33
  UNSAFE_shouldDisableRouterLink,
34
34
  returnFocusRef,
35
35
  interactionName,
36
+ role,
36
37
  ...rest
37
38
  }, ref) => {
38
39
  // if the dropdown item has aria-haspopup, we won't register with focus manager
@@ -98,7 +99,7 @@ const DropdownMenuItem = /*#__PURE__*/forwardRef(({
98
99
  isSelected: isSelected,
99
100
  onClick: handleItemClick,
100
101
  ref: mergeRefs([ref, itemRef]),
101
- role: "menuitem",
102
+ role: role || 'menuitem',
102
103
  shouldDescriptionWrap: shouldDescriptionWrap,
103
104
  shouldTitleWrap: shouldTitleWrap,
104
105
  testId: testId
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "component", "description", "elemAfter", "elemBefore", "href", "isDisabled", "isSelected", "onClick", "rel", "shouldDescriptionWrap", "shouldTitleWrap", "target", "testId", "UNSAFE_shouldDisableRouterLink", "returnFocusRef", "interactionName"];
3
+ var _excluded = ["children", "component", "description", "elemAfter", "elemBefore", "href", "isDisabled", "isSelected", "onClick", "rel", "shouldDescriptionWrap", "shouldTitleWrap", "target", "testId", "UNSAFE_shouldDisableRouterLink", "returnFocusRef", "interactionName", "role"];
4
4
  import React, { forwardRef, useCallback } from 'react';
5
5
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
6
6
  import ButtonItem from '@atlaskit/menu/button-item';
@@ -37,6 +37,7 @@ var DropdownMenuItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
37
37
  UNSAFE_shouldDisableRouterLink = _ref.UNSAFE_shouldDisableRouterLink,
38
38
  returnFocusRef = _ref.returnFocusRef,
39
39
  interactionName = _ref.interactionName,
40
+ role = _ref.role,
40
41
  rest = _objectWithoutProperties(_ref, _excluded);
41
42
  // if the dropdown item has aria-haspopup, we won't register with focus manager
42
43
  // since it is a nested trigger, we have registered inside dropdown-menu
@@ -101,7 +102,7 @@ var DropdownMenuItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
101
102
  isSelected: isSelected,
102
103
  onClick: handleItemClick,
103
104
  ref: mergeRefs([ref, itemRef]),
104
- role: "menuitem",
105
+ role: role || 'menuitem',
105
106
  shouldDescriptionWrap: shouldDescriptionWrap,
106
107
  shouldTitleWrap: shouldTitleWrap,
107
108
  testId: testId
@@ -272,6 +272,13 @@ export interface DropdownItemProps {
272
272
  * An optional boolean value used to indicate if the dropdown item has popup or not.
273
273
  */
274
274
  'aria-haspopup'?: boolean | 'dialog';
275
+ /**
276
+ * An optional string value that specifies the role of the dropdown item.
277
+ * Use this to indicate whether the item is
278
+ * or presentational (e.g., 'presentation') for accessibility purposes.
279
+ * If not specified, it defaults to role="menuitem".
280
+ */
281
+ role?: string;
275
282
  }
276
283
  export interface DropdownItemCheckboxProps {
277
284
  /**
@@ -272,6 +272,13 @@ export interface DropdownItemProps {
272
272
  * An optional boolean value used to indicate if the dropdown item has popup or not.
273
273
  */
274
274
  'aria-haspopup'?: boolean | 'dialog';
275
+ /**
276
+ * An optional string value that specifies the role of the dropdown item.
277
+ * Use this to indicate whether the item is
278
+ * or presentational (e.g., 'presentation') for accessibility purposes.
279
+ * If not specified, it defaults to role="menuitem".
280
+ */
281
+ role?: string;
275
282
  }
276
283
  export interface DropdownItemCheckboxProps {
277
284
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "13.0.5",
3
+ "version": "13.1.0",
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/"
@@ -25,12 +25,12 @@
25
25
  "runReact18": true
26
26
  },
27
27
  "dependencies": {
28
- "@atlaskit/button": "^21.1.0",
28
+ "@atlaskit/button": "^22.0.0",
29
29
  "@atlaskit/codemod-utils": "^4.2.0",
30
30
  "@atlaskit/ds-lib": "^4.0.0",
31
- "@atlaskit/icon": "^25.2.0",
31
+ "@atlaskit/icon": "^25.3.0",
32
32
  "@atlaskit/layering": "^2.0.0",
33
- "@atlaskit/menu": "^3.1.0",
33
+ "@atlaskit/menu": "^3.2.0",
34
34
  "@atlaskit/platform-feature-flags": "^1.1.0",
35
35
  "@atlaskit/popup": "^3.0.0",
36
36
  "@atlaskit/primitives": "^14.2.0",
@@ -56,7 +56,7 @@
56
56
  "@atlaskit/docs": "^10.0.0",
57
57
  "@atlaskit/form": "^12.0.0",
58
58
  "@atlaskit/heading": "^5.1.0",
59
- "@atlaskit/link": "^3.0.0",
59
+ "@atlaskit/link": "^3.1.0",
60
60
  "@atlaskit/lozenge": "^12.2.0",
61
61
  "@atlaskit/modal-dialog": "^14.0.0",
62
62
  "@atlaskit/section-message": "^8.2.0",