@atlaskit/menu 1.3.7 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/menu-item/button-item.js +1 -3
- package/dist/cjs/menu-item/custom-item.js +1 -3
- package/dist/cjs/menu-item/link-item.js +1 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/menu-item/button-item.js +1 -2
- package/dist/es2019/menu-item/custom-item.js +1 -2
- package/dist/es2019/menu-item/link-item.js +1 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/menu-item/button-item.js +1 -2
- package/dist/esm/menu-item/custom-item.js +1 -2
- package/dist/esm/menu-item/link-item.js +1 -2
- package/dist/esm/version.json +1 -1
- package/package.json +2 -2
- package/report.api.md +532 -0
- package/dist/cjs/internal/hooks/use-blur-on-mouse-down.js +0 -29
- package/dist/es2019/internal/hooks/use-blur-on-mouse-down.js +0 -19
- package/dist/esm/internal/hooks/use-blur-on-mouse-down.js +0 -19
- package/dist/types/internal/hooks/use-blur-on-mouse-down.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/menu
|
|
2
2
|
|
|
3
|
+
## 1.3.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b196f69e76b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b196f69e76b) - Menu items no longer intercept mouse down events to force focus or blur behavior depending on the last focused element.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
3
10
|
## 1.3.7
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -19,8 +19,6 @@ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
|
19
19
|
|
|
20
20
|
var _menuItemPrimitive = _interopRequireDefault(require("../internal/components/menu-item-primitive"));
|
|
21
21
|
|
|
22
|
-
var _useBlurOnMouseDown = require("../internal/hooks/use-blur-on-mouse-down");
|
|
23
|
-
|
|
24
22
|
var _excluded = ["children", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap"];
|
|
25
23
|
|
|
26
24
|
/**
|
|
@@ -50,7 +48,7 @@ function (props, ref) {
|
|
|
50
48
|
shouldTitleWrap = props.shouldTitleWrap,
|
|
51
49
|
shouldDescriptionWrap = props.shouldDescriptionWrap,
|
|
52
50
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
53
|
-
var onMouseDownHandler =
|
|
51
|
+
var onMouseDownHandler = onMouseDown;
|
|
54
52
|
|
|
55
53
|
if (!children) {
|
|
56
54
|
return null;
|
|
@@ -19,8 +19,6 @@ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
|
19
19
|
|
|
20
20
|
var _menuItemPrimitive = _interopRequireDefault(require("../internal/components/menu-item-primitive"));
|
|
21
21
|
|
|
22
|
-
var _useBlurOnMouseDown = require("../internal/hooks/use-blur-on-mouse-down");
|
|
23
|
-
|
|
24
22
|
var _excluded = ["component", "cssFn", "isDisabled", "isSelected", "onClick", "testId", "children", "description", "iconAfter", "iconBefore", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap"];
|
|
25
23
|
|
|
26
24
|
var preventEvent = function preventEvent(e) {
|
|
@@ -55,7 +53,7 @@ var CustomItem = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardR
|
|
|
55
53
|
shouldTitleWrap = _ref.shouldTitleWrap,
|
|
56
54
|
shouldDescriptionWrap = _ref.shouldDescriptionWrap,
|
|
57
55
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
58
|
-
var onMouseDownHandler =
|
|
56
|
+
var onMouseDownHandler = onMouseDown;
|
|
59
57
|
|
|
60
58
|
if (!Component) {
|
|
61
59
|
return null;
|
|
@@ -19,8 +19,6 @@ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
|
19
19
|
|
|
20
20
|
var _menuItemPrimitive = _interopRequireDefault(require("../internal/components/menu-item-primitive"));
|
|
21
21
|
|
|
22
|
-
var _useBlurOnMouseDown = require("../internal/hooks/use-blur-on-mouse-down");
|
|
23
|
-
|
|
24
22
|
var _excluded = ["children", "href", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap"];
|
|
25
23
|
|
|
26
24
|
var preventEvent = function preventEvent(e) {
|
|
@@ -56,7 +54,7 @@ function (props, ref) {
|
|
|
56
54
|
shouldTitleWrap = props.shouldTitleWrap,
|
|
57
55
|
shouldDescriptionWrap = props.shouldDescriptionWrap,
|
|
58
56
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
59
|
-
var onMouseDownHandler =
|
|
57
|
+
var onMouseDownHandler = onMouseDown;
|
|
60
58
|
|
|
61
59
|
if (!children) {
|
|
62
60
|
return null;
|
package/dist/cjs/version.json
CHANGED
|
@@ -5,7 +5,6 @@ import { forwardRef, memo } from 'react';
|
|
|
5
5
|
import { jsx } from '@emotion/core';
|
|
6
6
|
import noop from '@atlaskit/ds-lib/noop';
|
|
7
7
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
8
|
-
import { useBlurOnMouseDown } from '../internal/hooks/use-blur-on-mouse-down';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* __Button item__
|
|
@@ -33,7 +32,7 @@ const ButtonItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef( // Type needed on
|
|
|
33
32
|
shouldDescriptionWrap,
|
|
34
33
|
...rest
|
|
35
34
|
} = props;
|
|
36
|
-
const onMouseDownHandler =
|
|
35
|
+
const onMouseDownHandler = onMouseDown;
|
|
37
36
|
|
|
38
37
|
if (!children) {
|
|
39
38
|
return null;
|
|
@@ -5,7 +5,6 @@ import { forwardRef, memo } from 'react';
|
|
|
5
5
|
import { css, jsx } from '@emotion/core';
|
|
6
6
|
import noop from '@atlaskit/ds-lib/noop';
|
|
7
7
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
8
|
-
import { useBlurOnMouseDown } from '../internal/hooks/use-blur-on-mouse-down';
|
|
9
8
|
|
|
10
9
|
const preventEvent = e => {
|
|
11
10
|
e.preventDefault();
|
|
@@ -37,7 +36,7 @@ const CustomItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
37
36
|
shouldDescriptionWrap,
|
|
38
37
|
...rest
|
|
39
38
|
}, ref) => {
|
|
40
|
-
const onMouseDownHandler =
|
|
39
|
+
const onMouseDownHandler = onMouseDown;
|
|
41
40
|
|
|
42
41
|
if (!Component) {
|
|
43
42
|
return null;
|
|
@@ -5,7 +5,6 @@ import { forwardRef, memo } from 'react';
|
|
|
5
5
|
import { jsx } from '@emotion/core';
|
|
6
6
|
import noop from '@atlaskit/ds-lib/noop';
|
|
7
7
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
8
|
-
import { useBlurOnMouseDown } from '../internal/hooks/use-blur-on-mouse-down';
|
|
9
8
|
|
|
10
9
|
const preventEvent = e => {
|
|
11
10
|
e.preventDefault();
|
|
@@ -39,7 +38,7 @@ const LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef( // Type needed on p
|
|
|
39
38
|
shouldDescriptionWrap,
|
|
40
39
|
...rest
|
|
41
40
|
} = props;
|
|
42
|
-
const onMouseDownHandler =
|
|
41
|
+
const onMouseDownHandler = onMouseDown;
|
|
43
42
|
|
|
44
43
|
if (!children) {
|
|
45
44
|
return null;
|
package/dist/es2019/version.json
CHANGED
|
@@ -7,7 +7,6 @@ import { forwardRef, memo } from 'react';
|
|
|
7
7
|
import { jsx } from '@emotion/core';
|
|
8
8
|
import noop from '@atlaskit/ds-lib/noop';
|
|
9
9
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
10
|
-
import { useBlurOnMouseDown } from '../internal/hooks/use-blur-on-mouse-down';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* __Button item__
|
|
@@ -37,7 +36,7 @@ function (props, ref) {
|
|
|
37
36
|
shouldDescriptionWrap = props.shouldDescriptionWrap,
|
|
38
37
|
rest = _objectWithoutProperties(props, _excluded);
|
|
39
38
|
|
|
40
|
-
var onMouseDownHandler =
|
|
39
|
+
var onMouseDownHandler = onMouseDown;
|
|
41
40
|
|
|
42
41
|
if (!children) {
|
|
43
42
|
return null;
|
|
@@ -7,7 +7,6 @@ import { forwardRef, memo } from 'react';
|
|
|
7
7
|
import { css, jsx } from '@emotion/core';
|
|
8
8
|
import noop from '@atlaskit/ds-lib/noop';
|
|
9
9
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
10
|
-
import { useBlurOnMouseDown } from '../internal/hooks/use-blur-on-mouse-down';
|
|
11
10
|
|
|
12
11
|
var preventEvent = function preventEvent(e) {
|
|
13
12
|
e.preventDefault();
|
|
@@ -42,7 +41,7 @@ var CustomItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref)
|
|
|
42
41
|
shouldDescriptionWrap = _ref.shouldDescriptionWrap,
|
|
43
42
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
44
43
|
|
|
45
|
-
var onMouseDownHandler =
|
|
44
|
+
var onMouseDownHandler = onMouseDown;
|
|
46
45
|
|
|
47
46
|
if (!Component) {
|
|
48
47
|
return null;
|
|
@@ -7,7 +7,6 @@ import { forwardRef, memo } from 'react';
|
|
|
7
7
|
import { jsx } from '@emotion/core';
|
|
8
8
|
import noop from '@atlaskit/ds-lib/noop';
|
|
9
9
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
10
|
-
import { useBlurOnMouseDown } from '../internal/hooks/use-blur-on-mouse-down';
|
|
11
10
|
|
|
12
11
|
var preventEvent = function preventEvent(e) {
|
|
13
12
|
e.preventDefault();
|
|
@@ -43,7 +42,7 @@ function (props, ref) {
|
|
|
43
42
|
shouldDescriptionWrap = props.shouldDescriptionWrap,
|
|
44
43
|
rest = _objectWithoutProperties(props, _excluded);
|
|
45
44
|
|
|
46
|
-
var onMouseDownHandler =
|
|
45
|
+
var onMouseDownHandler = onMouseDown;
|
|
47
46
|
|
|
48
47
|
if (!children) {
|
|
49
48
|
return null;
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/menu",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "A collection of composable menu components that can be used anywhere.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
".": "./src/index.tsx"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@atlaskit/ds-lib": "^2.
|
|
39
|
+
"@atlaskit/ds-lib": "^2.1.0",
|
|
40
40
|
"@atlaskit/focus-ring": "^1.0.0",
|
|
41
41
|
"@atlaskit/theme": "^12.1.0",
|
|
42
42
|
"@atlaskit/tokens": "^0.10.0",
|
package/report.api.md
ADDED
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/menu"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
/// <reference types="react" />
|
|
7
|
+
|
|
8
|
+
import { ComponentType } from 'react';
|
|
9
|
+
import { CSSObject } from '@emotion/core';
|
|
10
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
11
|
+
import { MemoExoticComponent } from 'react';
|
|
12
|
+
import { ReactNode } from 'react';
|
|
13
|
+
import { Ref } from 'react';
|
|
14
|
+
import { RefAttributes } from 'react';
|
|
15
|
+
|
|
16
|
+
export declare interface BaseItemProps {
|
|
17
|
+
/**
|
|
18
|
+
A function that overrides the styles of the component.
|
|
19
|
+
It receives the current styles and state and expects a styles object.
|
|
20
|
+
|
|
21
|
+
@deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
22
|
+
*/
|
|
23
|
+
cssFn?: CSSFn;
|
|
24
|
+
/**
|
|
25
|
+
* Element to render before the item text.
|
|
26
|
+
* Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
|
|
27
|
+
*/
|
|
28
|
+
iconBefore?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Element to render after the item text.
|
|
31
|
+
* Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
|
|
32
|
+
*/
|
|
33
|
+
iconAfter?: React.ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Event that is triggered when the element is clicked.
|
|
36
|
+
*/
|
|
37
|
+
onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Event that is triggered when the element has been pressed.
|
|
40
|
+
*/
|
|
41
|
+
onMouseDown?: React.MouseEventHandler;
|
|
42
|
+
/**
|
|
43
|
+
* Description of the item.
|
|
44
|
+
* This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
|
|
45
|
+
*/
|
|
46
|
+
description?: string | JSX.Element;
|
|
47
|
+
/**
|
|
48
|
+
* Makes the element appear disabled as well as removing interactivity.
|
|
49
|
+
*/
|
|
50
|
+
isDisabled?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Makes the element appear selected.
|
|
53
|
+
*/
|
|
54
|
+
isSelected?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Primary content for the item.
|
|
57
|
+
*/
|
|
58
|
+
children?: React.ReactNode;
|
|
59
|
+
/**
|
|
60
|
+
* A `testId` prop is provided for specified elements,
|
|
61
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
62
|
+
* serving as a hook for automated tests.
|
|
63
|
+
*/
|
|
64
|
+
testId?: string;
|
|
65
|
+
/**
|
|
66
|
+
Custom overrides for the composed components.
|
|
67
|
+
|
|
68
|
+
@deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
69
|
+
*/
|
|
70
|
+
overrides?: Overrides;
|
|
71
|
+
/**
|
|
72
|
+
* When `true` the title of the item will wrap multiple lines if it's long enough.
|
|
73
|
+
*/
|
|
74
|
+
shouldTitleWrap?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* When `true` the description of the item will wrap multiple lines if it's long enough.
|
|
77
|
+
*/
|
|
78
|
+
shouldDescriptionWrap?: boolean;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* __Button item__
|
|
83
|
+
*
|
|
84
|
+
* A button item is used to populate a menu with items that are buttons.
|
|
85
|
+
*
|
|
86
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/button-item)
|
|
87
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
88
|
+
*/
|
|
89
|
+
export declare const ButtonItem: MemoExoticComponent<ForwardRefExoticComponent<
|
|
90
|
+
ButtonItemProps & RefAttributes<HTMLElement>
|
|
91
|
+
>>;
|
|
92
|
+
|
|
93
|
+
export declare interface ButtonItemProps extends BaseItemProps {
|
|
94
|
+
/**
|
|
95
|
+
* Unique identifier for the element.
|
|
96
|
+
*/
|
|
97
|
+
id?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Used to override the accessibility role for the element.
|
|
100
|
+
*/
|
|
101
|
+
role?: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
A function that overrides the styles of
|
|
106
|
+
menu components. It receives the current state
|
|
107
|
+
and should return a CSSObject.
|
|
108
|
+
|
|
109
|
+
@see @atlaskit/menu/docs/85-overriding-item-styles
|
|
110
|
+
@deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
111
|
+
*/
|
|
112
|
+
export declare interface CSSFn<
|
|
113
|
+
TState = ItemState extends void ? void : ItemState
|
|
114
|
+
> {
|
|
115
|
+
(currentState: TState): CSSObject | CSSObject[];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* __Custom item__
|
|
120
|
+
*
|
|
121
|
+
* A custom item is used to populate a menu with items that can be any element.
|
|
122
|
+
*
|
|
123
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/custom-item)
|
|
124
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
125
|
+
*/
|
|
126
|
+
export declare const CustomItem: CustomItemTypeGenericHackProps;
|
|
127
|
+
|
|
128
|
+
export declare interface CustomItemComponentProps {
|
|
129
|
+
/**
|
|
130
|
+
* The children of the item.
|
|
131
|
+
*/
|
|
132
|
+
children: React.ReactNode;
|
|
133
|
+
/**
|
|
134
|
+
* Class to apply to the root container of the custom component,
|
|
135
|
+
* ensure this has been applied so the consistent item styling is applied.
|
|
136
|
+
*/
|
|
137
|
+
className: string;
|
|
138
|
+
/**
|
|
139
|
+
* Test id that is passed through to the custom component.
|
|
140
|
+
*/
|
|
141
|
+
'data-testid'?: string;
|
|
142
|
+
/**
|
|
143
|
+
* Event handler that is passed through to the custom component.
|
|
144
|
+
*/
|
|
145
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
146
|
+
/**
|
|
147
|
+
* Event handler that is passed through to the custom component.
|
|
148
|
+
*/
|
|
149
|
+
onMouseDown?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
150
|
+
/**
|
|
151
|
+
* Event handler that is passed through to the custom component.
|
|
152
|
+
* Used to disable the element from being draggable.
|
|
153
|
+
*/
|
|
154
|
+
onDragStart?: (event: React.DragEvent) => void;
|
|
155
|
+
/**
|
|
156
|
+
* Turns off the element being draggable.
|
|
157
|
+
*/
|
|
158
|
+
draggable: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* React ref for the raw DOM element,
|
|
161
|
+
* make sure to place this on the outer most DOM element.
|
|
162
|
+
*/
|
|
163
|
+
ref?: Ref<any>;
|
|
164
|
+
/**
|
|
165
|
+
* Makes the element appear disabled as well as removing interactivity.
|
|
166
|
+
*/
|
|
167
|
+
tabIndex?: number;
|
|
168
|
+
/**
|
|
169
|
+
* Disabled attribute.
|
|
170
|
+
*/
|
|
171
|
+
disabled?: boolean;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export declare interface CustomItemProps<
|
|
175
|
+
TCustomComponentProps = CustomItemComponentProps
|
|
176
|
+
> extends BaseItemProps {
|
|
177
|
+
/**
|
|
178
|
+
Custom component to render as an item. This can be both a functional component or a class component.
|
|
179
|
+
|
|
180
|
+
__Will return `null` if no component is defined.__
|
|
181
|
+
|
|
182
|
+
Props passed to `CustomItem` will be passed down to this component. If the props for `component` have TypeScript types,
|
|
183
|
+
CustomItem will extend them, providing type safety for your custom item.
|
|
184
|
+
|
|
185
|
+
e.g. `<CustomItem to="/link" component={RouterLink} />`
|
|
186
|
+
|
|
187
|
+
__NOTE:__ Make sure the reference for this component does not change between renders else undefined behavior may happen.
|
|
188
|
+
*/
|
|
189
|
+
component?: React.ComponentType<TCustomComponentProps>;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
declare interface CustomItemTypeGenericHackProps {
|
|
193
|
+
<TComponentProps>(
|
|
194
|
+
props: CustomItemProps<TComponentProps> & {
|
|
195
|
+
ref?: any;
|
|
196
|
+
} & Omit<TComponentProps, keyof CustomItemComponentProps>,
|
|
197
|
+
): JSX.Element | null;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export declare type Dimension = string | number;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* __Heading item__
|
|
204
|
+
*
|
|
205
|
+
* A heading item is used to describe sibling menu items.
|
|
206
|
+
*
|
|
207
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/heading-item)
|
|
208
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
209
|
+
*/
|
|
210
|
+
export declare const HeadingItem: MemoExoticComponent<({
|
|
211
|
+
children,
|
|
212
|
+
testId,
|
|
213
|
+
id,
|
|
214
|
+
cssFn,
|
|
215
|
+
...rest
|
|
216
|
+
}: HeadingItemProps) => JSX.Element>;
|
|
217
|
+
|
|
218
|
+
export declare interface HeadingItemProps {
|
|
219
|
+
/**
|
|
220
|
+
A function that overrides the styles.
|
|
221
|
+
It receives the current styles and returns a customized styles object.
|
|
222
|
+
|
|
223
|
+
@deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
224
|
+
*/
|
|
225
|
+
cssFn?: StatelessCSSFn;
|
|
226
|
+
/**
|
|
227
|
+
* The text of the heading.
|
|
228
|
+
*/
|
|
229
|
+
children: React.ReactNode;
|
|
230
|
+
/**
|
|
231
|
+
* A unique identifier that can be referenced in the `labelledby` prop of a
|
|
232
|
+
* section to allow screen readers to announce the name of groups.
|
|
233
|
+
*/
|
|
234
|
+
id?: string;
|
|
235
|
+
/**
|
|
236
|
+
* A `testId` prop is provided for specified elements,
|
|
237
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
238
|
+
* serving as a hook for automated tests.
|
|
239
|
+
*/
|
|
240
|
+
testId?: string;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export declare type ItemState = {
|
|
244
|
+
isSelected: boolean;
|
|
245
|
+
isDisabled: boolean;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* __Link item__
|
|
250
|
+
*
|
|
251
|
+
* A link item is used to populate a menu with items that are links.
|
|
252
|
+
*
|
|
253
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/link-item)
|
|
254
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
255
|
+
*/
|
|
256
|
+
export declare const LinkItem: MemoExoticComponent<ForwardRefExoticComponent<
|
|
257
|
+
LinkItemProps & RefAttributes<HTMLElement>
|
|
258
|
+
>>;
|
|
259
|
+
|
|
260
|
+
export declare interface LinkItemProps extends BaseItemProps {
|
|
261
|
+
/**
|
|
262
|
+
* Link to another page.
|
|
263
|
+
*/
|
|
264
|
+
href?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Where to display the linked URL,
|
|
267
|
+
* see [anchor information](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) on mdn for more information.
|
|
268
|
+
*/
|
|
269
|
+
target?: string;
|
|
270
|
+
/**
|
|
271
|
+
* The relationship of the linked URL as space-separated link types.
|
|
272
|
+
* Generally you'll want to set this to "noopener noreferrer" when `target` is "_blank".
|
|
273
|
+
*/
|
|
274
|
+
rel?: string;
|
|
275
|
+
/**
|
|
276
|
+
* Used to override the accessibility role for the element.
|
|
277
|
+
*/
|
|
278
|
+
role?: string;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* __Menu group__
|
|
283
|
+
*
|
|
284
|
+
* A menu group includes all the actions or items in a menu.
|
|
285
|
+
*
|
|
286
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/menu-group)
|
|
287
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
288
|
+
*/
|
|
289
|
+
export declare const MenuGroup: ({
|
|
290
|
+
maxWidth,
|
|
291
|
+
minWidth,
|
|
292
|
+
minHeight,
|
|
293
|
+
maxHeight,
|
|
294
|
+
testId,
|
|
295
|
+
role,
|
|
296
|
+
...rest
|
|
297
|
+
}: MenuGroupProps) => JSX.Element;
|
|
298
|
+
|
|
299
|
+
export declare interface MenuGroupProps extends MenuGroupSizing {
|
|
300
|
+
/**
|
|
301
|
+
* Children of the menu group,
|
|
302
|
+
* should generally be `Section` components.
|
|
303
|
+
*/
|
|
304
|
+
children: React.ReactNode;
|
|
305
|
+
/**
|
|
306
|
+
* Used to override the accessibility role for the element.
|
|
307
|
+
*/
|
|
308
|
+
role?: string;
|
|
309
|
+
/**
|
|
310
|
+
* A `testId` prop is provided for specified elements,
|
|
311
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
312
|
+
* serving as a hook for automated tests.
|
|
313
|
+
*/
|
|
314
|
+
testId?: string;
|
|
315
|
+
/**
|
|
316
|
+
* Handler called when clicking on this element,
|
|
317
|
+
* or any children elements.
|
|
318
|
+
* Useful when needing to stop propagation of child events.
|
|
319
|
+
*/
|
|
320
|
+
onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export declare interface MenuGroupSizing {
|
|
324
|
+
/**
|
|
325
|
+
* Useful to constrain the menu group minimum height to a specific value.
|
|
326
|
+
*/
|
|
327
|
+
minHeight?: Dimension;
|
|
328
|
+
/**
|
|
329
|
+
* Useful to constrain the menu groups height to a specific value.
|
|
330
|
+
* Needs to be set when wanting to have scrollable sections.
|
|
331
|
+
*/
|
|
332
|
+
maxHeight?: Dimension;
|
|
333
|
+
/**
|
|
334
|
+
* Useful to constrain the menu group minimum width to a specific value.
|
|
335
|
+
*/
|
|
336
|
+
minWidth?: Dimension;
|
|
337
|
+
/**
|
|
338
|
+
* Useful to constrain the menu group width to a specific value.
|
|
339
|
+
*/
|
|
340
|
+
maxWidth?: Dimension;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
345
|
+
*/
|
|
346
|
+
export declare interface Overrides {
|
|
347
|
+
Title?: TitleOverrides;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* @deprecated
|
|
352
|
+
*/
|
|
353
|
+
export declare const PopupMenuGroup: ({
|
|
354
|
+
maxWidth,
|
|
355
|
+
minWidth,
|
|
356
|
+
...rest
|
|
357
|
+
}: MenuGroupProps) => JSX.Element;
|
|
358
|
+
|
|
359
|
+
export declare interface RenderFunction<TProps = {}> {
|
|
360
|
+
(Component: ComponentType | string, props: TProps): React.ReactNode;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* __Section__
|
|
365
|
+
*
|
|
366
|
+
* A section includes related actions or items in a menu.
|
|
367
|
+
*
|
|
368
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/section)
|
|
369
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
370
|
+
*/
|
|
371
|
+
export declare const Section: ForwardRefExoticComponent<
|
|
372
|
+
SectionProps & RefAttributes<HTMLElement>
|
|
373
|
+
>;
|
|
374
|
+
|
|
375
|
+
declare interface SectionProps {
|
|
376
|
+
/**
|
|
377
|
+
* Unique identifier for the element.
|
|
378
|
+
*/
|
|
379
|
+
id?: string;
|
|
380
|
+
/**
|
|
381
|
+
* Enables scrolling within the section.
|
|
382
|
+
* Make sure to set `maxHeight` on the parent `MenuGroup` component else it will not work.
|
|
383
|
+
*/
|
|
384
|
+
isScrollable?: boolean;
|
|
385
|
+
/**
|
|
386
|
+
* Will render a border at the top of the section.
|
|
387
|
+
*/
|
|
388
|
+
hasSeparator?: boolean;
|
|
389
|
+
/**
|
|
390
|
+
* Children of the section,
|
|
391
|
+
* should generally be `Item` or `Heading` components,
|
|
392
|
+
* but can also be [`EmptyState`](https://atlaskit.atlassian.com/packages/design-system/empty-state)s when wanting to render errors.
|
|
393
|
+
*/
|
|
394
|
+
children: React.ReactNode;
|
|
395
|
+
/**
|
|
396
|
+
* A `testId` prop is provided for specified elements,
|
|
397
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
398
|
+
* serving as a hook for automated tests.
|
|
399
|
+
*/
|
|
400
|
+
testId?: string;
|
|
401
|
+
/**
|
|
402
|
+
* @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
403
|
+
*/
|
|
404
|
+
overrides?: {
|
|
405
|
+
HeadingItem?: {
|
|
406
|
+
/**
|
|
407
|
+
* A function that overrides the styles of the component.
|
|
408
|
+
* It receives the current styles and state and expects a styles object.
|
|
409
|
+
*/
|
|
410
|
+
cssFn?: StatelessCSSFn;
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* The text passed into the internal HeadingItem. If a title is not provided,
|
|
415
|
+
* the HeadingItem will not be rendered, and this component acts as a regular Section
|
|
416
|
+
*/
|
|
417
|
+
title?: string;
|
|
418
|
+
}
|
|
419
|
+
export { SectionProps as SectionBaseProps };
|
|
420
|
+
export { SectionProps };
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* __Skeleton heading item__
|
|
424
|
+
*
|
|
425
|
+
* A skeleton heading item is used in place of a heading item when its contents it not ready.
|
|
426
|
+
*
|
|
427
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/skeleton-heading-item)
|
|
428
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
429
|
+
*/
|
|
430
|
+
export declare const SkeletonHeadingItem: ({
|
|
431
|
+
isShimmering,
|
|
432
|
+
testId,
|
|
433
|
+
width,
|
|
434
|
+
cssFn,
|
|
435
|
+
}: SkeletonHeadingItemProps) => JSX.Element;
|
|
436
|
+
|
|
437
|
+
export declare interface SkeletonHeadingItemProps {
|
|
438
|
+
/**
|
|
439
|
+
*
|
|
440
|
+
* Width of the skeleton heading item.
|
|
441
|
+
* Generally you don't need to specify this as it has a staggered width based on `:nth-child` by default.
|
|
442
|
+
*/
|
|
443
|
+
width?: Dimension;
|
|
444
|
+
/**
|
|
445
|
+
* A `testId` prop is provided for specified elements,
|
|
446
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
447
|
+
* serving as a hook for automated tests.
|
|
448
|
+
*/
|
|
449
|
+
testId?: string;
|
|
450
|
+
/**
|
|
451
|
+
* Causes to the skeleton to have a slight horizontal shimmer.
|
|
452
|
+
* Only use this when you want to bring more attention to the loading content.
|
|
453
|
+
*/
|
|
454
|
+
isShimmering?: boolean;
|
|
455
|
+
/**
|
|
456
|
+
A function that overrides the styles of this component.
|
|
457
|
+
It receives the current styles and returns a customized styles object.
|
|
458
|
+
|
|
459
|
+
@deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
460
|
+
*/
|
|
461
|
+
cssFn?: StatelessCSSFn;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* __Skeleton item__
|
|
466
|
+
*
|
|
467
|
+
* A skeleton item is used in place of an item when its contents it not ready.
|
|
468
|
+
*
|
|
469
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/skeleton-item)
|
|
470
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
471
|
+
*/
|
|
472
|
+
export declare const SkeletonItem: ({
|
|
473
|
+
hasAvatar,
|
|
474
|
+
hasIcon,
|
|
475
|
+
isShimmering,
|
|
476
|
+
testId,
|
|
477
|
+
width,
|
|
478
|
+
cssFn,
|
|
479
|
+
}: SkeletonItemProps) => JSX.Element;
|
|
480
|
+
|
|
481
|
+
export declare interface SkeletonItemProps {
|
|
482
|
+
/**
|
|
483
|
+
* Renders a skeleton circle in the `iconBefore` location.
|
|
484
|
+
* Takes priority over `hasIcon.
|
|
485
|
+
*/
|
|
486
|
+
hasAvatar?: boolean;
|
|
487
|
+
/**
|
|
488
|
+
* Renders a skeleton square in the `iconBefore` location.
|
|
489
|
+
*/
|
|
490
|
+
hasIcon?: boolean;
|
|
491
|
+
/**
|
|
492
|
+
*
|
|
493
|
+
* Width of the skeleton item.
|
|
494
|
+
* Generally you don't need to specify this as it has a staggered width based on `:nth-child` by default.
|
|
495
|
+
*/
|
|
496
|
+
width?: Dimension;
|
|
497
|
+
/**
|
|
498
|
+
* A `testId` prop is provided for specified elements,
|
|
499
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
500
|
+
* serving as a hook for automated tests.
|
|
501
|
+
*/
|
|
502
|
+
testId?: string;
|
|
503
|
+
/**
|
|
504
|
+
* Causes to the skeleton to have a slight horizontal shimmer.
|
|
505
|
+
* Only use this when you want to bring more attention to the loading content.
|
|
506
|
+
*/
|
|
507
|
+
isShimmering?: boolean;
|
|
508
|
+
/**
|
|
509
|
+
* A function that overrides the styles of this component.
|
|
510
|
+
* It receives the current styles and returns a customized styles object.
|
|
511
|
+
*/
|
|
512
|
+
cssFn?: StatelessCSSFn;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
517
|
+
*/
|
|
518
|
+
export declare type StatelessCSSFn = CSSFn<void>;
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
522
|
+
*/
|
|
523
|
+
export declare interface TitleOverrides {
|
|
524
|
+
render?: RenderFunction<{
|
|
525
|
+
className?: string;
|
|
526
|
+
children: ReactNode;
|
|
527
|
+
'data-item-title': boolean;
|
|
528
|
+
}>;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export {};
|
|
532
|
+
```
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useBlurOnMouseDown = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
|
-
var useBlurOnMouseDown = function useBlurOnMouseDown(userLandCallback) {
|
|
11
|
-
var callback = (0, _react.useCallback)(function (e) {
|
|
12
|
-
var currentTarget = e.currentTarget;
|
|
13
|
-
var focusedDuringMouseDown = currentTarget === document.activeElement;
|
|
14
|
-
userLandCallback && userLandCallback(e);
|
|
15
|
-
requestAnimationFrame(function () {
|
|
16
|
-
if (focusedDuringMouseDown && currentTarget !== document.activeElement && document.body.contains(currentTarget)) {
|
|
17
|
-
currentTarget.focus();
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (!focusedDuringMouseDown && document.activeElement && document.activeElement instanceof HTMLElement) {
|
|
22
|
-
document.activeElement.blur();
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}, [userLandCallback]);
|
|
26
|
-
return callback;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
exports.useBlurOnMouseDown = useBlurOnMouseDown;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
export const useBlurOnMouseDown = userLandCallback => {
|
|
3
|
-
const callback = useCallback(e => {
|
|
4
|
-
const currentTarget = e.currentTarget;
|
|
5
|
-
const focusedDuringMouseDown = currentTarget === document.activeElement;
|
|
6
|
-
userLandCallback && userLandCallback(e);
|
|
7
|
-
requestAnimationFrame(() => {
|
|
8
|
-
if (focusedDuringMouseDown && currentTarget !== document.activeElement && document.body.contains(currentTarget)) {
|
|
9
|
-
currentTarget.focus();
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (!focusedDuringMouseDown && document.activeElement && document.activeElement instanceof HTMLElement) {
|
|
14
|
-
document.activeElement.blur();
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}, [userLandCallback]);
|
|
18
|
-
return callback;
|
|
19
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
export var useBlurOnMouseDown = function useBlurOnMouseDown(userLandCallback) {
|
|
3
|
-
var callback = useCallback(function (e) {
|
|
4
|
-
var currentTarget = e.currentTarget;
|
|
5
|
-
var focusedDuringMouseDown = currentTarget === document.activeElement;
|
|
6
|
-
userLandCallback && userLandCallback(e);
|
|
7
|
-
requestAnimationFrame(function () {
|
|
8
|
-
if (focusedDuringMouseDown && currentTarget !== document.activeElement && document.body.contains(currentTarget)) {
|
|
9
|
-
currentTarget.focus();
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (!focusedDuringMouseDown && document.activeElement && document.activeElement instanceof HTMLElement) {
|
|
14
|
-
document.activeElement.blur();
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}, [userLandCallback]);
|
|
18
|
-
return callback;
|
|
19
|
-
};
|