@atlaskit/popup 1.11.2 → 1.11.4
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/use-focus-manager.js +10 -31
- package/dist/es2019/use-focus-manager.js +10 -31
- package/dist/esm/use-focus-manager.js +10 -31
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/popup
|
|
2
2
|
|
|
3
|
+
## 1.11.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#42577](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42577) [`d51b45b02fb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d51b45b02fb) - Add component to push model consumption in JFE
|
|
8
|
+
|
|
9
|
+
## 1.11.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#42594](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42594) [`07781d6d786`](https://bitbucket.org/atlassian/atlassian-frontend/commits/07781d6d786) - Removes feature flag implemented in 1.11.0. Does not implement proposed functionality behind the feature flag.
|
|
14
|
+
|
|
3
15
|
## 1.11.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -8,7 +8,6 @@ exports.useFocusManager = void 0;
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _focusTrap = _interopRequireDefault(require("focus-trap"));
|
|
10
10
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var useFocusManager = exports.useFocusManager = function useFocusManager(_ref) {
|
|
13
12
|
var initialFocusRef = _ref.initialFocusRef,
|
|
14
13
|
popupRef = _ref.popupRef;
|
|
@@ -16,47 +15,27 @@ var useFocusManager = exports.useFocusManager = function useFocusManager(_ref) {
|
|
|
16
15
|
if (!popupRef) {
|
|
17
16
|
return _noop.default;
|
|
18
17
|
}
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
initialFocus: initialFocusRef || popupRef,
|
|
28
|
-
fallbackFocus: popupRef,
|
|
29
|
-
returnFocusOnDeactivate: true
|
|
30
|
-
};
|
|
31
|
-
focusTrap = (0, _focusTrap.default)(popupRef, trapConfig);
|
|
32
|
-
}
|
|
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);
|
|
33
26
|
var frameId = null;
|
|
34
27
|
|
|
35
28
|
// wait for the popup to reposition itself before we focus
|
|
36
29
|
frameId = requestAnimationFrame(function () {
|
|
37
30
|
frameId = null;
|
|
38
|
-
|
|
39
|
-
if (initialFocusRef && initialFocusRef.focus) {
|
|
40
|
-
initialFocusRef.focus();
|
|
41
|
-
} else {
|
|
42
|
-
popupRef.focus();
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
focusTrap.activate();
|
|
46
|
-
}
|
|
31
|
+
focusTrap.activate();
|
|
47
32
|
});
|
|
48
33
|
return function () {
|
|
49
34
|
if (frameId != null) {
|
|
50
35
|
cancelAnimationFrame(frameId);
|
|
51
36
|
frameId = null;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
|
-
if (previouslyFocusedElement && previouslyFocusedElement.focus) {
|
|
55
|
-
previouslyFocusedElement.focus();
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
focusTrap.deactivate();
|
|
59
|
-
}
|
|
38
|
+
focusTrap.deactivate();
|
|
60
39
|
};
|
|
61
40
|
}, [popupRef, initialFocusRef]);
|
|
62
41
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import createFocusTrap from 'focus-trap';
|
|
3
3
|
import noop from '@atlaskit/ds-lib/noop';
|
|
4
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
export const useFocusManager = ({
|
|
6
5
|
initialFocusRef,
|
|
7
6
|
popupRef
|
|
@@ -10,47 +9,27 @@ export const useFocusManager = ({
|
|
|
10
9
|
if (!popupRef) {
|
|
11
10
|
return noop;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
initialFocus: initialFocusRef || popupRef,
|
|
22
|
-
fallbackFocus: popupRef,
|
|
23
|
-
returnFocusOnDeactivate: true
|
|
24
|
-
};
|
|
25
|
-
focusTrap = createFocusTrap(popupRef, trapConfig);
|
|
26
|
-
}
|
|
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);
|
|
27
20
|
let frameId = null;
|
|
28
21
|
|
|
29
22
|
// wait for the popup to reposition itself before we focus
|
|
30
23
|
frameId = requestAnimationFrame(() => {
|
|
31
24
|
frameId = null;
|
|
32
|
-
|
|
33
|
-
if (initialFocusRef && initialFocusRef.focus) {
|
|
34
|
-
initialFocusRef.focus();
|
|
35
|
-
} else {
|
|
36
|
-
popupRef.focus();
|
|
37
|
-
}
|
|
38
|
-
} else {
|
|
39
|
-
focusTrap.activate();
|
|
40
|
-
}
|
|
25
|
+
focusTrap.activate();
|
|
41
26
|
});
|
|
42
27
|
return () => {
|
|
43
28
|
if (frameId != null) {
|
|
44
29
|
cancelAnimationFrame(frameId);
|
|
45
30
|
frameId = null;
|
|
46
31
|
}
|
|
47
|
-
|
|
48
|
-
if (previouslyFocusedElement && previouslyFocusedElement.focus) {
|
|
49
|
-
previouslyFocusedElement.focus();
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
focusTrap.deactivate();
|
|
53
|
-
}
|
|
32
|
+
focusTrap.deactivate();
|
|
54
33
|
};
|
|
55
34
|
}, [popupRef, initialFocusRef]);
|
|
56
35
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import createFocusTrap from 'focus-trap';
|
|
3
3
|
import noop from '@atlaskit/ds-lib/noop';
|
|
4
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
export var useFocusManager = function useFocusManager(_ref) {
|
|
6
5
|
var initialFocusRef = _ref.initialFocusRef,
|
|
7
6
|
popupRef = _ref.popupRef;
|
|
@@ -9,47 +8,27 @@ export var useFocusManager = function useFocusManager(_ref) {
|
|
|
9
8
|
if (!popupRef) {
|
|
10
9
|
return noop;
|
|
11
10
|
}
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
initialFocus: initialFocusRef || popupRef,
|
|
21
|
-
fallbackFocus: popupRef,
|
|
22
|
-
returnFocusOnDeactivate: true
|
|
23
|
-
};
|
|
24
|
-
focusTrap = createFocusTrap(popupRef, trapConfig);
|
|
25
|
-
}
|
|
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);
|
|
26
19
|
var frameId = null;
|
|
27
20
|
|
|
28
21
|
// wait for the popup to reposition itself before we focus
|
|
29
22
|
frameId = requestAnimationFrame(function () {
|
|
30
23
|
frameId = null;
|
|
31
|
-
|
|
32
|
-
if (initialFocusRef && initialFocusRef.focus) {
|
|
33
|
-
initialFocusRef.focus();
|
|
34
|
-
} else {
|
|
35
|
-
popupRef.focus();
|
|
36
|
-
}
|
|
37
|
-
} else {
|
|
38
|
-
focusTrap.activate();
|
|
39
|
-
}
|
|
24
|
+
focusTrap.activate();
|
|
40
25
|
});
|
|
41
26
|
return function () {
|
|
42
27
|
if (frameId != null) {
|
|
43
28
|
cancelAnimationFrame(frameId);
|
|
44
29
|
frameId = null;
|
|
45
30
|
}
|
|
46
|
-
|
|
47
|
-
if (previouslyFocusedElement && previouslyFocusedElement.focus) {
|
|
48
|
-
previouslyFocusedElement.focus();
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
focusTrap.deactivate();
|
|
52
|
-
}
|
|
31
|
+
focusTrap.deactivate();
|
|
53
32
|
};
|
|
54
33
|
}, [popupRef, initialFocusRef]);
|
|
55
34
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/popup",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.4",
|
|
4
4
|
"description": "A popup displays brief content in an overlay.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
},
|
|
29
29
|
"atlassian": {
|
|
30
30
|
"team": "Design System Team",
|
|
31
|
+
"productPushConsumption": [
|
|
32
|
+
"jira"
|
|
33
|
+
],
|
|
31
34
|
"releaseModel": "continuous",
|
|
32
35
|
"website": {
|
|
33
36
|
"name": "Popup",
|
|
@@ -39,9 +42,9 @@
|
|
|
39
42
|
"@atlaskit/layering": "^0.2.0",
|
|
40
43
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
41
44
|
"@atlaskit/popper": "^5.5.0",
|
|
42
|
-
"@atlaskit/portal": "^4.
|
|
45
|
+
"@atlaskit/portal": "^4.4.0",
|
|
43
46
|
"@atlaskit/theme": "^12.6.0",
|
|
44
|
-
"@atlaskit/tokens": "^1.
|
|
47
|
+
"@atlaskit/tokens": "^1.28.0",
|
|
45
48
|
"@babel/runtime": "^7.0.0",
|
|
46
49
|
"@emotion/react": "^11.7.1",
|
|
47
50
|
"bind-event-listener": "^2.1.1",
|
|
@@ -54,7 +57,7 @@
|
|
|
54
57
|
"devDependencies": {
|
|
55
58
|
"@af/accessibility-testing": "*",
|
|
56
59
|
"@af/visual-regression": "*",
|
|
57
|
-
"@atlaskit/button": "^16.
|
|
60
|
+
"@atlaskit/button": "^16.13.0",
|
|
58
61
|
"@atlaskit/icon": "^21.12.0",
|
|
59
62
|
"@atlaskit/ssr": "*",
|
|
60
63
|
"@atlaskit/visual-regression": "*",
|
|
@@ -98,9 +101,6 @@
|
|
|
98
101
|
"platform-feature-flags": {
|
|
99
102
|
"platform.design-system-team.layering_popup_1cnzt": {
|
|
100
103
|
"type": "boolean"
|
|
101
|
-
},
|
|
102
|
-
"platform.design-system-team.remove-focus-trap-from-popup_3q7sk": {
|
|
103
|
-
"type": "boolean"
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
"homepage": "https://atlassian.design/components/popup/",
|