@atlaskit/popup 1.8.3 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/use-focus-manager.js +9 -24
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/use-focus-manager.js +9 -24
- package/dist/es2019/version.json +1 -1
- package/dist/esm/use-focus-manager.js +9 -24
- package/dist/esm/version.json +1 -1
- package/package.json +5 -10
- package/tmp/api-report-tmp.d.ts +81 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/popup
|
|
2
2
|
|
|
3
|
+
## 1.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`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.
|
|
8
|
+
|
|
3
9
|
## 1.8.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -6,10 +6,8 @@ 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
13
|
initialFocusRef = _ref.initialFocusRef,
|
|
@@ -18,27 +16,14 @@ var useFocusManager = function useFocusManager(_ref) {
|
|
|
18
16
|
if (!popupRef) {
|
|
19
17
|
return _noop.default;
|
|
20
18
|
}
|
|
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
|
-
}
|
|
19
|
+
var trapConfig = {
|
|
20
|
+
clickOutsideDeactivates: true,
|
|
21
|
+
escapeDeactivates: true,
|
|
22
|
+
initialFocus: initialFocusRef || popupRef,
|
|
23
|
+
fallbackFocus: popupRef,
|
|
24
|
+
returnFocusOnDeactivate: true
|
|
25
|
+
};
|
|
26
|
+
var focusTrap = (0, _focusTrap.default)(popupRef, trapConfig);
|
|
42
27
|
|
|
43
28
|
// wait for the popup to reposition itself before we focus
|
|
44
29
|
var frameId = requestAnimationFrame(function () {
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
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
6
|
initialFocusRef,
|
|
@@ -12,27 +10,14 @@ export const useFocusManager = ({
|
|
|
12
10
|
if (!popupRef) {
|
|
13
11
|
return noop;
|
|
14
12
|
}
|
|
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
|
-
}
|
|
13
|
+
const trapConfig = {
|
|
14
|
+
clickOutsideDeactivates: true,
|
|
15
|
+
escapeDeactivates: true,
|
|
16
|
+
initialFocus: initialFocusRef || popupRef,
|
|
17
|
+
fallbackFocus: popupRef,
|
|
18
|
+
returnFocusOnDeactivate: true
|
|
19
|
+
};
|
|
20
|
+
const focusTrap = createFocusTrap(popupRef, trapConfig);
|
|
36
21
|
|
|
37
22
|
// wait for the popup to reposition itself before we focus
|
|
38
23
|
let frameId = requestAnimationFrame(() => {
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
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
6
|
initialFocusRef = _ref.initialFocusRef,
|
|
@@ -11,27 +9,14 @@ export var useFocusManager = function useFocusManager(_ref) {
|
|
|
11
9
|
if (!popupRef) {
|
|
12
10
|
return noop;
|
|
13
11
|
}
|
|
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
|
-
}
|
|
12
|
+
var trapConfig = {
|
|
13
|
+
clickOutsideDeactivates: true,
|
|
14
|
+
escapeDeactivates: true,
|
|
15
|
+
initialFocus: initialFocusRef || popupRef,
|
|
16
|
+
fallbackFocus: popupRef,
|
|
17
|
+
returnFocusOnDeactivate: true
|
|
18
|
+
};
|
|
19
|
+
var focusTrap = createFocusTrap(popupRef, trapConfig);
|
|
35
20
|
|
|
36
21
|
// wait for the popup to reposition itself before we focus
|
|
37
22
|
var frameId = requestAnimationFrame(function () {
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/popup",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
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
|
+
```
|