@atlaskit/popup 2.0.4 → 3.0.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 CHANGED
@@ -1,5 +1,50 @@
1
1
  # @atlaskit/popup
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#127309](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127309)
8
+ [`42392c8a66f3d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/42392c8a66f3d) -
9
+ The `onClose` prop type has been updated, to make the first argument nullable. This argument is
10
+ for the corresponding `event` that led to the callback being called.
11
+
12
+ This is to support programatically closing the popup.
13
+
14
+ Previously, the type of `onClose` was:
15
+
16
+ ```ts
17
+ onClose?(
18
+ event: Event | React.MouseEvent | React.KeyboardEvent,
19
+ currentLevel?: number | any,
20
+ ): void;
21
+
22
+ ```
23
+
24
+ It is now:
25
+
26
+ ```ts
27
+ onClose?(
28
+ event: Event | React.MouseEvent | React.KeyboardEvent | null,
29
+ currentLevel?: number | any,
30
+ ): void;
31
+ ```
32
+
33
+ When the popup is closed programatically, the `event` argument will be `null`.
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies
38
+
39
+ ## 2.0.5
40
+
41
+ ### Patch Changes
42
+
43
+ - [#127093](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127093)
44
+ [`1378ea7a99ce1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1378ea7a99ce1) -
45
+ Upgrades `jscodeshift` to handle generics properly.
46
+ - Updated dependencies
47
+
3
48
  ## 2.0.4
4
49
 
5
50
  ### Patch Changes
@@ -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 happens either when clicking away from the popup or pressing the escape key.
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?(event: Event | React.MouseEvent | React.KeyboardEvent, currentLevel?: number | any): void;
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 happens either when clicking away from the popup or pressing the escape key.
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?(event: Event | React.MouseEvent | React.KeyboardEvent, currentLevel?: number | any): void;
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": "2.0.4",
3
+ "version": "3.0.0",
4
4
  "description": "A popup displays brief content in an overlay.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -64,13 +64,13 @@
64
64
  "@af/integration-testing": "^0.5.0",
65
65
  "@af/visual-regression": "^1.3.0",
66
66
  "@atlaskit/button": "^21.1.0",
67
- "@atlaskit/code": "^16.0.0",
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.0.0",
71
+ "@atlaskit/icon": "^25.2.0",
72
72
  "@atlaskit/link": "^3.0.0",
73
- "@atlaskit/modal-dialog": "^13.4.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",
@@ -82,7 +82,7 @@
82
82
  "@testing-library/react-hooks": "^8.0.1",
83
83
  "@testing-library/user-event": "^14.4.3",
84
84
  "ast-types": "^0.13.3",
85
- "jscodeshift": "^0.13.0",
85
+ "jscodeshift": "^17.0.0",
86
86
  "raf-stub": "^2.0.1",
87
87
  "react-dom": "^18.2.0",
88
88
  "typescript": "~5.4.2"