@atlaskit/popup 1.13.2 → 1.14.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 +12 -0
- package/dist/cjs/popper-wrapper.js +4 -2
- package/dist/cjs/popup.js +4 -2
- package/dist/es2019/popper-wrapper.js +4 -2
- package/dist/es2019/popup.js +4 -2
- package/dist/esm/popper-wrapper.js +4 -2
- package/dist/esm/popup.js +4 -2
- package/dist/types/popper-wrapper.d.ts +1 -1
- package/dist/types/types.d.ts +33 -28
- package/dist/types-ts4.5/popper-wrapper.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +33 -28
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/popup
|
|
2
2
|
|
|
3
|
+
## 1.14.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#94316](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94316) [`35fd5ed8e1d7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/35fd5ed8e1d7) - Upgrading internal dependency `bind-event-listener` to `@^3.0.0`
|
|
8
|
+
|
|
9
|
+
## 1.14.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#84410](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/84410) [`9d5dc8f7de85`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9d5dc8f7de85) - Adds a new `strategy` prop to control the positioning strategy to use other than the default 'fixed' position.
|
|
14
|
+
|
|
3
15
|
## 1.13.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -76,7 +76,8 @@ function PopperWrapper(_ref) {
|
|
|
76
76
|
triggerRef = _ref.triggerRef,
|
|
77
77
|
shouldUseCaptureOnOutsideClick = _ref.shouldUseCaptureOnOutsideClick,
|
|
78
78
|
shouldRenderToParent = _ref.shouldRenderToParent,
|
|
79
|
-
shouldDisableFocusLock = _ref.shouldDisableFocusLock
|
|
79
|
+
shouldDisableFocusLock = _ref.shouldDisableFocusLock,
|
|
80
|
+
strategy = _ref.strategy;
|
|
80
81
|
var _useState = (0, _react.useState)(null),
|
|
81
82
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
82
83
|
popupRef = _useState2[0],
|
|
@@ -118,7 +119,8 @@ function PopperWrapper(_ref) {
|
|
|
118
119
|
return (0, _react2.jsx)(_popper.Popper, {
|
|
119
120
|
placement: placement,
|
|
120
121
|
offset: offset,
|
|
121
|
-
modifiers: modifiers
|
|
122
|
+
modifiers: modifiers,
|
|
123
|
+
strategy: strategy
|
|
122
124
|
}, function (_ref2) {
|
|
123
125
|
var _ref3 = _ref2.ref,
|
|
124
126
|
style = _ref2.style,
|
package/dist/cjs/popup.js
CHANGED
|
@@ -44,7 +44,8 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
44
44
|
_ref$shouldRenderToPa = _ref.shouldRenderToParent,
|
|
45
45
|
shouldRenderToParent = _ref$shouldRenderToPa === void 0 ? false : _ref$shouldRenderToPa,
|
|
46
46
|
_ref$shouldDisableFoc = _ref.shouldDisableFocusLock,
|
|
47
|
-
shouldDisableFocusLock = _ref$shouldDisableFoc === void 0 ? false : _ref$shouldDisableFoc
|
|
47
|
+
shouldDisableFocusLock = _ref$shouldDisableFoc === void 0 ? false : _ref$shouldDisableFoc,
|
|
48
|
+
strategy = _ref.strategy;
|
|
48
49
|
var _useState = (0, _react.useState)(null),
|
|
49
50
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
50
51
|
triggerRef = _useState2[0],
|
|
@@ -95,7 +96,8 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
95
96
|
shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick,
|
|
96
97
|
shouldRenderToParent: shouldRenderToParent,
|
|
97
98
|
shouldDisableFocusLock: shouldDisableFocusLock,
|
|
98
|
-
triggerRef: triggerRef
|
|
99
|
+
triggerRef: triggerRef,
|
|
100
|
+
strategy: strategy
|
|
99
101
|
}));
|
|
100
102
|
return (0, _react2.jsx)(_popper.Manager, null, (0, _react2.jsx)(_popper.Reference, null, function (_ref2) {
|
|
101
103
|
var ref = _ref2.ref;
|
|
@@ -65,7 +65,8 @@ function PopperWrapper({
|
|
|
65
65
|
triggerRef,
|
|
66
66
|
shouldUseCaptureOnOutsideClick,
|
|
67
67
|
shouldRenderToParent,
|
|
68
|
-
shouldDisableFocusLock
|
|
68
|
+
shouldDisableFocusLock,
|
|
69
|
+
strategy
|
|
69
70
|
}) {
|
|
70
71
|
const [popupRef, setPopupRef] = useState(null);
|
|
71
72
|
const [initialFocusRef, setInitialFocusRef] = useState(null);
|
|
@@ -101,7 +102,8 @@ function PopperWrapper({
|
|
|
101
102
|
return jsx(Popper, {
|
|
102
103
|
placement: placement,
|
|
103
104
|
offset: offset,
|
|
104
|
-
modifiers: modifiers
|
|
105
|
+
modifiers: modifiers,
|
|
106
|
+
strategy: strategy
|
|
105
107
|
}, ({
|
|
106
108
|
ref,
|
|
107
109
|
style,
|
package/dist/es2019/popup.js
CHANGED
|
@@ -27,7 +27,8 @@ export const Popup = /*#__PURE__*/memo(({
|
|
|
27
27
|
zIndex = defaultLayer,
|
|
28
28
|
shouldUseCaptureOnOutsideClick = false,
|
|
29
29
|
shouldRenderToParent = false,
|
|
30
|
-
shouldDisableFocusLock = false
|
|
30
|
+
shouldDisableFocusLock = false,
|
|
31
|
+
strategy
|
|
31
32
|
}) => {
|
|
32
33
|
const [triggerRef, setTriggerRef] = useState(null);
|
|
33
34
|
|
|
@@ -72,7 +73,8 @@ export const Popup = /*#__PURE__*/memo(({
|
|
|
72
73
|
shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick,
|
|
73
74
|
shouldRenderToParent: shouldRenderToParent,
|
|
74
75
|
shouldDisableFocusLock: shouldDisableFocusLock,
|
|
75
|
-
triggerRef: triggerRef
|
|
76
|
+
triggerRef: triggerRef,
|
|
77
|
+
strategy: strategy
|
|
76
78
|
}));
|
|
77
79
|
return jsx(Manager, null, jsx(Reference, null, ({
|
|
78
80
|
ref
|
|
@@ -69,7 +69,8 @@ function PopperWrapper(_ref) {
|
|
|
69
69
|
triggerRef = _ref.triggerRef,
|
|
70
70
|
shouldUseCaptureOnOutsideClick = _ref.shouldUseCaptureOnOutsideClick,
|
|
71
71
|
shouldRenderToParent = _ref.shouldRenderToParent,
|
|
72
|
-
shouldDisableFocusLock = _ref.shouldDisableFocusLock
|
|
72
|
+
shouldDisableFocusLock = _ref.shouldDisableFocusLock,
|
|
73
|
+
strategy = _ref.strategy;
|
|
73
74
|
var _useState = useState(null),
|
|
74
75
|
_useState2 = _slicedToArray(_useState, 2),
|
|
75
76
|
popupRef = _useState2[0],
|
|
@@ -111,7 +112,8 @@ function PopperWrapper(_ref) {
|
|
|
111
112
|
return jsx(Popper, {
|
|
112
113
|
placement: placement,
|
|
113
114
|
offset: offset,
|
|
114
|
-
modifiers: modifiers
|
|
115
|
+
modifiers: modifiers,
|
|
116
|
+
strategy: strategy
|
|
115
117
|
}, function (_ref2) {
|
|
116
118
|
var _ref3 = _ref2.ref,
|
|
117
119
|
style = _ref2.style,
|
package/dist/esm/popup.js
CHANGED
|
@@ -36,7 +36,8 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
|
|
|
36
36
|
_ref$shouldRenderToPa = _ref.shouldRenderToParent,
|
|
37
37
|
shouldRenderToParent = _ref$shouldRenderToPa === void 0 ? false : _ref$shouldRenderToPa,
|
|
38
38
|
_ref$shouldDisableFoc = _ref.shouldDisableFocusLock,
|
|
39
|
-
shouldDisableFocusLock = _ref$shouldDisableFoc === void 0 ? false : _ref$shouldDisableFoc
|
|
39
|
+
shouldDisableFocusLock = _ref$shouldDisableFoc === void 0 ? false : _ref$shouldDisableFoc,
|
|
40
|
+
strategy = _ref.strategy;
|
|
40
41
|
var _useState = useState(null),
|
|
41
42
|
_useState2 = _slicedToArray(_useState, 2),
|
|
42
43
|
triggerRef = _useState2[0],
|
|
@@ -87,7 +88,8 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
|
|
|
87
88
|
shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick,
|
|
88
89
|
shouldRenderToParent: shouldRenderToParent,
|
|
89
90
|
shouldDisableFocusLock: shouldDisableFocusLock,
|
|
90
|
-
triggerRef: triggerRef
|
|
91
|
+
triggerRef: triggerRef,
|
|
92
|
+
strategy: strategy
|
|
91
93
|
}));
|
|
92
94
|
return jsx(Manager, null, jsx(Reference, null, function (_ref2) {
|
|
93
95
|
var ref = _ref2.ref;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import { PopperWrapperProps } from './types';
|
|
3
|
-
declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldDisableFocusLock, }: PopperWrapperProps): jsx.JSX.Element;
|
|
3
|
+
declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldDisableFocusLock, strategy, }: PopperWrapperProps): jsx.JSX.Element;
|
|
4
4
|
export default PopperWrapper;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export type PopupRef = HTMLDivElement | null;
|
|
|
10
10
|
export type TriggerRef = HTMLElement | HTMLButtonElement | null;
|
|
11
11
|
export interface ContentProps {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* This will reposition the popup if any of the content has changed.
|
|
14
|
+
* This is useful when positions change, and the popup wasn't aware.
|
|
15
15
|
*/
|
|
16
16
|
update: PopperChildrenProps['update'];
|
|
17
17
|
/**
|
|
@@ -23,13 +23,13 @@ export interface ContentProps {
|
|
|
23
23
|
*/
|
|
24
24
|
onClose?: BaseProps['onClose'];
|
|
25
25
|
/**
|
|
26
|
-
* Escape hatch to set the initial focus for a specific element when the popup is opened.
|
|
26
|
+
* Escape hatch to set the initial focus for a specific element, when the popup is opened.
|
|
27
27
|
*/
|
|
28
28
|
setInitialFocusRef: Dispatch<SetStateAction<HTMLElement | null>>;
|
|
29
29
|
}
|
|
30
30
|
export interface PopupComponentProps {
|
|
31
31
|
/**
|
|
32
|
-
* Children passed
|
|
32
|
+
* Children passed through by the parent popup.
|
|
33
33
|
*/
|
|
34
34
|
children: ReactNode;
|
|
35
35
|
/**
|
|
@@ -37,11 +37,11 @@ export interface PopupComponentProps {
|
|
|
37
37
|
*/
|
|
38
38
|
'data-placement': Placement;
|
|
39
39
|
/**
|
|
40
|
-
* Test
|
|
40
|
+
* Test ID passed through by the parent popup.
|
|
41
41
|
*/
|
|
42
42
|
'data-testid'?: string;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* ID passed through by the parent popup.
|
|
45
45
|
*/
|
|
46
46
|
id?: string;
|
|
47
47
|
/**
|
|
@@ -58,14 +58,14 @@ export interface PopupComponentProps {
|
|
|
58
58
|
tabIndex: number | undefined;
|
|
59
59
|
/**
|
|
60
60
|
* The root element where the popup should be rendered.
|
|
61
|
-
*
|
|
61
|
+
* The default is `false`.
|
|
62
62
|
*/
|
|
63
63
|
shouldRenderToParent?: boolean;
|
|
64
64
|
}
|
|
65
65
|
interface BaseProps {
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
68
|
-
* When set to `false` popup will not render anything to the DOM.
|
|
67
|
+
* Use this to either show or hide the popup.
|
|
68
|
+
* When set to `false` the popup will not render anything to the DOM.
|
|
69
69
|
*/
|
|
70
70
|
isOpen: boolean;
|
|
71
71
|
/**
|
|
@@ -73,41 +73,41 @@ interface BaseProps {
|
|
|
73
73
|
*/
|
|
74
74
|
content: (props: ContentProps) => React.ReactNode;
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* ID that is assigned to the popup container element.
|
|
77
77
|
*/
|
|
78
78
|
id?: string;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
80
|
+
* The distance the popup should be offset from the reference in the format of [along, away] (units in px).
|
|
81
|
+
* The default is `[0, 8]`, which means the popup will be `8px` away from the edge of the reference specified
|
|
82
82
|
* by the `placement` prop.
|
|
83
83
|
*/
|
|
84
84
|
offset?: [number, number];
|
|
85
85
|
/**
|
|
86
86
|
* Placement of where the popup should be displayed relative to the trigger element.
|
|
87
|
-
*
|
|
87
|
+
* The default is `"auto"`.
|
|
88
88
|
*/
|
|
89
89
|
placement?: Placement;
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
92
|
-
* When
|
|
91
|
+
* This is a list of backup placements for the popup to try.
|
|
92
|
+
* When the preferred placement doesn't have enough space,
|
|
93
93
|
* the modifier will test the ones provided in the list, and use the first suitable one.
|
|
94
94
|
* If no fallback placements are suitable, it reverts back to the original placement.
|
|
95
95
|
*/
|
|
96
96
|
fallbackPlacements?: Placement[];
|
|
97
97
|
/**
|
|
98
98
|
* The boundary element that the popup will check for overflow.
|
|
99
|
-
*
|
|
99
|
+
* The default is `"clippingParents"` which are parent scroll containers,
|
|
100
100
|
* but can be set to any element.
|
|
101
101
|
*/
|
|
102
102
|
boundary?: 'clippingParents' | HTMLElement;
|
|
103
103
|
/**
|
|
104
104
|
* The root boundary that the popup will check for overflow.
|
|
105
|
-
*
|
|
105
|
+
* The default is `"viewport"` but it can be set to `"document"`.
|
|
106
106
|
*/
|
|
107
107
|
rootBoundary?: 'viewport' | 'document';
|
|
108
108
|
/**
|
|
109
|
-
* Allows the
|
|
110
|
-
*
|
|
109
|
+
* Allows the popup to be placed on the opposite side of its trigger if it doesn't fit in the viewport.
|
|
110
|
+
* The default is `true`.
|
|
111
111
|
*/
|
|
112
112
|
shouldFlip?: boolean;
|
|
113
113
|
/**
|
|
@@ -118,24 +118,24 @@ interface BaseProps {
|
|
|
118
118
|
testId?: string;
|
|
119
119
|
/**
|
|
120
120
|
* Handler that is called when the popup wants to close itself.
|
|
121
|
-
*
|
|
122
|
-
* You'll want to use this to set open state accordingly and then pump it back into the `isOpen` prop.
|
|
121
|
+
* This happens either when clicking away from the popup or pressing the escape key.
|
|
122
|
+
* You'll want to use this to set open state accordingly, and then pump it back into the `isOpen` prop.
|
|
123
123
|
*/
|
|
124
124
|
onClose?(event: Event | React.MouseEvent | React.KeyboardEvent): void;
|
|
125
125
|
/**
|
|
126
126
|
* The element that is shown when `isOpen` prop is `true`.
|
|
127
127
|
* The result of the `content` prop will be placed as children here.
|
|
128
|
-
*
|
|
128
|
+
* The default is an element with an elevation of `e200` with _no padding_.
|
|
129
129
|
*/
|
|
130
130
|
popupComponent?: ComponentType<PopupComponentProps>;
|
|
131
131
|
/**
|
|
132
|
-
*
|
|
132
|
+
* This controls whether the popup takes focus when opening.
|
|
133
133
|
* This changes the `popupComponent` component tabIndex to `null`.
|
|
134
|
-
*
|
|
134
|
+
* The default is `true`.
|
|
135
135
|
*/
|
|
136
136
|
autoFocus?: boolean;
|
|
137
137
|
/**
|
|
138
|
-
*
|
|
138
|
+
* This controls if the event which handles clicks outside the popup is be bound with
|
|
139
139
|
* `capture: true`.
|
|
140
140
|
*/
|
|
141
141
|
shouldUseCaptureOnOutsideClick?: boolean;
|
|
@@ -145,10 +145,15 @@ interface BaseProps {
|
|
|
145
145
|
*/
|
|
146
146
|
shouldRenderToParent?: boolean;
|
|
147
147
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
148
|
+
* This allows the Popup disable focus lock. It will only work when `shouldRenderToParent` is `true`.
|
|
149
|
+
* The default is `false`.
|
|
150
150
|
*/
|
|
151
151
|
shouldDisableFocusLock?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* This controls the positioning strategy to use. Can vary between `absolute` and `fixed`.
|
|
154
|
+
* The default is `fixed`.
|
|
155
|
+
*/
|
|
156
|
+
strategy?: 'absolute' | 'fixed';
|
|
152
157
|
}
|
|
153
158
|
export interface PopupProps extends BaseProps {
|
|
154
159
|
/**
|
|
@@ -160,7 +165,7 @@ export interface PopupProps extends BaseProps {
|
|
|
160
165
|
/**
|
|
161
166
|
* Z-index that the popup should be displayed in.
|
|
162
167
|
* This is passed to the portal component.
|
|
163
|
-
*
|
|
168
|
+
* The default is `layers.layer()` from `@atlaskit/theme`.
|
|
164
169
|
*/
|
|
165
170
|
zIndex?: number;
|
|
166
171
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import { PopperWrapperProps } from './types';
|
|
3
|
-
declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldDisableFocusLock, }: PopperWrapperProps): jsx.JSX.Element;
|
|
3
|
+
declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldDisableFocusLock, strategy, }: PopperWrapperProps): jsx.JSX.Element;
|
|
4
4
|
export default PopperWrapper;
|
|
@@ -10,8 +10,8 @@ export type PopupRef = HTMLDivElement | null;
|
|
|
10
10
|
export type TriggerRef = HTMLElement | HTMLButtonElement | null;
|
|
11
11
|
export interface ContentProps {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* This will reposition the popup if any of the content has changed.
|
|
14
|
+
* This is useful when positions change, and the popup wasn't aware.
|
|
15
15
|
*/
|
|
16
16
|
update: PopperChildrenProps['update'];
|
|
17
17
|
/**
|
|
@@ -23,13 +23,13 @@ export interface ContentProps {
|
|
|
23
23
|
*/
|
|
24
24
|
onClose?: BaseProps['onClose'];
|
|
25
25
|
/**
|
|
26
|
-
* Escape hatch to set the initial focus for a specific element when the popup is opened.
|
|
26
|
+
* Escape hatch to set the initial focus for a specific element, when the popup is opened.
|
|
27
27
|
*/
|
|
28
28
|
setInitialFocusRef: Dispatch<SetStateAction<HTMLElement | null>>;
|
|
29
29
|
}
|
|
30
30
|
export interface PopupComponentProps {
|
|
31
31
|
/**
|
|
32
|
-
* Children passed
|
|
32
|
+
* Children passed through by the parent popup.
|
|
33
33
|
*/
|
|
34
34
|
children: ReactNode;
|
|
35
35
|
/**
|
|
@@ -37,11 +37,11 @@ export interface PopupComponentProps {
|
|
|
37
37
|
*/
|
|
38
38
|
'data-placement': Placement;
|
|
39
39
|
/**
|
|
40
|
-
* Test
|
|
40
|
+
* Test ID passed through by the parent popup.
|
|
41
41
|
*/
|
|
42
42
|
'data-testid'?: string;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* ID passed through by the parent popup.
|
|
45
45
|
*/
|
|
46
46
|
id?: string;
|
|
47
47
|
/**
|
|
@@ -58,14 +58,14 @@ export interface PopupComponentProps {
|
|
|
58
58
|
tabIndex: number | undefined;
|
|
59
59
|
/**
|
|
60
60
|
* The root element where the popup should be rendered.
|
|
61
|
-
*
|
|
61
|
+
* The default is `false`.
|
|
62
62
|
*/
|
|
63
63
|
shouldRenderToParent?: boolean;
|
|
64
64
|
}
|
|
65
65
|
interface BaseProps {
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
68
|
-
* When set to `false` popup will not render anything to the DOM.
|
|
67
|
+
* Use this to either show or hide the popup.
|
|
68
|
+
* When set to `false` the popup will not render anything to the DOM.
|
|
69
69
|
*/
|
|
70
70
|
isOpen: boolean;
|
|
71
71
|
/**
|
|
@@ -73,12 +73,12 @@ interface BaseProps {
|
|
|
73
73
|
*/
|
|
74
74
|
content: (props: ContentProps) => React.ReactNode;
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* ID that is assigned to the popup container element.
|
|
77
77
|
*/
|
|
78
78
|
id?: string;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
80
|
+
* The distance the popup should be offset from the reference in the format of [along, away] (units in px).
|
|
81
|
+
* The default is `[0, 8]`, which means the popup will be `8px` away from the edge of the reference specified
|
|
82
82
|
* by the `placement` prop.
|
|
83
83
|
*/
|
|
84
84
|
offset?: [
|
|
@@ -87,30 +87,30 @@ interface BaseProps {
|
|
|
87
87
|
];
|
|
88
88
|
/**
|
|
89
89
|
* Placement of where the popup should be displayed relative to the trigger element.
|
|
90
|
-
*
|
|
90
|
+
* The default is `"auto"`.
|
|
91
91
|
*/
|
|
92
92
|
placement?: Placement;
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
95
|
-
* When
|
|
94
|
+
* This is a list of backup placements for the popup to try.
|
|
95
|
+
* When the preferred placement doesn't have enough space,
|
|
96
96
|
* the modifier will test the ones provided in the list, and use the first suitable one.
|
|
97
97
|
* If no fallback placements are suitable, it reverts back to the original placement.
|
|
98
98
|
*/
|
|
99
99
|
fallbackPlacements?: Placement[];
|
|
100
100
|
/**
|
|
101
101
|
* The boundary element that the popup will check for overflow.
|
|
102
|
-
*
|
|
102
|
+
* The default is `"clippingParents"` which are parent scroll containers,
|
|
103
103
|
* but can be set to any element.
|
|
104
104
|
*/
|
|
105
105
|
boundary?: 'clippingParents' | HTMLElement;
|
|
106
106
|
/**
|
|
107
107
|
* The root boundary that the popup will check for overflow.
|
|
108
|
-
*
|
|
108
|
+
* The default is `"viewport"` but it can be set to `"document"`.
|
|
109
109
|
*/
|
|
110
110
|
rootBoundary?: 'viewport' | 'document';
|
|
111
111
|
/**
|
|
112
|
-
* Allows the
|
|
113
|
-
*
|
|
112
|
+
* Allows the popup to be placed on the opposite side of its trigger if it doesn't fit in the viewport.
|
|
113
|
+
* The default is `true`.
|
|
114
114
|
*/
|
|
115
115
|
shouldFlip?: boolean;
|
|
116
116
|
/**
|
|
@@ -121,24 +121,24 @@ interface BaseProps {
|
|
|
121
121
|
testId?: string;
|
|
122
122
|
/**
|
|
123
123
|
* Handler that is called when the popup wants to close itself.
|
|
124
|
-
*
|
|
125
|
-
* You'll want to use this to set open state accordingly and then pump it back into the `isOpen` prop.
|
|
124
|
+
* This happens either when clicking away from the popup or pressing the escape key.
|
|
125
|
+
* You'll want to use this to set open state accordingly, and then pump it back into the `isOpen` prop.
|
|
126
126
|
*/
|
|
127
127
|
onClose?(event: Event | React.MouseEvent | React.KeyboardEvent): void;
|
|
128
128
|
/**
|
|
129
129
|
* The element that is shown when `isOpen` prop is `true`.
|
|
130
130
|
* The result of the `content` prop will be placed as children here.
|
|
131
|
-
*
|
|
131
|
+
* The default is an element with an elevation of `e200` with _no padding_.
|
|
132
132
|
*/
|
|
133
133
|
popupComponent?: ComponentType<PopupComponentProps>;
|
|
134
134
|
/**
|
|
135
|
-
*
|
|
135
|
+
* This controls whether the popup takes focus when opening.
|
|
136
136
|
* This changes the `popupComponent` component tabIndex to `null`.
|
|
137
|
-
*
|
|
137
|
+
* The default is `true`.
|
|
138
138
|
*/
|
|
139
139
|
autoFocus?: boolean;
|
|
140
140
|
/**
|
|
141
|
-
*
|
|
141
|
+
* This controls if the event which handles clicks outside the popup is be bound with
|
|
142
142
|
* `capture: true`.
|
|
143
143
|
*/
|
|
144
144
|
shouldUseCaptureOnOutsideClick?: boolean;
|
|
@@ -148,10 +148,15 @@ interface BaseProps {
|
|
|
148
148
|
*/
|
|
149
149
|
shouldRenderToParent?: boolean;
|
|
150
150
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
151
|
+
* This allows the Popup disable focus lock. It will only work when `shouldRenderToParent` is `true`.
|
|
152
|
+
* The default is `false`.
|
|
153
153
|
*/
|
|
154
154
|
shouldDisableFocusLock?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* This controls the positioning strategy to use. Can vary between `absolute` and `fixed`.
|
|
157
|
+
* The default is `fixed`.
|
|
158
|
+
*/
|
|
159
|
+
strategy?: 'absolute' | 'fixed';
|
|
155
160
|
}
|
|
156
161
|
export interface PopupProps extends BaseProps {
|
|
157
162
|
/**
|
|
@@ -163,7 +168,7 @@ export interface PopupProps extends BaseProps {
|
|
|
163
168
|
/**
|
|
164
169
|
* Z-index that the popup should be displayed in.
|
|
165
170
|
* This is passed to the portal component.
|
|
166
|
-
*
|
|
171
|
+
* The default is `layers.layer()` from `@atlaskit/theme`.
|
|
167
172
|
*/
|
|
168
173
|
zIndex?: number;
|
|
169
174
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/popup",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.1",
|
|
4
4
|
"description": "A popup displays brief content in an overlay.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@atlaskit/ds-lib": "^2.
|
|
41
|
+
"@atlaskit/ds-lib": "^2.3.0",
|
|
42
42
|
"@atlaskit/layering": "^0.2.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
44
44
|
"@atlaskit/popper": "^5.5.0",
|
|
45
45
|
"@atlaskit/portal": "^4.4.0",
|
|
46
|
-
"@atlaskit/theme": "^12.
|
|
47
|
-
"@atlaskit/tokens": "^1.
|
|
46
|
+
"@atlaskit/theme": "^12.7.0",
|
|
47
|
+
"@atlaskit/tokens": "^1.43.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"@emotion/react": "^11.7.1",
|
|
50
|
-
"bind-event-listener": "^
|
|
50
|
+
"bind-event-listener": "^3.0.0",
|
|
51
51
|
"focus-trap": "^2.4.5",
|
|
52
52
|
"memoize-one": "^6.0.0"
|
|
53
53
|
},
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@af/accessibility-testing": "*",
|
|
60
60
|
"@af/visual-regression": "*",
|
|
61
|
-
"@atlaskit/button": "^17.
|
|
61
|
+
"@atlaskit/button": "^17.14.0",
|
|
62
62
|
"@atlaskit/icon": "^22.1.0",
|
|
63
63
|
"@atlaskit/ssr": "*",
|
|
64
64
|
"@atlaskit/visual-regression": "*",
|