@atlaskit/popup 6.0.1 → 6.0.3
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,20 @@
|
|
|
1
1
|
# @atlaskit/popup
|
|
2
2
|
|
|
3
|
+
## 6.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c3cae446aea72`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c3cae446aea72) -
|
|
8
|
+
Only set `aria-controls` while popup content is mounted and clarify the top-layer trigger helper
|
|
9
|
+
documentation.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 6.0.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 6.0.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -48,7 +48,8 @@ var PopupTopLayer = exports.PopupTopLayer = /*#__PURE__*/(0, _react.memo)(functi
|
|
|
48
48
|
testId = _ref.testId,
|
|
49
49
|
trigger = _ref.trigger,
|
|
50
50
|
content = _ref.content,
|
|
51
|
-
onClose = _ref.onClose,
|
|
51
|
+
_ref$onClose = _ref.onClose,
|
|
52
|
+
onClose = _ref$onClose === void 0 ? _noop.default : _ref$onClose,
|
|
52
53
|
_ref$placement = _ref.placement,
|
|
53
54
|
placement = _ref$placement === void 0 ? 'auto' : _ref$placement,
|
|
54
55
|
_fallbackPlacements = _ref.fallbackPlacements,
|
|
@@ -76,7 +77,6 @@ var PopupTopLayer = exports.PopupTopLayer = /*#__PURE__*/(0, _react.memo)(functi
|
|
|
76
77
|
_appearance = _ref.appearance;
|
|
77
78
|
var triggerRef = (0, _react.useRef)(null);
|
|
78
79
|
var popoverRef = (0, _react.useRef)(null);
|
|
79
|
-
var popupContainerRef = (0, _react.useRef)(null);
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* Escape hatch for consumer-chosen initial focus target.
|
|
@@ -171,9 +171,6 @@ var PopupTopLayer = exports.PopupTopLayer = /*#__PURE__*/(0, _react.memo)(functi
|
|
|
171
171
|
// No manual triggerRef.current?.focus() is needed.
|
|
172
172
|
var handleOnClose = (0, _react.useCallback)(function (_ref2) {
|
|
173
173
|
var reason = _ref2.reason;
|
|
174
|
-
if (!onClose) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
174
|
onClose((0, _popover.createPopoverCloseEvent)({
|
|
178
175
|
reason: reason
|
|
179
176
|
}));
|
|
@@ -199,10 +196,11 @@ var PopupTopLayer = exports.PopupTopLayer = /*#__PURE__*/(0, _react.memo)(functi
|
|
|
199
196
|
label: label,
|
|
200
197
|
titleId: titleId
|
|
201
198
|
});
|
|
199
|
+
var resolvedPopoverId = providedId !== null && providedId !== void 0 ? providedId : popoverId;
|
|
202
200
|
var ariaAttributes = (0, _getAriaForTrigger.getAriaForTrigger)({
|
|
203
201
|
role: (_roleProps$role = roleProps.role) !== null && _roleProps$role !== void 0 ? _roleProps$role : 'dialog',
|
|
204
202
|
isOpen: isOpen,
|
|
205
|
-
popoverId:
|
|
203
|
+
popoverId: resolvedPopoverId
|
|
206
204
|
});
|
|
207
205
|
|
|
208
206
|
// Narrow to ForwardRefExoticComponent so JSX accepts the ref prop.
|
|
@@ -214,7 +212,7 @@ var PopupTopLayer = exports.PopupTopLayer = /*#__PURE__*/(0, _react.memo)(functi
|
|
|
214
212
|
ref: function ref(node) {
|
|
215
213
|
triggerRef.current = node;
|
|
216
214
|
},
|
|
217
|
-
'aria-controls':
|
|
215
|
+
'aria-controls': ariaAttributes['aria-controls'],
|
|
218
216
|
// `aria-expanded` reflects current open state.
|
|
219
217
|
'aria-expanded': ariaAttributes['aria-expanded'],
|
|
220
218
|
// FUDGE(top-layer-api): cast to the narrow public TriggerProps['aria-haspopup'] union.
|
|
@@ -228,7 +226,7 @@ var PopupTopLayer = exports.PopupTopLayer = /*#__PURE__*/(0, _react.memo)(functi
|
|
|
228
226
|
};
|
|
229
227
|
return /*#__PURE__*/React.createElement(_react.Fragment, null, trigger(triggerProps), /*#__PURE__*/React.createElement(_popover.Popover, (0, _extends2.default)({
|
|
230
228
|
ref: popoverRef,
|
|
231
|
-
id:
|
|
229
|
+
id: resolvedPopoverId
|
|
232
230
|
}, roleProps, {
|
|
233
231
|
isOpen: isOpen,
|
|
234
232
|
onClose: handleOnClose,
|
|
@@ -236,7 +234,6 @@ var PopupTopLayer = exports.PopupTopLayer = /*#__PURE__*/(0, _react.memo)(functi
|
|
|
236
234
|
placement: topLayerPlacement,
|
|
237
235
|
testId: testId && "".concat(testId, "--content")
|
|
238
236
|
}), Container ? /*#__PURE__*/React.createElement(Container, {
|
|
239
|
-
ref: popupContainerRef,
|
|
240
237
|
style: EMPTY_STYLE,
|
|
241
238
|
id: providedId,
|
|
242
239
|
"data-placement": placement,
|
|
@@ -106,7 +106,6 @@ function PopperWrapper({
|
|
|
106
106
|
rootBoundary,
|
|
107
107
|
shouldFlip,
|
|
108
108
|
placement = 'auto',
|
|
109
|
-
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
110
109
|
popupComponent: PopupContainer = DefaultPopupComponent,
|
|
111
110
|
autoFocus = true,
|
|
112
111
|
triggerRef,
|
|
@@ -38,7 +38,7 @@ export const PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer({
|
|
|
38
38
|
testId,
|
|
39
39
|
trigger,
|
|
40
40
|
content,
|
|
41
|
-
onClose,
|
|
41
|
+
onClose = noop,
|
|
42
42
|
placement = 'auto',
|
|
43
43
|
fallbackPlacements: _fallbackPlacements,
|
|
44
44
|
shouldFlip: _shouldFlip = true,
|
|
@@ -89,7 +89,6 @@ export const PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer({
|
|
|
89
89
|
var _roleProps$role;
|
|
90
90
|
const triggerRef = useRef(null);
|
|
91
91
|
const popoverRef = useRef(null);
|
|
92
|
-
const popupContainerRef = useRef(null);
|
|
93
92
|
|
|
94
93
|
/**
|
|
95
94
|
* Escape hatch for consumer-chosen initial focus target.
|
|
@@ -183,9 +182,6 @@ export const PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer({
|
|
|
183
182
|
const handleOnClose = useCallback(({
|
|
184
183
|
reason
|
|
185
184
|
}) => {
|
|
186
|
-
if (!onClose) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
185
|
onClose(createPopoverCloseEvent({
|
|
190
186
|
reason
|
|
191
187
|
}));
|
|
@@ -195,7 +191,7 @@ export const PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer({
|
|
|
195
191
|
// Legacy content() receives { isOpen, update, setInitialFocusRef, onClose }.
|
|
196
192
|
// update is a no-op because CSS Anchor Positioning self-updates.
|
|
197
193
|
const contentProps = useMemo(() => ({
|
|
198
|
-
isOpen
|
|
194
|
+
isOpen,
|
|
199
195
|
update: noop,
|
|
200
196
|
onClose,
|
|
201
197
|
setInitialFocusRef
|
|
@@ -209,10 +205,11 @@ export const PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer({
|
|
|
209
205
|
label,
|
|
210
206
|
titleId
|
|
211
207
|
});
|
|
208
|
+
const resolvedPopoverId = providedId !== null && providedId !== void 0 ? providedId : popoverId;
|
|
212
209
|
const ariaAttributes = getAriaForTrigger({
|
|
213
210
|
role: (_roleProps$role = roleProps.role) !== null && _roleProps$role !== void 0 ? _roleProps$role : 'dialog',
|
|
214
211
|
isOpen,
|
|
215
|
-
popoverId
|
|
212
|
+
popoverId: resolvedPopoverId
|
|
216
213
|
});
|
|
217
214
|
|
|
218
215
|
// Narrow to ForwardRefExoticComponent so JSX accepts the ref prop.
|
|
@@ -224,7 +221,7 @@ export const PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer({
|
|
|
224
221
|
ref: node => {
|
|
225
222
|
triggerRef.current = node;
|
|
226
223
|
},
|
|
227
|
-
'aria-controls':
|
|
224
|
+
'aria-controls': ariaAttributes['aria-controls'],
|
|
228
225
|
// `aria-expanded` reflects current open state.
|
|
229
226
|
'aria-expanded': ariaAttributes['aria-expanded'],
|
|
230
227
|
// FUDGE(top-layer-api): cast to the narrow public TriggerProps['aria-haspopup'] union.
|
|
@@ -238,7 +235,7 @@ export const PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer({
|
|
|
238
235
|
};
|
|
239
236
|
return /*#__PURE__*/React.createElement(Fragment, null, trigger(triggerProps), /*#__PURE__*/React.createElement(Popover, _extends({
|
|
240
237
|
ref: popoverRef,
|
|
241
|
-
id:
|
|
238
|
+
id: resolvedPopoverId
|
|
242
239
|
}, roleProps, {
|
|
243
240
|
isOpen: isOpen,
|
|
244
241
|
onClose: handleOnClose,
|
|
@@ -246,7 +243,6 @@ export const PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer({
|
|
|
246
243
|
placement: topLayerPlacement,
|
|
247
244
|
testId: testId && `${testId}--content`
|
|
248
245
|
}), Container ? /*#__PURE__*/React.createElement(Container, {
|
|
249
|
-
ref: popupContainerRef,
|
|
250
246
|
style: EMPTY_STYLE,
|
|
251
247
|
id: providedId,
|
|
252
248
|
"data-placement": placement,
|
|
@@ -39,7 +39,8 @@ export var PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer(_ref) {
|
|
|
39
39
|
testId = _ref.testId,
|
|
40
40
|
trigger = _ref.trigger,
|
|
41
41
|
content = _ref.content,
|
|
42
|
-
onClose = _ref.onClose,
|
|
42
|
+
_ref$onClose = _ref.onClose,
|
|
43
|
+
onClose = _ref$onClose === void 0 ? noop : _ref$onClose,
|
|
43
44
|
_ref$placement = _ref.placement,
|
|
44
45
|
placement = _ref$placement === void 0 ? 'auto' : _ref$placement,
|
|
45
46
|
_fallbackPlacements = _ref.fallbackPlacements,
|
|
@@ -67,7 +68,6 @@ export var PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer(_ref) {
|
|
|
67
68
|
_appearance = _ref.appearance;
|
|
68
69
|
var triggerRef = useRef(null);
|
|
69
70
|
var popoverRef = useRef(null);
|
|
70
|
-
var popupContainerRef = useRef(null);
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* Escape hatch for consumer-chosen initial focus target.
|
|
@@ -162,9 +162,6 @@ export var PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer(_ref) {
|
|
|
162
162
|
// No manual triggerRef.current?.focus() is needed.
|
|
163
163
|
var handleOnClose = useCallback(function (_ref2) {
|
|
164
164
|
var reason = _ref2.reason;
|
|
165
|
-
if (!onClose) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
165
|
onClose(createPopoverCloseEvent({
|
|
169
166
|
reason: reason
|
|
170
167
|
}));
|
|
@@ -190,10 +187,11 @@ export var PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer(_ref) {
|
|
|
190
187
|
label: label,
|
|
191
188
|
titleId: titleId
|
|
192
189
|
});
|
|
190
|
+
var resolvedPopoverId = providedId !== null && providedId !== void 0 ? providedId : popoverId;
|
|
193
191
|
var ariaAttributes = getAriaForTrigger({
|
|
194
192
|
role: (_roleProps$role = roleProps.role) !== null && _roleProps$role !== void 0 ? _roleProps$role : 'dialog',
|
|
195
193
|
isOpen: isOpen,
|
|
196
|
-
popoverId:
|
|
194
|
+
popoverId: resolvedPopoverId
|
|
197
195
|
});
|
|
198
196
|
|
|
199
197
|
// Narrow to ForwardRefExoticComponent so JSX accepts the ref prop.
|
|
@@ -205,7 +203,7 @@ export var PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer(_ref) {
|
|
|
205
203
|
ref: function ref(node) {
|
|
206
204
|
triggerRef.current = node;
|
|
207
205
|
},
|
|
208
|
-
'aria-controls':
|
|
206
|
+
'aria-controls': ariaAttributes['aria-controls'],
|
|
209
207
|
// `aria-expanded` reflects current open state.
|
|
210
208
|
'aria-expanded': ariaAttributes['aria-expanded'],
|
|
211
209
|
// FUDGE(top-layer-api): cast to the narrow public TriggerProps['aria-haspopup'] union.
|
|
@@ -219,7 +217,7 @@ export var PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer(_ref) {
|
|
|
219
217
|
};
|
|
220
218
|
return /*#__PURE__*/React.createElement(Fragment, null, trigger(triggerProps), /*#__PURE__*/React.createElement(Popover, _extends({
|
|
221
219
|
ref: popoverRef,
|
|
222
|
-
id:
|
|
220
|
+
id: resolvedPopoverId
|
|
223
221
|
}, roleProps, {
|
|
224
222
|
isOpen: isOpen,
|
|
225
223
|
onClose: handleOnClose,
|
|
@@ -227,7 +225,6 @@ export var PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer(_ref) {
|
|
|
227
225
|
placement: topLayerPlacement,
|
|
228
226
|
testId: testId && "".concat(testId, "--content")
|
|
229
227
|
}), Container ? /*#__PURE__*/React.createElement(Container, {
|
|
230
|
-
ref: popupContainerRef,
|
|
231
228
|
style: EMPTY_STYLE,
|
|
232
229
|
id: providedId,
|
|
233
230
|
"data-placement": placement,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/popup",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
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/primitives": "^22.2.0",
|
|
42
42
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
43
43
|
"@atlaskit/tokens": "^16.7.0",
|
|
44
|
-
"@atlaskit/top-layer": "^
|
|
44
|
+
"@atlaskit/top-layer": "^4.2.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0",
|
|
46
46
|
"@compiled/react": "^1.0.2",
|
|
47
47
|
"bind-event-listener": "^3.0.0",
|
package/popup.docs.tsx
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
|
|
3
|
-
import type { StructuredContentSource } from '@atlassian/structured-docs-types/types';
|
|
4
|
-
|
|
5
|
-
const documentation: StructuredContentSource = {
|
|
6
|
-
components: [
|
|
7
|
-
{
|
|
8
|
-
name: 'Popup',
|
|
9
|
-
description: 'A component for displaying popup content relative to a trigger element.',
|
|
10
|
-
status: 'general-availability',
|
|
11
|
-
designSource: {
|
|
12
|
-
figmaUrl: 'https://go.atlassian.com/figma-library-ads-82088-103357',
|
|
13
|
-
},
|
|
14
|
-
import: {
|
|
15
|
-
name: 'Popup',
|
|
16
|
-
package: '@atlaskit/popup/popup',
|
|
17
|
-
type: 'named',
|
|
18
|
-
packagePath: path.resolve(__dirname),
|
|
19
|
-
packageJson: require('./package.json'),
|
|
20
|
-
},
|
|
21
|
-
usageGuidelines: [
|
|
22
|
-
'Use for contextual content that appears on demand',
|
|
23
|
-
'Position appropriately relative to trigger',
|
|
24
|
-
'Consider dismissal behavior',
|
|
25
|
-
'Use appropriate content sizing',
|
|
26
|
-
],
|
|
27
|
-
contentGuidelines: [
|
|
28
|
-
'Keep popup content focused and relevant',
|
|
29
|
-
'Use clear, concise content',
|
|
30
|
-
'Provide appropriate actions when needed',
|
|
31
|
-
'Consider content hierarchy',
|
|
32
|
-
],
|
|
33
|
-
accessibilityGuidelines: [
|
|
34
|
-
'Provide appropriate focus management',
|
|
35
|
-
'Use clear trigger labels',
|
|
36
|
-
'Ensure keyboard navigation support',
|
|
37
|
-
'Provide escape key dismissal',
|
|
38
|
-
],
|
|
39
|
-
examples: [
|
|
40
|
-
{
|
|
41
|
-
name: 'Popup',
|
|
42
|
-
description: 'Popup example',
|
|
43
|
-
source: path.resolve(__dirname, './examples/ai/popup.tsx'),
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
keywords: ['popup', 'overlay', 'floating', 'content', 'trigger'],
|
|
47
|
-
categories: ['overlay'],
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default documentation;
|