@atlaskit/popup 2.0.5 → 3.0.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 +45 -0
- package/dist/cjs/compositional/popup.js +5 -1
- package/dist/cjs/popup.js +5 -1
- package/dist/es2019/compositional/popup.js +6 -2
- package/dist/es2019/popup.js +6 -2
- package/dist/esm/compositional/popup.js +6 -2
- package/dist/esm/popup.js +6 -2
- package/dist/types/types.d.ts +11 -2
- package/dist/types-ts4.5/types.d.ts +11 -2
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @atlaskit/popup
|
|
2
2
|
|
|
3
|
+
## 3.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#134955](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/134955)
|
|
8
|
+
[`ba294ad0536de`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ba294ad0536de) -
|
|
9
|
+
An onClose listener is being provided to the experimental open layer observer.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 3.0.0
|
|
13
|
+
|
|
14
|
+
### Major Changes
|
|
15
|
+
|
|
16
|
+
- [#127309](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127309)
|
|
17
|
+
[`42392c8a66f3d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/42392c8a66f3d) -
|
|
18
|
+
The `onClose` prop type has been updated, to make the first argument nullable. This argument is
|
|
19
|
+
for the corresponding `event` that led to the callback being called.
|
|
20
|
+
|
|
21
|
+
This is to support programatically closing the popup.
|
|
22
|
+
|
|
23
|
+
Previously, the type of `onClose` was:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
onClose?(
|
|
27
|
+
event: Event | React.MouseEvent | React.KeyboardEvent,
|
|
28
|
+
currentLevel?: number | any,
|
|
29
|
+
): void;
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
It is now:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
onClose?(
|
|
37
|
+
event: Event | React.MouseEvent | React.KeyboardEvent | null,
|
|
38
|
+
currentLevel?: number | any,
|
|
39
|
+
): void;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
When the popup is closed programatically, the `event` argument will be `null`.
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Updated dependencies
|
|
47
|
+
|
|
3
48
|
## 2.0.5
|
|
4
49
|
|
|
5
50
|
### Patch Changes
|
|
@@ -161,8 +161,12 @@ var PopupContent = exports.PopupContent = function PopupContent(_ref4) {
|
|
|
161
161
|
}),
|
|
162
162
|
appearance = _usePopupAppearance.appearance,
|
|
163
163
|
shouldRenderToParent = _usePopupAppearance.shouldRenderToParent;
|
|
164
|
+
var handleOpenLayerObserverCloseSignal = (0, _react.useCallback)(function () {
|
|
165
|
+
onClose === null || onClose === void 0 || onClose(null);
|
|
166
|
+
}, [onClose]);
|
|
164
167
|
(0, _openLayerObserver.useNotifyOpenLayerObserver)({
|
|
165
|
-
isOpen: isOpen
|
|
168
|
+
isOpen: isOpen,
|
|
169
|
+
onClose: handleOpenLayerObserverCloseSignal
|
|
166
170
|
});
|
|
167
171
|
if (!isOpen) {
|
|
168
172
|
return null;
|
package/dist/cjs/popup.js
CHANGED
|
@@ -86,8 +86,12 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
86
86
|
appearance = _usePopupAppearance.appearance,
|
|
87
87
|
shouldRenderToParent = _usePopupAppearance.shouldRenderToParent;
|
|
88
88
|
var id = providedId || generatedId;
|
|
89
|
+
var handleOpenLayerObserverCloseSignal = (0, _react.useCallback)(function () {
|
|
90
|
+
onClose === null || onClose === void 0 || onClose(null);
|
|
91
|
+
}, [onClose]);
|
|
89
92
|
(0, _openLayerObserver.useNotifyOpenLayerObserver)({
|
|
90
|
-
isOpen: isOpen
|
|
93
|
+
isOpen: isOpen,
|
|
94
|
+
onClose: handleOpenLayerObserverCloseSignal
|
|
91
95
|
});
|
|
92
96
|
var renderPopperWrapper = (0, _react2.jsx)(_layering.Layering, {
|
|
93
97
|
isDisabled: false
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext, useContext, useState } from 'react';
|
|
1
|
+
import React, { createContext, useCallback, useContext, useState } from 'react';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import noop from '@atlaskit/ds-lib/noop';
|
|
4
4
|
import { useId } from '@atlaskit/ds-lib/use-id';
|
|
@@ -140,8 +140,12 @@ export const PopupContent = ({
|
|
|
140
140
|
appearance: inAppearance,
|
|
141
141
|
shouldRenderToParent: inShouldRenderToParent
|
|
142
142
|
});
|
|
143
|
+
const handleOpenLayerObserverCloseSignal = useCallback(() => {
|
|
144
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(null);
|
|
145
|
+
}, [onClose]);
|
|
143
146
|
useNotifyOpenLayerObserver({
|
|
144
|
-
isOpen
|
|
147
|
+
isOpen,
|
|
148
|
+
onClose: handleOpenLayerObserverCloseSignal
|
|
145
149
|
});
|
|
146
150
|
if (!isOpen) {
|
|
147
151
|
return null;
|
package/dist/es2019/popup.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @jsxRuntime classic
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
|
-
import { memo, useState } from 'react';
|
|
6
|
+
import { memo, useCallback, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
@@ -65,8 +65,12 @@ export const Popup = /*#__PURE__*/memo(({
|
|
|
65
65
|
shouldRenderToParent: inShouldRenderToParent
|
|
66
66
|
});
|
|
67
67
|
const id = providedId || generatedId;
|
|
68
|
+
const handleOpenLayerObserverCloseSignal = useCallback(() => {
|
|
69
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(null);
|
|
70
|
+
}, [onClose]);
|
|
68
71
|
useNotifyOpenLayerObserver({
|
|
69
|
-
isOpen
|
|
72
|
+
isOpen,
|
|
73
|
+
onClose: handleOpenLayerObserverCloseSignal
|
|
70
74
|
});
|
|
71
75
|
const renderPopperWrapper = jsx(Layering, {
|
|
72
76
|
isDisabled: false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import React, { createContext, useContext, useState } from 'react';
|
|
2
|
+
import React, { createContext, useCallback, useContext, useState } from 'react';
|
|
3
3
|
import invariant from 'tiny-invariant';
|
|
4
4
|
import noop from '@atlaskit/ds-lib/noop';
|
|
5
5
|
import { useId } from '@atlaskit/ds-lib/use-id';
|
|
@@ -151,8 +151,12 @@ export var PopupContent = function PopupContent(_ref4) {
|
|
|
151
151
|
}),
|
|
152
152
|
appearance = _usePopupAppearance.appearance,
|
|
153
153
|
shouldRenderToParent = _usePopupAppearance.shouldRenderToParent;
|
|
154
|
+
var handleOpenLayerObserverCloseSignal = useCallback(function () {
|
|
155
|
+
onClose === null || onClose === void 0 || onClose(null);
|
|
156
|
+
}, [onClose]);
|
|
154
157
|
useNotifyOpenLayerObserver({
|
|
155
|
-
isOpen: isOpen
|
|
158
|
+
isOpen: isOpen,
|
|
159
|
+
onClose: handleOpenLayerObserverCloseSignal
|
|
156
160
|
});
|
|
157
161
|
if (!isOpen) {
|
|
158
162
|
return null;
|
package/dist/esm/popup.js
CHANGED
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
4
4
|
* @jsxRuntime classic
|
|
5
5
|
* @jsx jsx
|
|
6
6
|
*/
|
|
7
|
-
import { memo, useState } from 'react';
|
|
7
|
+
import { memo, useCallback, useState } from 'react';
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
10
|
import { jsx } from '@emotion/react';
|
|
@@ -78,8 +78,12 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
|
|
|
78
78
|
appearance = _usePopupAppearance.appearance,
|
|
79
79
|
shouldRenderToParent = _usePopupAppearance.shouldRenderToParent;
|
|
80
80
|
var id = providedId || generatedId;
|
|
81
|
+
var handleOpenLayerObserverCloseSignal = useCallback(function () {
|
|
82
|
+
onClose === null || onClose === void 0 || onClose(null);
|
|
83
|
+
}, [onClose]);
|
|
81
84
|
useNotifyOpenLayerObserver({
|
|
82
|
-
isOpen: isOpen
|
|
85
|
+
isOpen: isOpen,
|
|
86
|
+
onClose: handleOpenLayerObserverCloseSignal
|
|
83
87
|
});
|
|
84
88
|
var renderPopperWrapper = jsx(Layering, {
|
|
85
89
|
isDisabled: false
|
package/dist/types/types.d.ts
CHANGED
|
@@ -144,10 +144,19 @@ interface BaseProps {
|
|
|
144
144
|
testId?: string;
|
|
145
145
|
/**
|
|
146
146
|
* Handler that is called when the popup wants to close itself.
|
|
147
|
-
* This
|
|
147
|
+
* This can happen when:
|
|
148
|
+
* - the user clicks away from the popup
|
|
149
|
+
* - the user presses the escape key
|
|
150
|
+
* - the popup is closed programatically. In this case, the `event` argument will be `null`.
|
|
151
|
+
*
|
|
148
152
|
* You'll want to use this to set open state accordingly, and then pump it back into the `isOpen` prop.
|
|
149
153
|
*/
|
|
150
|
-
onClose?(
|
|
154
|
+
onClose?(
|
|
155
|
+
/**
|
|
156
|
+
* The event that triggered the close.
|
|
157
|
+
* The argument value will be `null` when the popup is closed programatically and has no corresponding event.
|
|
158
|
+
*/
|
|
159
|
+
event: Event | React.MouseEvent | React.KeyboardEvent | null, currentLevel?: number | any): void;
|
|
151
160
|
/**
|
|
152
161
|
* The element that is shown when `isOpen` prop is `true`.
|
|
153
162
|
* The result of the `content` prop will be placed as children here.
|
|
@@ -147,10 +147,19 @@ interface BaseProps {
|
|
|
147
147
|
testId?: string;
|
|
148
148
|
/**
|
|
149
149
|
* Handler that is called when the popup wants to close itself.
|
|
150
|
-
* This
|
|
150
|
+
* This can happen when:
|
|
151
|
+
* - the user clicks away from the popup
|
|
152
|
+
* - the user presses the escape key
|
|
153
|
+
* - the popup is closed programatically. In this case, the `event` argument will be `null`.
|
|
154
|
+
*
|
|
151
155
|
* You'll want to use this to set open state accordingly, and then pump it back into the `isOpen` prop.
|
|
152
156
|
*/
|
|
153
|
-
onClose?(
|
|
157
|
+
onClose?(
|
|
158
|
+
/**
|
|
159
|
+
* The event that triggered the close.
|
|
160
|
+
* The argument value will be `null` when the popup is closed programatically and has no corresponding event.
|
|
161
|
+
*/
|
|
162
|
+
event: Event | React.MouseEvent | React.KeyboardEvent | null, currentLevel?: number | any): void;
|
|
154
163
|
/**
|
|
155
164
|
* The element that is shown when `isOpen` prop is `true`.
|
|
156
165
|
* The result of the `content` prop will be placed as children here.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/popup",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "A popup displays brief content in an overlay.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@atlaskit/css": "^0.10.0",
|
|
42
42
|
"@atlaskit/ds-lib": "^4.0.0",
|
|
43
43
|
"@atlaskit/focus-ring": "^3.0.0",
|
|
44
|
-
"@atlaskit/layering": "^2.
|
|
44
|
+
"@atlaskit/layering": "^2.1.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
46
46
|
"@atlaskit/popper": "^7.0.0",
|
|
47
47
|
"@atlaskit/portal": "^5.1.0",
|
|
@@ -63,26 +63,27 @@
|
|
|
63
63
|
"@af/accessibility-testing": "^2.0.0",
|
|
64
64
|
"@af/integration-testing": "^0.5.0",
|
|
65
65
|
"@af/visual-regression": "^1.3.0",
|
|
66
|
-
"@atlaskit/button": "^
|
|
66
|
+
"@atlaskit/button": "^22.0.0",
|
|
67
67
|
"@atlaskit/code": "^16.1.0",
|
|
68
68
|
"@atlaskit/docs": "^10.0.0",
|
|
69
69
|
"@atlaskit/form": "^12.0.0",
|
|
70
70
|
"@atlaskit/heading": "^5.1.0",
|
|
71
|
-
"@atlaskit/icon": "^25.
|
|
72
|
-
"@atlaskit/link": "^3.
|
|
73
|
-
"@atlaskit/modal-dialog": "^
|
|
71
|
+
"@atlaskit/icon": "^25.4.0",
|
|
72
|
+
"@atlaskit/link": "^3.1.0",
|
|
73
|
+
"@atlaskit/modal-dialog": "^14.0.0",
|
|
74
74
|
"@atlaskit/section-message": "^8.2.0",
|
|
75
75
|
"@atlaskit/ssr": "^0.4.0",
|
|
76
76
|
"@atlaskit/textfield": "^8.0.0",
|
|
77
77
|
"@atlaskit/toggle": "^15.0.0",
|
|
78
78
|
"@atlaskit/visual-regression": "^0.10.0",
|
|
79
79
|
"@atlassian/feature-flags-test-utils": "^0.3.0",
|
|
80
|
+
"@atlassian/ssr-tests": "^0.2.0",
|
|
80
81
|
"@compiled/react": "^0.18.3",
|
|
81
82
|
"@testing-library/react": "^13.4.0",
|
|
82
83
|
"@testing-library/react-hooks": "^8.0.1",
|
|
83
84
|
"@testing-library/user-event": "^14.4.3",
|
|
84
85
|
"ast-types": "^0.13.3",
|
|
85
|
-
"jscodeshift": "^0.
|
|
86
|
+
"jscodeshift": "^17.0.0",
|
|
86
87
|
"raf-stub": "^2.0.1",
|
|
87
88
|
"react-dom": "^18.2.0",
|
|
88
89
|
"typescript": "~5.4.2"
|