@atlaskit/dropdown-menu 11.5.3 → 11.5.5

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/codemods/utils/create-rename-import.tsx +38 -35
  3. package/codemods/utils/create-update-callsite.tsx +29 -27
  4. package/dist/cjs/dropdown-menu.js +11 -7
  5. package/dist/cjs/internal/components/menu-wrapper.js +12 -13
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/es2019/dropdown-menu.js +5 -8
  8. package/dist/es2019/internal/components/menu-wrapper.js +5 -6
  9. package/dist/es2019/version.json +1 -1
  10. package/dist/esm/dropdown-menu.js +5 -7
  11. package/dist/esm/internal/components/menu-wrapper.js +12 -12
  12. package/dist/esm/version.json +1 -1
  13. package/dist/types/dropdown-menu.d.ts +2 -2
  14. package/package.json +13 -14
  15. package/report.api.md +2 -2
  16. package/dist/types-ts4.0/checkbox/dropdown-item-checkbox-group.d.ts +0 -16
  17. package/dist/types-ts4.0/checkbox/dropdown-item-checkbox.d.ts +0 -13
  18. package/dist/types-ts4.0/dropdown-menu-item-group.d.ts +0 -11
  19. package/dist/types-ts4.0/dropdown-menu-item.d.ts +0 -13
  20. package/dist/types-ts4.0/dropdown-menu.d.ts +0 -13
  21. package/dist/types-ts4.0/index.d.ts +0 -8
  22. package/dist/types-ts4.0/internal/components/focus-manager.d.ts +0 -19
  23. package/dist/types-ts4.0/internal/components/menu-wrapper.d.ts +0 -11
  24. package/dist/types-ts4.0/internal/context/checkbox-group-context.d.ts +0 -5
  25. package/dist/types-ts4.0/internal/context/selection-store.d.ts +0 -27
  26. package/dist/types-ts4.0/internal/hooks/use-checkbox-state.d.ts +0 -17
  27. package/dist/types-ts4.0/internal/hooks/use-radio-state.d.ts +0 -12
  28. package/dist/types-ts4.0/internal/hooks/use-register-item-with-focus-manager.d.ts +0 -4
  29. package/dist/types-ts4.0/internal/utils/get-icon-colors.d.ts +0 -8
  30. package/dist/types-ts4.0/internal/utils/handle-focus.d.ts +0 -2
  31. package/dist/types-ts4.0/internal/utils/is-checkbox-item.d.ts +0 -1
  32. package/dist/types-ts4.0/internal/utils/is-radio-item.d.ts +0 -1
  33. package/dist/types-ts4.0/internal/utils/is-voice-over-supported.d.ts +0 -2
  34. package/dist/types-ts4.0/internal/utils/reset-options-in-group.d.ts +0 -4
  35. package/dist/types-ts4.0/internal/utils/use-generated-id.d.ts +0 -5
  36. package/dist/types-ts4.0/radio/dropdown-item-radio-group.d.ts +0 -25
  37. package/dist/types-ts4.0/radio/dropdown-item-radio.d.ts +0 -13
  38. package/dist/types-ts4.0/types.d.ts +0 -292
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/dropdown-menu
2
2
 
3
+ ## 11.5.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 11.5.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [`ab6ea02a97e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ab6ea02a97e) - Align internal implementation with current linting rules. There should be no change for consumers.
14
+
15
+ ## 11.5.4
16
+
17
+ ### Patch Changes
18
+
19
+ - [`a5fa14318a8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a5fa14318a8) - Improve examples and visual regression test coverage.
20
+
3
21
  ## 11.5.3
4
22
 
5
23
  ### Patch Changes
@@ -1,41 +1,44 @@
1
1
  import core from 'jscodeshift';
2
2
  import { Collection } from 'jscodeshift/src/Collection';
3
3
 
4
- export const createRenameImportFor = ({
5
- componentName,
6
- newComponentName,
7
- packagePath,
8
- isDefaultImport,
9
- }: {
10
- componentName: string;
11
- newComponentName: string;
12
- packagePath: string;
13
- isDefaultImport: boolean;
14
- }) => (j: core.JSCodeshift, source: Collection<Node>) => {
15
- source
16
- .find(j.ImportDeclaration)
17
- .filter((path) => path.node.source.value === packagePath)
18
- .find(j.ImportSpecifier)
19
- .filter((path) => path.node.imported.name === componentName)
20
- .replaceWith((importSpecifier) => {
21
- const specifier = j.identifier(newComponentName);
4
+ export const createRenameImportFor =
5
+ ({
6
+ componentName,
7
+ newComponentName,
8
+ packagePath,
9
+ isDefaultImport,
10
+ }: {
11
+ componentName: string;
12
+ newComponentName: string;
13
+ packagePath: string;
14
+ isDefaultImport: boolean;
15
+ }) =>
16
+ (j: core.JSCodeshift, source: Collection<Node>) => {
17
+ source
18
+ .find(j.ImportDeclaration)
19
+ .filter((path) => path.node.source.value === packagePath)
20
+ .find(j.ImportSpecifier)
21
+ .filter((path) => path.node.imported.name === componentName)
22
+ .replaceWith((importSpecifier) => {
23
+ const specifier = j.identifier(newComponentName);
22
24
 
23
- let importAlias;
24
- if (
25
- importSpecifier &&
26
- importSpecifier.node &&
27
- importSpecifier.node.local
28
- ) {
29
- importAlias =
30
- importSpecifier.node.local.name !== importSpecifier.node.imported.name
31
- ? j.identifier(importSpecifier.node.local.name)
32
- : null;
33
- }
25
+ let importAlias;
26
+ if (
27
+ importSpecifier &&
28
+ importSpecifier.node &&
29
+ importSpecifier.node.local
30
+ ) {
31
+ importAlias =
32
+ importSpecifier.node.local.name !==
33
+ importSpecifier.node.imported.name
34
+ ? j.identifier(importSpecifier.node.local.name)
35
+ : null;
36
+ }
34
37
 
35
- return isDefaultImport
36
- ? j.importDefaultSpecifier(importAlias || specifier)
37
- : j.importSpecifier(specifier, importAlias);
38
- });
38
+ return isDefaultImport
39
+ ? j.importDefaultSpecifier(importAlias || specifier)
40
+ : j.importSpecifier(specifier, importAlias);
41
+ });
39
42
 
40
- return source.toSource();
41
- };
43
+ return source.toSource();
44
+ };
@@ -1,32 +1,34 @@
1
1
  import core from 'jscodeshift';
2
2
  import { Collection } from 'jscodeshift/src/Collection';
3
3
 
4
- export const createUpdateCallsite = ({
5
- componentName,
6
- newComponentName,
7
- packagePath,
8
- }: {
9
- componentName: string;
10
- newComponentName: string;
11
- packagePath: string;
12
- }) => (j: core.JSCodeshift, source: Collection<Node>) => {
13
- source
14
- .find(j.JSXElement)
15
- // @ts-ignore
16
- .filter((path) => path.node.openingElement.name.name === componentName)
17
- .replaceWith((element) => {
18
- const elementName = j.jsxIdentifier(newComponentName);
19
- const newComponent = j.jsxElement(
20
- j.jsxOpeningElement(
21
- elementName,
22
- element.node.openingElement.attributes,
23
- ),
24
- j.jsxClosingElement(elementName),
25
- element.node.children,
26
- );
4
+ export const createUpdateCallsite =
5
+ ({
6
+ componentName,
7
+ newComponentName,
8
+ packagePath,
9
+ }: {
10
+ componentName: string;
11
+ newComponentName: string;
12
+ packagePath: string;
13
+ }) =>
14
+ (j: core.JSCodeshift, source: Collection<Node>) => {
15
+ source
16
+ .find(j.JSXElement)
17
+ // @ts-ignore
18
+ .filter((path) => path.node.openingElement.name.name === componentName)
19
+ .replaceWith((element) => {
20
+ const elementName = j.jsxIdentifier(newComponentName);
21
+ const newComponent = j.jsxElement(
22
+ j.jsxOpeningElement(
23
+ elementName,
24
+ element.node.openingElement.attributes,
25
+ ),
26
+ j.jsxClosingElement(elementName),
27
+ element.node.children,
28
+ );
27
29
 
28
- return newComponent;
29
- });
30
+ return newComponent;
31
+ });
30
32
 
31
- return source.toSource();
32
- };
33
+ return source.toSource();
34
+ };
@@ -2,6 +2,8 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
@@ -15,9 +17,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
15
17
 
16
18
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
19
 
18
- var _react = require("react");
19
-
20
- var _react2 = require("@emotion/react");
20
+ var _react = _interopRequireWildcard(require("react"));
21
21
 
22
22
  var _bindEventListener = require("bind-event-listener");
23
23
 
@@ -47,6 +47,10 @@ var _useGeneratedId = _interopRequireDefault(require("./internal/utils/use-gener
47
47
 
48
48
  var _excluded = ["ref"];
49
49
 
50
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
51
+
52
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
53
+
50
54
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
51
55
 
52
56
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -189,7 +193,7 @@ var DropdownMenu = function DropdownMenu(props) {
189
193
  });
190
194
  }, [isFocused, isLocalOpen, handleTriggerClicked]);
191
195
  var id = (0, _useGeneratedId.default)();
192
- return (0, _react2.jsx)(_selectionStore.default, null, (0, _react2.jsx)(_popup.default, {
196
+ return /*#__PURE__*/_react.default.createElement(_selectionStore.default, null, /*#__PURE__*/_react.default.createElement(_popup.default, {
193
197
  id: isLocalOpen ? id : undefined,
194
198
  shouldFlip: shouldFlip,
195
199
  isOpen: isLocalOpen,
@@ -211,13 +215,13 @@ var DropdownMenu = function DropdownMenu(props) {
211
215
  }));
212
216
  }
213
217
 
214
- return (0, _react2.jsx)(_standardButton.default, (0, _extends2.default)({}, bindFocus, {
218
+ return /*#__PURE__*/_react.default.createElement(_standardButton.default, (0, _extends2.default)({}, bindFocus, {
215
219
  ref: triggerProps.ref,
216
220
  "aria-controls": triggerProps['aria-controls'],
217
221
  "aria-expanded": triggerProps['aria-expanded'],
218
222
  "aria-haspopup": triggerProps['aria-haspopup'],
219
223
  isSelected: isLocalOpen,
220
- iconAfter: (0, _react2.jsx)(_chevronDown.default, {
224
+ iconAfter: /*#__PURE__*/_react.default.createElement(_chevronDown.default, {
221
225
  size: "medium",
222
226
  label: ""
223
227
  }),
@@ -228,7 +232,7 @@ var DropdownMenu = function DropdownMenu(props) {
228
232
  content: function content(_ref) {
229
233
  var setInitialFocusRef = _ref.setInitialFocusRef,
230
234
  update = _ref.update;
231
- return (0, _react2.jsx)(_focusManager.default, null, (0, _react2.jsx)(_menuWrapper.default, {
235
+ return /*#__PURE__*/_react.default.createElement(_focusManager.default, null, /*#__PURE__*/_react.default.createElement(_menuWrapper.default, {
232
236
  maxHeight: MAX_HEIGHT,
233
237
  maxWidth: 800,
234
238
  onClose: handleOnClose,
@@ -19,8 +19,6 @@ var _menuGroup = _interopRequireDefault(require("@atlaskit/menu/menu-group"));
19
19
 
20
20
  var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
21
21
 
22
- var _constants = require("@atlaskit/theme/constants");
23
-
24
22
  var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
25
23
 
26
24
  var _focusManager = require("../components/focus-manager");
@@ -30,24 +28,25 @@ var _isCheckboxItem = _interopRequireDefault(require("../utils/is-checkbox-item"
30
28
  var _isRadioItem = _interopRequireDefault(require("../utils/is-radio-item"));
31
29
 
32
30
  var _excluded = ["onClose", "onUpdate", "isLoading", "statusLabel", "setInitialFocusRef", "children"];
33
- var gridSize = (0, _constants.gridSize)();
34
31
  var spinnerContainerStyles = (0, _react2.css)({
35
32
  display: 'flex',
36
- minWidth: "".concat(gridSize * 20, "px"),
37
- padding: "".concat(gridSize * 2.5, "px"),
33
+ minWidth: '160px',
34
+ padding: "var(--ds-scale-250, 20px)",
38
35
  justifyContent: 'center'
39
36
  });
40
37
 
41
38
  var LoadingIndicator = function LoadingIndicator(_ref) {
42
39
  var _ref$statusLabel = _ref.statusLabel,
43
40
  statusLabel = _ref$statusLabel === void 0 ? 'Loading' : _ref$statusLabel;
44
- return (0, _react2.jsx)("div", {
45
- css: spinnerContainerStyles
46
- }, (0, _react2.jsx)(_spinner.default, {
47
- size: "small"
48
- }), (0, _react2.jsx)(_visuallyHidden.default, {
49
- role: "status"
50
- }, statusLabel));
41
+ return (// eslint-disable-next-line @repo/internal/react/use-primitives
42
+ (0, _react2.jsx)("div", {
43
+ css: spinnerContainerStyles
44
+ }, (0, _react2.jsx)(_spinner.default, {
45
+ size: "small"
46
+ }), (0, _react2.jsx)(_visuallyHidden.default, {
47
+ role: "status"
48
+ }, statusLabel))
49
+ );
51
50
  };
52
51
  /**
53
52
  *
@@ -75,7 +74,7 @@ var MenuWrapper = function MenuWrapper(_ref2) {
75
74
  var isCheckboxOrRadio = (0, _isCheckboxItem.default)(menuItem) || (0, _isRadioItem.default)(menuItem);
76
75
  return menuItem.contains(e.target) && !isCheckboxOrRadio;
77
76
  }); // Close menu if the click is triggered from a MenuItem or
78
- // its decendant. Don't close the menu if the click is triggered
77
+ // its descendant. Don't close the menu if the click is triggered
79
78
  // from a MenuItemRadio or MenuItemCheckbox so that the user can
80
79
  // select multiple items.
81
80
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.5.3",
3
+ "version": "11.5.5",
4
4
  "sideEffects": false
5
5
  }
@@ -1,8 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
- /** @jsx jsx */
4
- import { useCallback, useEffect, useMemo, useState } from 'react';
5
- import { jsx } from '@emotion/react';
2
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
6
3
  import { bind } from 'bind-event-listener';
7
4
  import Button from '@atlaskit/button/standard-button';
8
5
  import { KEY_DOWN } from '@atlaskit/ds-lib/keycodes';
@@ -137,7 +134,7 @@ const DropdownMenu = props => {
137
134
  });
138
135
  }, [isFocused, isLocalOpen, handleTriggerClicked]);
139
136
  const id = useGeneratedId();
140
- return jsx(SelectionStore, null, jsx(Popup, {
137
+ return /*#__PURE__*/React.createElement(SelectionStore, null, /*#__PURE__*/React.createElement(Popup, {
141
138
  id: isLocalOpen ? id : undefined,
142
139
  shouldFlip: shouldFlip,
143
140
  isOpen: isLocalOpen,
@@ -162,13 +159,13 @@ const DropdownMenu = props => {
162
159
  });
163
160
  }
164
161
 
165
- return jsx(Button, _extends({}, bindFocus, {
162
+ return /*#__PURE__*/React.createElement(Button, _extends({}, bindFocus, {
166
163
  ref: triggerProps.ref,
167
164
  "aria-controls": triggerProps['aria-controls'],
168
165
  "aria-expanded": triggerProps['aria-expanded'],
169
166
  "aria-haspopup": triggerProps['aria-haspopup'],
170
167
  isSelected: isLocalOpen,
171
- iconAfter: jsx(ExpandIcon, {
168
+ iconAfter: /*#__PURE__*/React.createElement(ExpandIcon, {
172
169
  size: "medium",
173
170
  label: ""
174
171
  }),
@@ -179,7 +176,7 @@ const DropdownMenu = props => {
179
176
  content: ({
180
177
  setInitialFocusRef,
181
178
  update
182
- }) => jsx(FocusManager, null, jsx(MenuWrapper, {
179
+ }) => /*#__PURE__*/React.createElement(FocusManager, null, /*#__PURE__*/React.createElement(MenuWrapper, {
183
180
  maxHeight: MAX_HEIGHT,
184
181
  maxWidth: 800,
185
182
  onClose: handleOnClose,
@@ -5,22 +5,21 @@ import { useContext, useLayoutEffect } from 'react';
5
5
  import { css, jsx } from '@emotion/react';
6
6
  import MenuGroup from '@atlaskit/menu/menu-group';
7
7
  import Spinner from '@atlaskit/spinner';
8
- import { gridSize as gridSizeFn } from '@atlaskit/theme/constants';
9
8
  import VisuallyHidden from '@atlaskit/visually-hidden';
10
9
  import { FocusManagerContext } from '../components/focus-manager';
11
10
  import isCheckboxItem from '../utils/is-checkbox-item';
12
11
  import isRadioItem from '../utils/is-radio-item';
13
- const gridSize = gridSizeFn();
14
12
  const spinnerContainerStyles = css({
15
13
  display: 'flex',
16
- minWidth: `${gridSize * 20}px`,
17
- padding: `${gridSize * 2.5}px`,
14
+ minWidth: '160px',
15
+ padding: "var(--ds-scale-250, 20px)",
18
16
  justifyContent: 'center'
19
17
  });
20
18
 
21
19
  const LoadingIndicator = ({
22
20
  statusLabel = 'Loading'
23
- }) => jsx("div", {
21
+ }) => // eslint-disable-next-line @repo/internal/react/use-primitives
22
+ jsx("div", {
24
23
  css: spinnerContainerStyles
25
24
  }, jsx(Spinner, {
26
25
  size: "small"
@@ -54,7 +53,7 @@ const MenuWrapper = ({
54
53
  const isCheckboxOrRadio = isCheckboxItem(menuItem) || isRadioItem(menuItem);
55
54
  return menuItem.contains(e.target) && !isCheckboxOrRadio;
56
55
  }); // Close menu if the click is triggered from a MenuItem or
57
- // its decendant. Don't close the menu if the click is triggered
56
+ // its descendant. Don't close the menu if the click is triggered
58
57
  // from a MenuItemRadio or MenuItemCheckbox so that the user can
59
58
  // select multiple items.
60
59
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.5.3",
3
+ "version": "11.5.5",
4
4
  "sideEffects": false
5
5
  }
@@ -8,9 +8,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
8
8
 
9
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
10
 
11
- /** @jsx jsx */
12
- import { useCallback, useEffect, useMemo, useState } from 'react';
13
- import { jsx } from '@emotion/react';
11
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
14
12
  import { bind } from 'bind-event-listener';
15
13
  import Button from '@atlaskit/button/standard-button';
16
14
  import { KEY_DOWN } from '@atlaskit/ds-lib/keycodes';
@@ -162,7 +160,7 @@ var DropdownMenu = function DropdownMenu(props) {
162
160
  });
163
161
  }, [isFocused, isLocalOpen, handleTriggerClicked]);
164
162
  var id = useGeneratedId();
165
- return jsx(SelectionStore, null, jsx(Popup, {
163
+ return /*#__PURE__*/React.createElement(SelectionStore, null, /*#__PURE__*/React.createElement(Popup, {
166
164
  id: isLocalOpen ? id : undefined,
167
165
  shouldFlip: shouldFlip,
168
166
  isOpen: isLocalOpen,
@@ -185,13 +183,13 @@ var DropdownMenu = function DropdownMenu(props) {
185
183
  }));
186
184
  }
187
185
 
188
- return jsx(Button, _extends({}, bindFocus, {
186
+ return /*#__PURE__*/React.createElement(Button, _extends({}, bindFocus, {
189
187
  ref: triggerProps.ref,
190
188
  "aria-controls": triggerProps['aria-controls'],
191
189
  "aria-expanded": triggerProps['aria-expanded'],
192
190
  "aria-haspopup": triggerProps['aria-haspopup'],
193
191
  isSelected: isLocalOpen,
194
- iconAfter: jsx(ExpandIcon, {
192
+ iconAfter: /*#__PURE__*/React.createElement(ExpandIcon, {
195
193
  size: "medium",
196
194
  label: ""
197
195
  }),
@@ -202,7 +200,7 @@ var DropdownMenu = function DropdownMenu(props) {
202
200
  content: function content(_ref) {
203
201
  var setInitialFocusRef = _ref.setInitialFocusRef,
204
202
  update = _ref.update;
205
- return jsx(FocusManager, null, jsx(MenuWrapper, {
203
+ return /*#__PURE__*/React.createElement(FocusManager, null, /*#__PURE__*/React.createElement(MenuWrapper, {
206
204
  maxHeight: MAX_HEIGHT,
207
205
  maxWidth: 800,
208
206
  onClose: handleOnClose,
@@ -7,29 +7,29 @@ import { useContext, useLayoutEffect } from 'react';
7
7
  import { css, jsx } from '@emotion/react';
8
8
  import MenuGroup from '@atlaskit/menu/menu-group';
9
9
  import Spinner from '@atlaskit/spinner';
10
- import { gridSize as gridSizeFn } from '@atlaskit/theme/constants';
11
10
  import VisuallyHidden from '@atlaskit/visually-hidden';
12
11
  import { FocusManagerContext } from '../components/focus-manager';
13
12
  import isCheckboxItem from '../utils/is-checkbox-item';
14
13
  import isRadioItem from '../utils/is-radio-item';
15
- var gridSize = gridSizeFn();
16
14
  var spinnerContainerStyles = css({
17
15
  display: 'flex',
18
- minWidth: "".concat(gridSize * 20, "px"),
19
- padding: "".concat(gridSize * 2.5, "px"),
16
+ minWidth: '160px',
17
+ padding: "var(--ds-scale-250, 20px)",
20
18
  justifyContent: 'center'
21
19
  });
22
20
 
23
21
  var LoadingIndicator = function LoadingIndicator(_ref) {
24
22
  var _ref$statusLabel = _ref.statusLabel,
25
23
  statusLabel = _ref$statusLabel === void 0 ? 'Loading' : _ref$statusLabel;
26
- return jsx("div", {
27
- css: spinnerContainerStyles
28
- }, jsx(Spinner, {
29
- size: "small"
30
- }), jsx(VisuallyHidden, {
31
- role: "status"
32
- }, statusLabel));
24
+ return (// eslint-disable-next-line @repo/internal/react/use-primitives
25
+ jsx("div", {
26
+ css: spinnerContainerStyles
27
+ }, jsx(Spinner, {
28
+ size: "small"
29
+ }), jsx(VisuallyHidden, {
30
+ role: "status"
31
+ }, statusLabel))
32
+ );
33
33
  };
34
34
  /**
35
35
  *
@@ -57,7 +57,7 @@ var MenuWrapper = function MenuWrapper(_ref2) {
57
57
  var isCheckboxOrRadio = isCheckboxItem(menuItem) || isRadioItem(menuItem);
58
58
  return menuItem.contains(e.target) && !isCheckboxOrRadio;
59
59
  }); // Close menu if the click is triggered from a MenuItem or
60
- // its decendant. Don't close the menu if the click is triggered
60
+ // its descendant. Don't close the menu if the click is triggered
61
61
  // from a MenuItemRadio or MenuItemCheckbox so that the user can
62
62
  // select multiple items.
63
63
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.5.3",
3
+ "version": "11.5.5",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,4 @@
1
- import { jsx } from '@emotion/react';
1
+ /// <reference types="react" />
2
2
  import type { DropdownMenuProps } from './types';
3
3
  /**
4
4
  * __Dropdown menu__
@@ -9,5 +9,5 @@ import type { DropdownMenuProps } from './types';
9
9
  * - [Code](https://atlassian.design/components/dropdown-menu/code)
10
10
  * - [Usage](https://atlassian.design/components/dropdown-menu/usage)
11
11
  */
12
- declare const DropdownMenu: <T extends HTMLElement = HTMLElement>(props: DropdownMenuProps<T>) => jsx.JSX.Element;
12
+ declare const DropdownMenu: <T extends HTMLElement = HTMLElement>(props: DropdownMenuProps<T>) => JSX.Element;
13
13
  export default DropdownMenu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.5.3",
3
+ "version": "11.5.5",
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/"
@@ -12,19 +12,11 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
- "typesVersions": {
16
- ">=4.0 <4.5": {
17
- "*": [
18
- "dist/types-ts4.0/*",
19
- "dist/types-ts4.0/index.d.ts"
20
- ]
21
- }
22
- },
23
15
  "sideEffects": false,
24
16
  "atlaskit:src": "src/index.tsx",
25
17
  "atlassian": {
26
- "disableProductCI": true,
27
18
  "team": "Design System Team",
19
+ "disableProductCI": true,
28
20
  "releaseModel": "scheduled",
29
21
  "website": {
30
22
  "name": "Dropdown menu",
@@ -40,7 +32,7 @@
40
32
  "@atlaskit/popup": "^1.5.0",
41
33
  "@atlaskit/spinner": "^15.2.0",
42
34
  "@atlaskit/theme": "^12.2.0",
43
- "@atlaskit/tokens": "^0.10.0",
35
+ "@atlaskit/tokens": "^0.11.0",
44
36
  "@atlaskit/visually-hidden": "^1.1.0",
45
37
  "@babel/runtime": "^7.0.0",
46
38
  "@emotion/react": "^11.7.1",
@@ -53,7 +45,9 @@
53
45
  "devDependencies": {
54
46
  "@atlaskit/avatar": "^21.1.0",
55
47
  "@atlaskit/docs": "*",
56
- "@atlaskit/lozenge": "11.3.0",
48
+ "@atlaskit/ds-explorations": "^1.0.0",
49
+ "@atlaskit/heading": "^1.0.0",
50
+ "@atlaskit/lozenge": "11.3.1",
57
51
  "@atlaskit/modal-dialog": "^12.4.0",
58
52
  "@atlaskit/section-message": "^6.3.0",
59
53
  "@atlaskit/ssr": "*",
@@ -82,9 +76,14 @@
82
76
  },
83
77
  "@repo/internal": {
84
78
  "dom-events": "use-bind-event-listener",
85
- "ui-components": "lite-mode",
79
+ "ui-components": [
80
+ "primitives",
81
+ "lite-mode"
82
+ ],
86
83
  "design-system": "v1",
87
- "design-tokens": "spacing",
84
+ "design-tokens": [
85
+ "spacing"
86
+ ],
88
87
  "styling": [
89
88
  "static",
90
89
  "emotion"
package/report.api.md CHANGED
@@ -25,7 +25,7 @@ import type { TriggerProps } from '@atlaskit/popup/types';
25
25
 
26
26
  // @public (undocumented)
27
27
  export interface CustomTriggerProps<
28
- TriggerElement extends HTMLElement = HTMLElement
28
+ TriggerElement extends HTMLElement = HTMLElement,
29
29
  > extends Omit<TriggerProps, 'ref'> {
30
30
  isSelected?: boolean;
31
31
  onClick?: (e: MouseEvent_2 | KeyboardEvent_2) => void;
@@ -127,7 +127,7 @@ export interface DropdownMenuGroupProps extends SectionProps_2 {}
127
127
 
128
128
  // @public (undocumented)
129
129
  export interface DropdownMenuProps<
130
- TriggerElement extends HTMLElement = HTMLElement
130
+ TriggerElement extends HTMLElement = HTMLElement,
131
131
  > {
132
132
  appearance?: 'default' | 'tall';
133
133
  autoFocus?: boolean;
@@ -1,16 +0,0 @@
1
- /// <reference types="react" />
2
- import type { SectionProps } from '@atlaskit/menu';
3
- interface DropdownItemCheckboxGroupProps extends SectionProps {
4
- /**
5
- * Unique identifier for the checkbox group.
6
- */
7
- id: string;
8
- }
9
- /**
10
- * __Dropdown item checkbox group__
11
- *
12
- * A wrapping element for dropdown menu checkbox items.
13
- *
14
- */
15
- declare const DropdownItemCheckboxGroup: (props: DropdownItemCheckboxGroupProps) => JSX.Element;
16
- export default DropdownItemCheckboxGroup;
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import { DropdownItemCheckboxProps } from '../types';
3
- /**
4
- * __Dropdown item checkbox__
5
- *
6
- * A dropdown item checkbox creates groups that have multiple selections.
7
- *
8
- * - [Examples](https://atlassian.design/components/dropdown-menu/dropdown-item-checkbox/examples)
9
- * - [Code](https://atlassian.design/components/dropdown-menu/dropdown-item-checkbox/code)
10
- * - [Usage](https://atlassian.design/components/dropdown-menu/dropdown-item-checkbox/usage)
11
- */
12
- declare const DropdownItemCheckbox: (props: DropdownItemCheckboxProps) => JSX.Element;
13
- export default DropdownItemCheckbox;
@@ -1,11 +0,0 @@
1
- /**
2
- * __Section__
3
- *
4
- * A dropdown item group includes all the actions or items in a dropdown menu.
5
- *
6
- * - [Examples](https://atlassian.design/components/dropdown-menu/dropdown-item-group/examples)
7
- * - [Code](https://atlassian.design/components/dropdown-menu/dropdown-item-group/code)
8
- * - [Usage](https://atlassian.design/components/dropdown-menu/dropdown-item-group/usage)
9
- */
10
- import Section from '@atlaskit/menu/section';
11
- export default Section;
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import { DropdownItemProps } from './types';
3
- /**
4
- * __Dropdown menu item__
5
- *
6
- * A dropdown item populates the dropdown menu with items. Every item should be inside a dropdown item group.
7
- *
8
- * - [Examples](https://atlassian.design/components/dropdown-item/examples)
9
- * - [Code](https://atlassian.design/components/dropdown-item/code)
10
- * - [Usage](https://atlassian.design/components/dropdown-item/usage)
11
- */
12
- declare const DropdownMenuItem: (props: DropdownItemProps) => JSX.Element;
13
- export default DropdownMenuItem;
@@ -1,13 +0,0 @@
1
- import { jsx } from '@emotion/react';
2
- import type { DropdownMenuProps } from './types';
3
- /**
4
- * __Dropdown menu__
5
- *
6
- * A dropdown menu displays a list of actions or options to a user.
7
- *
8
- * - [Examples](https://atlassian.design/components/dropdown-menu/examples)
9
- * - [Code](https://atlassian.design/components/dropdown-menu/code)
10
- * - [Usage](https://atlassian.design/components/dropdown-menu/usage)
11
- */
12
- declare const DropdownMenu: <T extends HTMLElement = HTMLElement>(props: DropdownMenuProps<T>) => jsx.JSX.Element;
13
- export default DropdownMenu;
@@ -1,8 +0,0 @@
1
- export { default } from './dropdown-menu';
2
- export { default as DropdownItemGroup } from './dropdown-menu-item-group';
3
- export { default as DropdownItem } from './dropdown-menu-item';
4
- export { default as DropdownItemCheckbox } from './checkbox/dropdown-item-checkbox';
5
- export { default as DropdownItemCheckboxGroup } from './checkbox/dropdown-item-checkbox-group';
6
- export { default as DropdownItemRadio } from './radio/dropdown-item-radio';
7
- export { default as DropdownItemRadioGroup } from './radio/dropdown-item-radio-group';
8
- export type { DropdownMenuProps, DropdownMenuGroupProps, DropdownItemProps, OnOpenChangeArgs, CustomTriggerProps, } from './types';
@@ -1,19 +0,0 @@
1
- import React, { FC } from 'react';
2
- import { FocusableElement } from '../../types';
3
- /**
4
- *
5
- *
6
- * Context provider which maintains the list of focusable elements and a method to
7
- * register new menu items.
8
- * This list drives the keyboard navgation of the menu.
9
- *
10
- */
11
- export declare const FocusManagerContext: React.Context<{
12
- menuItemRefs: FocusableElement[];
13
- registerRef: (ref: FocusableElement) => void;
14
- }>;
15
- /**
16
- * Focus manager logic
17
- */
18
- declare const FocusManager: FC;
19
- export default FocusManager;
@@ -1,11 +0,0 @@
1
- import { jsx } from '@emotion/react';
2
- import { MenuWrapperProps } from '../../types';
3
- /**
4
- *
5
- * MenuWrapper wraps all the menu items.
6
- * It handles the logic to close the menu when a MenuItem is clicked, but leaves it open
7
- * if a CheckboxItem or RadioItem is clicked.
8
- * It also sets focus to the first menu item when opened.
9
- */
10
- declare const MenuWrapper: ({ onClose, onUpdate, isLoading, statusLabel, setInitialFocusRef, children, ...props }: MenuWrapperProps) => jsx.JSX.Element;
11
- export default MenuWrapper;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- * Holds the unique identifier for the checkbox group.
4
- */
5
- export declare const CheckboxGroupContext: import("react").Context<string>;
@@ -1,27 +0,0 @@
1
- import React from 'react';
2
- declare type OptionsInGroup = {
3
- [key: string]: boolean | undefined;
4
- };
5
- declare type SelectionStoreContextProps = {
6
- setItemState: (group: string, id: string, value: boolean | undefined) => void;
7
- getItemState: (group: string, id: string) => boolean | undefined;
8
- setGroupState: (group: string, value: OptionsInGroup) => void;
9
- getGroupState: (group: string) => OptionsInGroup;
10
- };
11
- /**
12
- *
13
- * SelectionStoreContext maintains the state of the selected items
14
- * and getter setters.
15
- *
16
- */
17
- export declare const SelectionStoreContext: React.Context<SelectionStoreContextProps>;
18
- declare type SelectionStoreProps = {
19
- children: React.ReactNode;
20
- };
21
- /**
22
- * Selection store will persist data as long as it remains mounted.
23
- * It handles the uncontrolled story for dropdown menu when the menu
24
- * items can be mounted/unmounted depending if the menu is open or closed.
25
- */
26
- declare const SelectionStore: (props: SelectionStoreProps) => JSX.Element;
27
- export default SelectionStore;
@@ -1,17 +0,0 @@
1
- declare type CheckboxStateArgs = {
2
- id: string;
3
- isSelected: boolean | undefined;
4
- defaultSelected: boolean | undefined;
5
- };
6
- declare type SetStateCallback = (value: boolean | undefined) => boolean;
7
- declare type CheckboxStateValue = [
8
- boolean,
9
- (newValue: SetStateCallback) => void
10
- ];
11
- /**
12
- * Custom hook to handle checkbox state for dropdown menu.
13
- * It works in tandem with the selection store context when the
14
- * component is uncontrolled.
15
- */
16
- declare const useCheckboxState: ({ isSelected, id, defaultSelected, }: CheckboxStateArgs) => CheckboxStateValue;
17
- export default useCheckboxState;
@@ -1,12 +0,0 @@
1
- declare type RadioStateArgs = {
2
- id: string;
3
- isSelected: boolean | undefined;
4
- defaultSelected: boolean | undefined;
5
- };
6
- declare type SetStateCallback = (value: boolean | undefined) => boolean;
7
- declare type RadioStateValue = [
8
- boolean,
9
- (newValue: SetStateCallback) => void
10
- ];
11
- declare function useRadioState({ id, isSelected, defaultSelected, }: RadioStateArgs): RadioStateValue;
12
- export default useRadioState;
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import { FocusableElement } from '../../types';
3
- declare function useRegisterItemWithFocusManager(): import("react").RefObject<FocusableElement>;
4
- export default useRegisterItemWithFocusManager;
@@ -1,8 +0,0 @@
1
- declare const getIconColors: (isSelected: boolean | undefined) => {
2
- primary: "var(--ds-background-brand-bold)";
3
- secondary: "var(--ds-icon-inverse)";
4
- } | {
5
- primary: "var(--ds-background-neutral)";
6
- secondary: "var(--ds-UNSAFE_util-transparent)";
7
- };
8
- export default getIconColors;
@@ -1,2 +0,0 @@
1
- import { FocusableElement } from '../../types';
2
- export default function handleFocus(refs: Array<FocusableElement>): (e: KeyboardEvent) => void;
@@ -1 +0,0 @@
1
- export default function isCheckboxItem(element: HTMLElement): boolean;
@@ -1 +0,0 @@
1
- export default function isCheckboxItem(element: HTMLElement): boolean;
@@ -1,2 +0,0 @@
1
- declare const isVoiceOverSupported: () => boolean;
2
- export default isVoiceOverSupported;
@@ -1,4 +0,0 @@
1
- declare const resetOptionsInGroup: (group: {
2
- [key: string]: boolean | undefined;
3
- }) => {};
4
- export default resetOptionsInGroup;
@@ -1,5 +0,0 @@
1
- /**
2
- * useGeneratedId generates a random string which remains constant across
3
- * renders when called without any parameter.
4
- */
5
- export default function useGeneratedId(): string;
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import type { SectionProps } from '@atlaskit/menu';
3
- interface DropdownItemRadioGroupProps extends SectionProps {
4
- id: string;
5
- }
6
- interface RadioGroupContextProps {
7
- id: string;
8
- radioGroupState: {
9
- [key: string]: boolean | undefined;
10
- };
11
- selectRadioItem: (id: string, value: boolean) => void;
12
- }
13
- /**
14
- * __Radio group context__
15
- * Context provider that wraps each DropdownItemRadioGroup
16
- */
17
- export declare const RadioGroupContext: React.Context<RadioGroupContextProps>;
18
- /**
19
- * __Dropdown item radio group__
20
- * Store which manages the selection state for each DropdownItemRadio
21
- * across mount and unmounts.
22
- *
23
- */
24
- declare const DropdownItemRadioGroup: (props: DropdownItemRadioGroupProps) => JSX.Element;
25
- export default DropdownItemRadioGroup;
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import { DropdownItemRadioProps } from '../types';
3
- /**
4
- * __Dropdown item radio__
5
- *
6
- * A dropdown item radio displays groups that have a single selection.
7
- *
8
- * - [Examples](https://atlassian.design/components/dropdown-menu/dropdown-item-radio/examples)
9
- * - [Code](https://atlassian.design/components/dropdown-menu/dropdown-item-radio/code)
10
- * - [Usage](https://atlassian.design/components/dropdown-menu/dropdown-item-radio/usage)
11
- */
12
- declare const DropdownItemRadio: (props: DropdownItemRadioProps) => JSX.Element;
13
- export default DropdownItemRadio;
@@ -1,292 +0,0 @@
1
- import { KeyboardEvent, MouseEvent, ReactElement, ReactNode, Ref } from 'react';
2
- import type { CustomItemProps, MenuGroupProps, SectionProps } from '@atlaskit/menu/types';
3
- import type { ContentProps, TriggerProps } from '@atlaskit/popup/types';
4
- export declare type FocusableElement = HTMLAnchorElement | HTMLButtonElement;
5
- export declare type Action = 'next' | 'prev' | 'first' | 'last';
6
- export declare type Placement = 'auto-start' | 'auto' | 'auto-end' | 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-end' | 'bottom' | 'bottom-start' | 'left-end' | 'left' | 'left-start';
7
- export declare type ItemId = string;
8
- export declare type GroupId = string;
9
- export declare type CachedItem = {
10
- id: ItemId;
11
- groupId: GroupId;
12
- };
13
- export declare type FocusItem = {
14
- itemId: ItemId;
15
- itemNode: HTMLElement;
16
- };
17
- export declare type Behaviors = 'checkbox' | 'radio' | 'menuitemcheckbox' | 'menuitemradio';
18
- export interface CustomTriggerProps<TriggerElement extends HTMLElement = HTMLElement> extends Omit<TriggerProps, 'ref'> {
19
- /**
20
- * Ref that should be applied to the trigger. This is used to calculate the menu position.
21
- */
22
- triggerRef: Ref<TriggerElement>;
23
- /**
24
- * Makes the trigger appear selected.
25
- */
26
- isSelected?: boolean;
27
- /**
28
- * Event that is triggered when the element is clicked.
29
- */
30
- onClick?: (e: MouseEvent | KeyboardEvent) => void;
31
- /**
32
- * A `testId` prop is provided for specified elements, which is a unique
33
- * string that appears as a data attribute `data-testid` in the rendered code,
34
- * serving as a hook for automated tests.
35
- *
36
- * As dropdown-menu is composed of different components, we passed down the testId to the sub component you want to test:
37
- * - `testId--trigger` to get the menu trigger.
38
- * - `testId--content` to get the dropdown content trigger.
39
- */
40
- testId?: string;
41
- }
42
- export interface OnOpenChangeArgs {
43
- isOpen: boolean;
44
- event: MouseEvent | KeyboardEvent;
45
- }
46
- export interface MenuWrapperProps extends MenuGroupProps {
47
- setInitialFocusRef?: ContentProps['setInitialFocusRef'];
48
- onClose?: ContentProps['onClose'];
49
- onUpdate: ContentProps['update'];
50
- isLoading?: DropdownMenuProps['isLoading'];
51
- statusLabel?: DropdownMenuProps['statusLabel'];
52
- }
53
- export interface DropdownMenuGroupProps extends SectionProps {
54
- }
55
- export interface DropdownMenuProps<TriggerElement extends HTMLElement = HTMLElement> {
56
- /**
57
- * Controls the appearance of the menu.
58
- * Default menu has scroll after its height exceeds the pre-defined amount.
59
- * Tall menu has no scroll until the height exceeds the height of the viewport.
60
- */
61
- appearance?: 'default' | 'tall';
62
- /**
63
- * Controls if the first menu item receives focus when menu is opened. Note that the menu has a focus lock
64
- * which traps the focus within the menu. Also, the first item gets fouced automatically
65
- * if the menu is triggered using the keyboard.
66
- *
67
- */
68
- autoFocus?: boolean;
69
- /**
70
- * Content that will be rendered inside the layer element. Should typically be
71
- * `DropdownItemGroup` or `DropdownItem`, or checkbox / radio variants of those.
72
- */
73
- children?: ReactNode;
74
- /**
75
- * If true, a Spinner is rendered instead of the items
76
- */
77
- isLoading?: boolean;
78
- /**
79
- * Text to be used as status for assistive technologies. Defaults to "Loading".
80
- */
81
- statusLabel?: string;
82
- /**
83
- * Controls the open state of the dropdown.
84
- */
85
- isOpen?: boolean;
86
- /**
87
- * Position of the menu.
88
- */
89
- placement?: Placement;
90
- /**
91
- * Allows the dropdown menu to be placed on the opposite side of its trigger if it does not
92
- * fit in the viewport.
93
- */
94
- shouldFlip?: boolean;
95
- /**
96
- * Content which will trigger the dropdown menu to open and close. Use with `triggerType`
97
- * to easily get a button trigger.
98
- */
99
- trigger?: string | ((triggerButtonProps: CustomTriggerProps<TriggerElement>) => ReactElement);
100
- /**
101
- * A `testId` prop is provided for specified elements, which is a unique
102
- * string that appears as a data attribute `data-testid` in the rendered code,
103
- * serving as a hook for automated tests.
104
- *
105
- * As dropdown-menu is composed of different components, we passed down the testId to the sub component you want to test:
106
- * - `testId--trigger` to get the menu trigger.
107
- * - `testId--content` to get the dropdown content trigger.
108
- */
109
- testId?: string;
110
- /**
111
- * Controls the initial open state of the dropdown. If provided, the component is considered to be controlled
112
- * which means that the user is responsible for managing the open and close state of the menu.
113
- */
114
- defaultOpen?: boolean;
115
- /**
116
- * Called when the menu should be open/closed. Receives an object with `isOpen` state.
117
- */
118
- onOpenChange?: (args: OnOpenChangeArgs) => void;
119
- /**
120
- * Z-index that the popup should be displayed in.
121
- * This is passed to the portal component.
122
- * Defaults to `layers.modal()` from `@atlaskit/theme` which is 510.
123
- */
124
- zIndex?: number;
125
- }
126
- export interface DropdownItemProps {
127
- /**
128
- * Primary content for the item.
129
- */
130
- children: React.ReactNode;
131
- /**
132
- * Custom component to render as an item.
133
- */
134
- component?: CustomItemProps['component'];
135
- /**
136
- * Description of the item.
137
- * This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
138
- */
139
- description?: string | JSX.Element;
140
- /**
141
- * Makes the element appear disabled as well as removing interactivity.
142
- */
143
- isDisabled?: boolean;
144
- /**
145
- * When `true` the title of the item will wrap multiple lines if it's long enough.
146
- */
147
- shouldTitleWrap?: boolean;
148
- /**
149
- * When `true` the description of the item will wrap multiple lines if it's long enough.
150
- */
151
- shouldDescriptionWrap?: boolean;
152
- /**
153
- * Event that is triggered when the element is clicked.
154
- */
155
- onClick?: (e: MouseEvent | KeyboardEvent) => void;
156
- /**
157
- * Makes the element appear selected.
158
- */
159
- isSelected?: boolean;
160
- /**
161
- * Link to another page.
162
- */
163
- href?: string;
164
- /**
165
- * Where to display the linked URL,
166
- * see [anchor information](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) on mdn for more information.
167
- */
168
- target?: string;
169
- /**
170
- * Adds a title attribute to the root item element.
171
- */
172
- title?: string;
173
- /**
174
- * Element to render before the item text.
175
- * Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
176
- */
177
- elemBefore?: React.ReactNode;
178
- /**
179
- * Element to render after the item text.
180
- * Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
181
- */
182
- elemAfter?: React.ReactNode;
183
- /**
184
- * The relationship of the linked URL as space-separated link types.
185
- * Generally you'll want to set this to "noopener noreferrer" when `target` is "_blank".
186
- */
187
- rel?: string;
188
- /**
189
- * A `testId` prop is provided for specified elements,
190
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
191
- * serving as a hook for automated tests.
192
- */
193
- testId?: string;
194
- }
195
- export interface DropdownItemCheckboxProps {
196
- /**
197
- * Primary content for the item.
198
- */
199
- children: React.ReactNode;
200
- /**
201
- * Description of the item.
202
- * This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
203
- */
204
- description?: string | JSX.Element;
205
- /**
206
- * Makes the checkbox appear disabled as well as removing interactivity.
207
- */
208
- isDisabled?: boolean;
209
- /**
210
- * When `true` the title of the item will wrap multiple lines if it's long enough.
211
- */
212
- shouldTitleWrap?: boolean;
213
- /**
214
- * When `true` the description of the item will wrap multiple lines if it's long enough.
215
- */
216
- shouldDescriptionWrap?: boolean;
217
- /**
218
- * Event that is triggered when the checkbox is clicked.
219
- */
220
- onClick?: (e: MouseEvent | KeyboardEvent) => void;
221
- /**
222
- * Sets whether the checkbox is checked or unchecked.
223
- */
224
- isSelected?: boolean;
225
- /**
226
- * Sets whether the checkbox begins selected.
227
- */
228
- defaultSelected?: boolean;
229
- /**
230
- * Unique id of a checkbox
231
- */
232
- id: string;
233
- /**
234
- * Adds a title attribute to the root item element.
235
- */
236
- title?: string;
237
- /**
238
- * A `testId` prop is provided for specified elements,
239
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
240
- * serving as a hook for automated tests.
241
- */
242
- testId?: string;
243
- }
244
- export interface DropdownItemRadioProps {
245
- /**
246
- * Primary content for the item.
247
- */
248
- children: React.ReactNode;
249
- /**
250
- * Description of the item.
251
- * This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
252
- */
253
- description?: string | JSX.Element;
254
- /**
255
- * Makes the checkbox appear disabled as well as removing interactivity.
256
- */
257
- isDisabled?: boolean;
258
- /**
259
- * When `true` the title of the item will wrap multiple lines if it's long enough.
260
- */
261
- shouldTitleWrap?: boolean;
262
- /**
263
- * When `true` the description of the item will wrap multiple lines if it's long enough.
264
- */
265
- shouldDescriptionWrap?: boolean;
266
- /**
267
- * Event that is triggered when the checkbox is clicked.
268
- */
269
- onClick?: (e: MouseEvent | KeyboardEvent) => void;
270
- /**
271
- * Sets whether the checkbox is checked or unchecked.
272
- */
273
- isSelected?: boolean;
274
- /**
275
- * Sets whether the checkbox begins selected.
276
- */
277
- defaultSelected?: boolean;
278
- /**
279
- * Unique id of a checkbox
280
- */
281
- id: string;
282
- /**
283
- * Adds a title attribute to the root item element.
284
- */
285
- title?: string;
286
- /**
287
- * A `testId` prop is provided for specified elements,
288
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
289
- * serving as a hook for automated tests.
290
- */
291
- testId?: string;
292
- }