@atlaskit/popup 1.8.3 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/popper-wrapper.js +1 -2
- package/dist/cjs/use-focus-manager.js +11 -27
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/popper-wrapper.js +1 -2
- package/dist/es2019/use-focus-manager.js +11 -27
- package/dist/es2019/version.json +1 -1
- package/dist/esm/popper-wrapper.js +1 -2
- package/dist/esm/use-focus-manager.js +11 -27
- package/dist/esm/version.json +1 -1
- package/dist/types/types.d.ts +2 -2
- package/dist/types/use-focus-manager.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +2 -2
- package/dist/types-ts4.5/use-focus-manager.d.ts +1 -1
- package/package.json +5 -10
- package/tmp/api-report-tmp.d.ts +81 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/popup
|
|
2
2
|
|
|
3
|
+
## 1.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6a0a3c059ba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6a0a3c059ba) - Remove unused argument from internal focus management function.
|
|
8
|
+
|
|
9
|
+
## 1.9.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`3920dcfd848`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3920dcfd848) - This removes the feature flag made for upgrading the `focus-trap` dependency and keeps `focus-trap` at it's original version.
|
|
14
|
+
|
|
3
15
|
## 1.8.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -66,8 +66,7 @@ function PopperWrapper(_ref) {
|
|
|
66
66
|
setInitialFocusRef = _useState4[1];
|
|
67
67
|
(0, _useFocusManager.useFocusManager)({
|
|
68
68
|
initialFocusRef: initialFocusRef,
|
|
69
|
-
popupRef: popupRef
|
|
70
|
-
autoFocus: autoFocus
|
|
69
|
+
popupRef: popupRef
|
|
71
70
|
});
|
|
72
71
|
(0, _useCloseManager.useCloseManager)({
|
|
73
72
|
isOpen: isOpen,
|
|
@@ -6,39 +6,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useFocusManager = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var _focusTrap = require("focus-trap");
|
|
10
|
-
var _focusTrapV = _interopRequireDefault(require("focus-trap-v2"));
|
|
9
|
+
var _focusTrap = _interopRequireDefault(require("focus-trap"));
|
|
11
10
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
11
|
var useFocusManager = function useFocusManager(_ref) {
|
|
14
12
|
var popupRef = _ref.popupRef,
|
|
15
|
-
initialFocusRef = _ref.initialFocusRef
|
|
16
|
-
autoFocus = _ref.autoFocus;
|
|
13
|
+
initialFocusRef = _ref.initialFocusRef;
|
|
17
14
|
(0, _react.useEffect)(function () {
|
|
18
15
|
if (!popupRef) {
|
|
19
16
|
return _noop.default;
|
|
20
17
|
}
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
returnFocusOnDeactivate: true
|
|
30
|
-
};
|
|
31
|
-
focusTrap = (0, _focusTrap.createFocusTrap)(popupRef, trapConfig);
|
|
32
|
-
} else {
|
|
33
|
-
var _trapConfig = {
|
|
34
|
-
clickOutsideDeactivates: true,
|
|
35
|
-
escapeDeactivates: true,
|
|
36
|
-
initialFocus: initialFocusRef || popupRef,
|
|
37
|
-
fallbackFocus: popupRef,
|
|
38
|
-
returnFocusOnDeactivate: true
|
|
39
|
-
};
|
|
40
|
-
focusTrap = (0, _focusTrapV.default)(popupRef, _trapConfig);
|
|
41
|
-
}
|
|
18
|
+
var trapConfig = {
|
|
19
|
+
clickOutsideDeactivates: true,
|
|
20
|
+
escapeDeactivates: true,
|
|
21
|
+
initialFocus: initialFocusRef || popupRef,
|
|
22
|
+
fallbackFocus: popupRef,
|
|
23
|
+
returnFocusOnDeactivate: true
|
|
24
|
+
};
|
|
25
|
+
var focusTrap = (0, _focusTrap.default)(popupRef, trapConfig);
|
|
42
26
|
|
|
43
27
|
// wait for the popup to reposition itself before we focus
|
|
44
28
|
var frameId = requestAnimationFrame(function () {
|
|
@@ -52,6 +36,6 @@ var useFocusManager = function useFocusManager(_ref) {
|
|
|
52
36
|
}
|
|
53
37
|
focusTrap.deactivate();
|
|
54
38
|
};
|
|
55
|
-
}, [popupRef, initialFocusRef
|
|
39
|
+
}, [popupRef, initialFocusRef]);
|
|
56
40
|
};
|
|
57
41
|
exports.useFocusManager = useFocusManager;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,38 +1,22 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import createFocusTrapV2 from 'focus-trap-v2';
|
|
2
|
+
import createFocusTrap from 'focus-trap';
|
|
4
3
|
import noop from '@atlaskit/ds-lib/noop';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
4
|
export const useFocusManager = ({
|
|
7
5
|
popupRef,
|
|
8
|
-
initialFocusRef
|
|
9
|
-
autoFocus
|
|
6
|
+
initialFocusRef
|
|
10
7
|
}) => {
|
|
11
8
|
useEffect(() => {
|
|
12
9
|
if (!popupRef) {
|
|
13
10
|
return noop;
|
|
14
11
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
returnFocusOnDeactivate: true
|
|
24
|
-
};
|
|
25
|
-
focusTrap = createFocusTrap(popupRef, trapConfig);
|
|
26
|
-
} else {
|
|
27
|
-
const trapConfig = {
|
|
28
|
-
clickOutsideDeactivates: true,
|
|
29
|
-
escapeDeactivates: true,
|
|
30
|
-
initialFocus: initialFocusRef || popupRef,
|
|
31
|
-
fallbackFocus: popupRef,
|
|
32
|
-
returnFocusOnDeactivate: true
|
|
33
|
-
};
|
|
34
|
-
focusTrap = createFocusTrapV2(popupRef, trapConfig);
|
|
35
|
-
}
|
|
12
|
+
const trapConfig = {
|
|
13
|
+
clickOutsideDeactivates: true,
|
|
14
|
+
escapeDeactivates: true,
|
|
15
|
+
initialFocus: initialFocusRef || popupRef,
|
|
16
|
+
fallbackFocus: popupRef,
|
|
17
|
+
returnFocusOnDeactivate: true
|
|
18
|
+
};
|
|
19
|
+
const focusTrap = createFocusTrap(popupRef, trapConfig);
|
|
36
20
|
|
|
37
21
|
// wait for the popup to reposition itself before we focus
|
|
38
22
|
let frameId = requestAnimationFrame(() => {
|
|
@@ -46,5 +30,5 @@ export const useFocusManager = ({
|
|
|
46
30
|
}
|
|
47
31
|
focusTrap.deactivate();
|
|
48
32
|
};
|
|
49
|
-
}, [popupRef, initialFocusRef
|
|
33
|
+
}, [popupRef, initialFocusRef]);
|
|
50
34
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,37 +1,21 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import createFocusTrapV2 from 'focus-trap-v2';
|
|
2
|
+
import createFocusTrap from 'focus-trap';
|
|
4
3
|
import noop from '@atlaskit/ds-lib/noop';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
4
|
export var useFocusManager = function useFocusManager(_ref) {
|
|
7
5
|
var popupRef = _ref.popupRef,
|
|
8
|
-
initialFocusRef = _ref.initialFocusRef
|
|
9
|
-
autoFocus = _ref.autoFocus;
|
|
6
|
+
initialFocusRef = _ref.initialFocusRef;
|
|
10
7
|
useEffect(function () {
|
|
11
8
|
if (!popupRef) {
|
|
12
9
|
return noop;
|
|
13
10
|
}
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
returnFocusOnDeactivate: true
|
|
23
|
-
};
|
|
24
|
-
focusTrap = createFocusTrap(popupRef, trapConfig);
|
|
25
|
-
} else {
|
|
26
|
-
var _trapConfig = {
|
|
27
|
-
clickOutsideDeactivates: true,
|
|
28
|
-
escapeDeactivates: true,
|
|
29
|
-
initialFocus: initialFocusRef || popupRef,
|
|
30
|
-
fallbackFocus: popupRef,
|
|
31
|
-
returnFocusOnDeactivate: true
|
|
32
|
-
};
|
|
33
|
-
focusTrap = createFocusTrapV2(popupRef, _trapConfig);
|
|
34
|
-
}
|
|
11
|
+
var trapConfig = {
|
|
12
|
+
clickOutsideDeactivates: true,
|
|
13
|
+
escapeDeactivates: true,
|
|
14
|
+
initialFocus: initialFocusRef || popupRef,
|
|
15
|
+
fallbackFocus: popupRef,
|
|
16
|
+
returnFocusOnDeactivate: true
|
|
17
|
+
};
|
|
18
|
+
var focusTrap = createFocusTrap(popupRef, trapConfig);
|
|
35
19
|
|
|
36
20
|
// wait for the popup to reposition itself before we focus
|
|
37
21
|
var frameId = requestAnimationFrame(function () {
|
|
@@ -45,5 +29,5 @@ export var useFocusManager = function useFocusManager(_ref) {
|
|
|
45
29
|
}
|
|
46
30
|
focusTrap.deactivate();
|
|
47
31
|
};
|
|
48
|
-
}, [popupRef, initialFocusRef
|
|
32
|
+
}, [popupRef, initialFocusRef]);
|
|
49
33
|
};
|
package/dist/esm/version.json
CHANGED
package/dist/types/types.d.ts
CHANGED
|
@@ -85,7 +85,8 @@ interface BaseProps {
|
|
|
85
85
|
/**
|
|
86
86
|
* Defines a list of placements to try.
|
|
87
87
|
* When no space is available on the preferred placement,
|
|
88
|
-
* the modifier will test the ones provided in the list, and use the first
|
|
88
|
+
* the modifier will test the ones provided in the list, and use the first suitable one.
|
|
89
|
+
* If no fallback placements are suitable, it reverts back to the original placement.
|
|
89
90
|
*/
|
|
90
91
|
fallbackPlacements?: Placement[];
|
|
91
92
|
/**
|
|
@@ -164,7 +165,6 @@ export type CloseManagerHook = Pick<PopupProps, 'isOpen' | 'onClose'> & {
|
|
|
164
165
|
export type FocusManagerHook = {
|
|
165
166
|
popupRef: PopupRef;
|
|
166
167
|
initialFocusRef: HTMLElement | null;
|
|
167
|
-
autoFocus: boolean;
|
|
168
168
|
};
|
|
169
169
|
export type RepositionOnUpdateProps = {
|
|
170
170
|
update: PopperChildrenProps['update'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FocusManagerHook } from './types';
|
|
2
|
-
export declare const useFocusManager: ({ popupRef, initialFocusRef,
|
|
2
|
+
export declare const useFocusManager: ({ popupRef, initialFocusRef, }: FocusManagerHook) => void;
|
|
@@ -88,7 +88,8 @@ interface BaseProps {
|
|
|
88
88
|
/**
|
|
89
89
|
* Defines a list of placements to try.
|
|
90
90
|
* When no space is available on the preferred placement,
|
|
91
|
-
* the modifier will test the ones provided in the list, and use the first
|
|
91
|
+
* the modifier will test the ones provided in the list, and use the first suitable one.
|
|
92
|
+
* If no fallback placements are suitable, it reverts back to the original placement.
|
|
92
93
|
*/
|
|
93
94
|
fallbackPlacements?: Placement[];
|
|
94
95
|
/**
|
|
@@ -167,7 +168,6 @@ export type CloseManagerHook = Pick<PopupProps, 'isOpen' | 'onClose'> & {
|
|
|
167
168
|
export type FocusManagerHook = {
|
|
168
169
|
popupRef: PopupRef;
|
|
169
170
|
initialFocusRef: HTMLElement | null;
|
|
170
|
-
autoFocus: boolean;
|
|
171
171
|
};
|
|
172
172
|
export type RepositionOnUpdateProps = {
|
|
173
173
|
update: PopperChildrenProps['update'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FocusManagerHook } from './types';
|
|
2
|
-
export declare const useFocusManager: ({ popupRef, initialFocusRef,
|
|
2
|
+
export declare const useFocusManager: ({ popupRef, initialFocusRef, }: FocusManagerHook) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/popup",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "A popup displays brief content in an overlay.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -40,12 +40,11 @@
|
|
|
40
40
|
"@atlaskit/popper": "^5.5.0",
|
|
41
41
|
"@atlaskit/portal": "^4.3.0",
|
|
42
42
|
"@atlaskit/theme": "^12.5.0",
|
|
43
|
-
"@atlaskit/tokens": "^1.
|
|
43
|
+
"@atlaskit/tokens": "^1.13.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@emotion/react": "^11.7.1",
|
|
46
46
|
"bind-event-listener": "^2.1.1",
|
|
47
|
-
"focus-trap": "^
|
|
48
|
-
"focus-trap-v2": "npm:focus-trap@^2.4.5"
|
|
47
|
+
"focus-trap": "^2.4.5"
|
|
49
48
|
},
|
|
50
49
|
"peerDependencies": {
|
|
51
50
|
"react": "^16.8.0",
|
|
@@ -57,7 +56,6 @@
|
|
|
57
56
|
"@atlaskit/icon": "^21.12.0",
|
|
58
57
|
"@atlaskit/ssr": "*",
|
|
59
58
|
"@atlaskit/visual-regression": "*",
|
|
60
|
-
"@atlaskit/webdriver-runner": "*",
|
|
61
59
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
62
60
|
"@atlassian/feature-flags-test-utils": "*",
|
|
63
61
|
"@testing-library/dom": "^8.17.1",
|
|
@@ -96,13 +94,10 @@
|
|
|
96
94
|
}
|
|
97
95
|
},
|
|
98
96
|
"homepage": "https://atlassian.design/components/popup/",
|
|
97
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
|
|
99
98
|
"platform-feature-flags": {
|
|
100
99
|
"platform.design-system-team.render-popup-in-parent_f73ij": {
|
|
101
100
|
"type": "boolean"
|
|
102
|
-
},
|
|
103
|
-
"platform.design-system-team.focus-trap-upgrade_p2cei": {
|
|
104
|
-
"type": "boolean"
|
|
105
101
|
}
|
|
106
|
-
}
|
|
107
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
102
|
+
}
|
|
108
103
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/popup"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { ComponentType } from 'react';
|
|
8
|
+
import { CSSProperties } from 'react';
|
|
9
|
+
import { Dispatch } from 'react';
|
|
10
|
+
import { FC } from 'react';
|
|
11
|
+
import { Placement } from '@atlaskit/popper';
|
|
12
|
+
import { PopperChildrenProps } from '@atlaskit/popper';
|
|
13
|
+
import { default as React_2 } from 'react';
|
|
14
|
+
import { ReactNode } from 'react';
|
|
15
|
+
import { Ref } from 'react';
|
|
16
|
+
import { SetStateAction } from 'react';
|
|
17
|
+
|
|
18
|
+
// @public (undocumented)
|
|
19
|
+
interface BaseProps {
|
|
20
|
+
autoFocus?: boolean;
|
|
21
|
+
boundary?: 'clippingParents' | HTMLElement;
|
|
22
|
+
content: (props: ContentProps) => React_2.ReactNode;
|
|
23
|
+
fallbackPlacements?: Placement[];
|
|
24
|
+
id?: string;
|
|
25
|
+
isOpen: boolean;
|
|
26
|
+
offset?: [number, number];
|
|
27
|
+
onClose?(event: Event | React_2.KeyboardEvent | React_2.MouseEvent): void;
|
|
28
|
+
placement?: Placement;
|
|
29
|
+
popupComponent?: ComponentType<PopupComponentProps>;
|
|
30
|
+
rootBoundary?: 'document' | 'viewport';
|
|
31
|
+
shouldFlip?: boolean;
|
|
32
|
+
shouldUseCaptureOnOutsideClick?: boolean;
|
|
33
|
+
testId?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// @public (undocumented)
|
|
37
|
+
export interface ContentProps {
|
|
38
|
+
isOpen: boolean;
|
|
39
|
+
onClose?: BaseProps['onClose'];
|
|
40
|
+
setInitialFocusRef: Dispatch<SetStateAction<HTMLElement | null>>;
|
|
41
|
+
update: PopperChildrenProps['update'];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// @public (undocumented)
|
|
45
|
+
const Popup: FC<PopupProps>;
|
|
46
|
+
export { Popup }
|
|
47
|
+
export default Popup;
|
|
48
|
+
|
|
49
|
+
// @public (undocumented)
|
|
50
|
+
export interface PopupComponentProps {
|
|
51
|
+
'data-placement': Placement;
|
|
52
|
+
'data-testid'?: string;
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
id?: string;
|
|
55
|
+
ref: Ref<HTMLDivElement>;
|
|
56
|
+
style: CSSProperties;
|
|
57
|
+
tabIndex: number | undefined;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// @public (undocumented)
|
|
61
|
+
export interface PopupProps extends BaseProps {
|
|
62
|
+
shouldRenderToParent?: boolean;
|
|
63
|
+
trigger: (props: TriggerProps) => React_2.ReactNode;
|
|
64
|
+
zIndex?: number;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// @public (undocumented)
|
|
68
|
+
export interface TriggerProps {
|
|
69
|
+
// (undocumented)
|
|
70
|
+
'aria-controls'?: string;
|
|
71
|
+
// (undocumented)
|
|
72
|
+
'aria-expanded': boolean;
|
|
73
|
+
// (undocumented)
|
|
74
|
+
'aria-haspopup': boolean;
|
|
75
|
+
// (undocumented)
|
|
76
|
+
ref: Ref<any>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// (No @packageDocumentation comment for this package)
|
|
80
|
+
|
|
81
|
+
```
|