@atlaskit/popup 1.24.2 → 1.25.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,21 @@
1
1
  # @atlaskit/popup
2
2
 
3
+ ## 1.25.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#138688](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/138688)
8
+ [`961d97994618c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/961d97994618c) -
9
+ Adds `shouldFitViewport` prop which will apply `max-width` and `max-height` to contain the
10
+ popper/popup within the viewport.
11
+
12
+ ### Patch Changes
13
+
14
+ - [#138585](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/138585)
15
+ [`b72c2c7f9a2fd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b72c2c7f9a2fd) -
16
+ Support to close all layers when clicking outside under feature flag
17
+ - Updated dependencies
18
+
3
19
  ## 1.24.2
4
20
 
5
21
  ### Patch Changes
@@ -129,7 +129,8 @@ var PopupContent = exports.PopupContent = function PopupContent(_ref4) {
129
129
  shouldRenderToParent = _ref4.shouldRenderToParent,
130
130
  _ref4$shouldDisableFo = _ref4.shouldDisableFocusLock,
131
131
  shouldDisableFocusLock = _ref4$shouldDisableFo === void 0 ? false : _ref4$shouldDisableFo,
132
- shouldFitContainer = _ref4.shouldFitContainer;
132
+ shouldFitContainer = _ref4.shouldFitContainer,
133
+ shouldFitViewport = _ref4.shouldFitViewport;
133
134
  useEnsureIsInsidePopup();
134
135
  var isOpen = (0, _react.useContext)(IsOpenContext);
135
136
  var id = (0, _react.useContext)(IdContext);
@@ -158,7 +159,8 @@ var PopupContent = exports.PopupContent = function PopupContent(_ref4) {
158
159
  shouldRenderToParent: shouldRenderToParent,
159
160
  shouldDisableFocusLock: shouldDisableFocusLock,
160
161
  triggerRef: triggerRef,
161
- strategy: strategy
162
+ strategy: strategy,
163
+ shouldFitViewport: shouldFitViewport
162
164
  }));
163
165
  if (shouldRenderToParent) {
164
166
  return popperWrapper;
@@ -86,7 +86,8 @@ function PopperWrapper(_ref) {
86
86
  role = _ref.role,
87
87
  label = _ref.label,
88
88
  titleId = _ref.titleId,
89
- modifiers = _ref.modifiers;
89
+ modifiers = _ref.modifiers,
90
+ shouldFitViewport = _ref.shouldFitViewport;
90
91
  var _useState = (0, _react.useState)(null),
91
92
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
92
93
  popupRef = _useState2[0],
@@ -137,7 +138,8 @@ function PopperWrapper(_ref) {
137
138
  placement: placement,
138
139
  offset: offset,
139
140
  modifiers: mergedModifiers,
140
- strategy: strategy
141
+ strategy: strategy,
142
+ shouldFitViewport: shouldFitViewport
141
143
  }, function (_ref2) {
142
144
  var _ref3 = _ref2.ref,
143
145
  style = _ref2.style,
package/dist/cjs/popup.js CHANGED
@@ -65,7 +65,8 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
65
65
  role = _ref.role,
66
66
  label = _ref.label,
67
67
  titleId = _ref.titleId,
68
- modifiers = _ref.modifiers;
68
+ modifiers = _ref.modifiers,
69
+ shouldFitViewport = _ref.shouldFitViewport;
69
70
  var _useState = (0, _react.useState)(null),
70
71
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
71
72
  triggerRef = _useState2[0],
@@ -100,7 +101,8 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
100
101
  role: role,
101
102
  label: label,
102
103
  titleId: titleId,
103
- modifiers: modifiers
104
+ modifiers: modifiers,
105
+ shouldFitViewport: shouldFitViewport
104
106
  }));
105
107
  var popupContent = (0, _react2.jsx)(_popper.Manager, null, (0, _react2.jsx)(_popper.Reference, null, function (_ref2) {
106
108
  var ref = _ref2.ref;
@@ -36,7 +36,16 @@ var useCloseManager = exports.useCloseManager = function useCloseManager(_ref) {
36
36
  }
37
37
  var closePopup = function closePopup(event) {
38
38
  if (onClose) {
39
- onClose(event);
39
+ if ((0, _platformFeatureFlags.fg)('sibling-dropdown-close-issue')) {
40
+ var _currentLevel = null;
41
+ if (event.target instanceof HTMLElement) {
42
+ var _event$target$closest;
43
+ _currentLevel = (_event$target$closest = event.target.closest("[data-ds--level]")) === null || _event$target$closest === void 0 ? void 0 : _event$target$closest.getAttribute('data-ds--level');
44
+ }
45
+ _currentLevel ? onClose(event, Number(_currentLevel)) : onClose(event);
46
+ } else {
47
+ onClose(event);
48
+ }
40
49
  }
41
50
  if (shouldDisableFocusTrap && (0, _platformFeatureFlags.fg)('platform_dst_popup-disable-focuslock')) {
42
51
  // Restoring the normal focus order for trigger.
@@ -61,8 +70,19 @@ var useCloseManager = exports.useCloseManager = function useCloseManager(_ref) {
61
70
  return;
62
71
  }
63
72
  if (isLayerDisabled()) {
64
- //if it is a disabled layer, we need to disable its click listener.
65
- return;
73
+ //if it is a disabled layer, and we clicked inside a higher layer
74
+ //we will disable the click event
75
+ if ((0, _platformFeatureFlags.fg)('design-system-closed-all-when-click-outside')) {
76
+ if (target instanceof HTMLElement) {
77
+ var _target$closest;
78
+ var levelOfClickedLayer = (_target$closest = target.closest) === null || _target$closest === void 0 || (_target$closest = _target$closest.call(target, "[data-ds--level]")) === null || _target$closest === void 0 ? void 0 : _target$closest.getAttribute('data-ds--level');
79
+ if (levelOfClickedLayer && Number(levelOfClickedLayer) > currentLevel) {
80
+ return;
81
+ }
82
+ }
83
+ } else {
84
+ return;
85
+ }
66
86
  }
67
87
  var isClickOnPopup = popupRef && popupRef.contains(target);
68
88
  var isClickOnTrigger = triggerRef && triggerRef.contains(target);
@@ -108,7 +108,8 @@ export const PopupContent = ({
108
108
  shouldUseCaptureOnOutsideClick = false,
109
109
  shouldRenderToParent,
110
110
  shouldDisableFocusLock = false,
111
- shouldFitContainer
111
+ shouldFitContainer,
112
+ shouldFitViewport
112
113
  }) => {
113
114
  useEnsureIsInsidePopup();
114
115
  const isOpen = useContext(IsOpenContext);
@@ -138,7 +139,8 @@ export const PopupContent = ({
138
139
  shouldRenderToParent: shouldRenderToParent,
139
140
  shouldDisableFocusLock: shouldDisableFocusLock,
140
141
  triggerRef: triggerRef,
141
- strategy: strategy
142
+ strategy: strategy,
143
+ shouldFitViewport: shouldFitViewport
142
144
  }));
143
145
  if (shouldRenderToParent) {
144
146
  return popperWrapper;
@@ -74,7 +74,8 @@ function PopperWrapper({
74
74
  role,
75
75
  label,
76
76
  titleId,
77
- modifiers
77
+ modifiers,
78
+ shouldFitViewport
78
79
  }) {
79
80
  const [popupRef, setPopupRef] = useState(null);
80
81
  const [initialFocusRef, setInitialFocusRef] = useState(null);
@@ -119,7 +120,8 @@ function PopperWrapper({
119
120
  placement: placement,
120
121
  offset: offset,
121
122
  modifiers: mergedModifiers,
122
- strategy: strategy
123
+ strategy: strategy,
124
+ shouldFitViewport: shouldFitViewport
123
125
  }, ({
124
126
  ref,
125
127
  style,
@@ -46,7 +46,8 @@ export const Popup = /*#__PURE__*/memo(({
46
46
  role,
47
47
  label,
48
48
  titleId,
49
- modifiers
49
+ modifiers,
50
+ shouldFitViewport
50
51
  }) => {
51
52
  const [triggerRef, setTriggerRef] = useState(null);
52
53
  const getMergedTriggerRef = useGetMemoizedMergedTriggerRef();
@@ -79,7 +80,8 @@ export const Popup = /*#__PURE__*/memo(({
79
80
  role: role,
80
81
  label: label,
81
82
  titleId: titleId,
82
- modifiers: modifiers
83
+ modifiers: modifiers,
84
+ shouldFitViewport: shouldFitViewport
83
85
  }));
84
86
  const popupContent = jsx(Manager, null, jsx(Reference, null, ({
85
87
  ref
@@ -31,7 +31,16 @@ export const useCloseManager = ({
31
31
  }
32
32
  const closePopup = event => {
33
33
  if (onClose) {
34
- onClose(event);
34
+ if (fg('sibling-dropdown-close-issue')) {
35
+ let currentLevel = null;
36
+ if (event.target instanceof HTMLElement) {
37
+ var _event$target$closest;
38
+ currentLevel = (_event$target$closest = event.target.closest(`[data-ds--level]`)) === null || _event$target$closest === void 0 ? void 0 : _event$target$closest.getAttribute('data-ds--level');
39
+ }
40
+ currentLevel ? onClose(event, Number(currentLevel)) : onClose(event);
41
+ } else {
42
+ onClose(event);
43
+ }
35
44
  }
36
45
  if (shouldDisableFocusTrap && fg('platform_dst_popup-disable-focuslock')) {
37
46
  // Restoring the normal focus order for trigger.
@@ -58,8 +67,19 @@ export const useCloseManager = ({
58
67
  return;
59
68
  }
60
69
  if (isLayerDisabled()) {
61
- //if it is a disabled layer, we need to disable its click listener.
62
- return;
70
+ //if it is a disabled layer, and we clicked inside a higher layer
71
+ //we will disable the click event
72
+ if (fg('design-system-closed-all-when-click-outside')) {
73
+ if (target instanceof HTMLElement) {
74
+ var _target$closest, _target$closest$call;
75
+ const levelOfClickedLayer = (_target$closest = target.closest) === null || _target$closest === void 0 ? void 0 : (_target$closest$call = _target$closest.call(target, `[data-ds--level]`)) === null || _target$closest$call === void 0 ? void 0 : _target$closest$call.getAttribute('data-ds--level');
76
+ if (levelOfClickedLayer && Number(levelOfClickedLayer) > currentLevel) {
77
+ return;
78
+ }
79
+ }
80
+ } else {
81
+ return;
82
+ }
63
83
  }
64
84
  const isClickOnPopup = popupRef && popupRef.contains(target);
65
85
  const isClickOnTrigger = triggerRef && triggerRef.contains(target);
@@ -119,7 +119,8 @@ export var PopupContent = function PopupContent(_ref4) {
119
119
  shouldRenderToParent = _ref4.shouldRenderToParent,
120
120
  _ref4$shouldDisableFo = _ref4.shouldDisableFocusLock,
121
121
  shouldDisableFocusLock = _ref4$shouldDisableFo === void 0 ? false : _ref4$shouldDisableFo,
122
- shouldFitContainer = _ref4.shouldFitContainer;
122
+ shouldFitContainer = _ref4.shouldFitContainer,
123
+ shouldFitViewport = _ref4.shouldFitViewport;
123
124
  useEnsureIsInsidePopup();
124
125
  var isOpen = useContext(IsOpenContext);
125
126
  var id = useContext(IdContext);
@@ -148,7 +149,8 @@ export var PopupContent = function PopupContent(_ref4) {
148
149
  shouldRenderToParent: shouldRenderToParent,
149
150
  shouldDisableFocusLock: shouldDisableFocusLock,
150
151
  triggerRef: triggerRef,
151
- strategy: strategy
152
+ strategy: strategy,
153
+ shouldFitViewport: shouldFitViewport
152
154
  }));
153
155
  if (shouldRenderToParent) {
154
156
  return popperWrapper;
@@ -79,7 +79,8 @@ function PopperWrapper(_ref) {
79
79
  role = _ref.role,
80
80
  label = _ref.label,
81
81
  titleId = _ref.titleId,
82
- modifiers = _ref.modifiers;
82
+ modifiers = _ref.modifiers,
83
+ shouldFitViewport = _ref.shouldFitViewport;
83
84
  var _useState = useState(null),
84
85
  _useState2 = _slicedToArray(_useState, 2),
85
86
  popupRef = _useState2[0],
@@ -130,7 +131,8 @@ function PopperWrapper(_ref) {
130
131
  placement: placement,
131
132
  offset: offset,
132
133
  modifiers: mergedModifiers,
133
- strategy: strategy
134
+ strategy: strategy,
135
+ shouldFitViewport: shouldFitViewport
134
136
  }, function (_ref2) {
135
137
  var _ref3 = _ref2.ref,
136
138
  style = _ref2.style,
package/dist/esm/popup.js CHANGED
@@ -57,7 +57,8 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
57
57
  role = _ref.role,
58
58
  label = _ref.label,
59
59
  titleId = _ref.titleId,
60
- modifiers = _ref.modifiers;
60
+ modifiers = _ref.modifiers,
61
+ shouldFitViewport = _ref.shouldFitViewport;
61
62
  var _useState = useState(null),
62
63
  _useState2 = _slicedToArray(_useState, 2),
63
64
  triggerRef = _useState2[0],
@@ -92,7 +93,8 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
92
93
  role: role,
93
94
  label: label,
94
95
  titleId: titleId,
95
- modifiers: modifiers
96
+ modifiers: modifiers,
97
+ shouldFitViewport: shouldFitViewport
96
98
  }));
97
99
  var popupContent = jsx(Manager, null, jsx(Reference, null, function (_ref2) {
98
100
  var ref = _ref2.ref;
@@ -28,7 +28,16 @@ export var useCloseManager = function useCloseManager(_ref) {
28
28
  }
29
29
  var closePopup = function closePopup(event) {
30
30
  if (onClose) {
31
- onClose(event);
31
+ if (fg('sibling-dropdown-close-issue')) {
32
+ var _currentLevel = null;
33
+ if (event.target instanceof HTMLElement) {
34
+ var _event$target$closest;
35
+ _currentLevel = (_event$target$closest = event.target.closest("[data-ds--level]")) === null || _event$target$closest === void 0 ? void 0 : _event$target$closest.getAttribute('data-ds--level');
36
+ }
37
+ _currentLevel ? onClose(event, Number(_currentLevel)) : onClose(event);
38
+ } else {
39
+ onClose(event);
40
+ }
32
41
  }
33
42
  if (shouldDisableFocusTrap && fg('platform_dst_popup-disable-focuslock')) {
34
43
  // Restoring the normal focus order for trigger.
@@ -53,8 +62,19 @@ export var useCloseManager = function useCloseManager(_ref) {
53
62
  return;
54
63
  }
55
64
  if (isLayerDisabled()) {
56
- //if it is a disabled layer, we need to disable its click listener.
57
- return;
65
+ //if it is a disabled layer, and we clicked inside a higher layer
66
+ //we will disable the click event
67
+ if (fg('design-system-closed-all-when-click-outside')) {
68
+ if (target instanceof HTMLElement) {
69
+ var _target$closest;
70
+ var levelOfClickedLayer = (_target$closest = target.closest) === null || _target$closest === void 0 || (_target$closest = _target$closest.call(target, "[data-ds--level]")) === null || _target$closest === void 0 ? void 0 : _target$closest.getAttribute('data-ds--level');
71
+ if (levelOfClickedLayer && Number(levelOfClickedLayer) > currentLevel) {
72
+ return;
73
+ }
74
+ }
75
+ } else {
76
+ return;
77
+ }
58
78
  }
59
79
  var isClickOnPopup = popupRef && popupRef.contains(target);
60
80
  var isClickOnTrigger = triggerRef && triggerRef.contains(target);
@@ -36,7 +36,7 @@ export type PopupTriggerProps = {
36
36
  * It must be a child of the Popup component.
37
37
  */
38
38
  export declare const PopupTrigger: ({ children }: PopupTriggerProps) => JSX.Element;
39
- type CommonContentPopupProps = Pick<LegacyPopupProps, 'boundary' | 'offset' | 'onClose' | 'testId' | 'placement' | 'fallbackPlacements' | 'popupComponent' | 'shouldFlip' | 'rootBoundary' | 'autoFocus' | 'shouldRenderToParent' | 'shouldUseCaptureOnOutsideClick' | 'shouldDisableFocusLock' | 'strategy' | 'zIndex'> & {
39
+ type CommonContentPopupProps = Pick<LegacyPopupProps, 'boundary' | 'offset' | 'onClose' | 'testId' | 'placement' | 'fallbackPlacements' | 'popupComponent' | 'shouldFlip' | 'rootBoundary' | 'autoFocus' | 'shouldRenderToParent' | 'shouldUseCaptureOnOutsideClick' | 'shouldDisableFocusLock' | 'strategy' | 'zIndex' | 'shouldFitViewport'> & {
40
40
  children: (props: ContentProps) => React.ReactNode;
41
41
  };
42
42
  type ShouldFitContainerContentPopupProps = CommonContentPopupProps & {
@@ -55,5 +55,5 @@ export type PopupContentProps = ShouldFitContainerContentPopupProps | StandardPo
55
55
  *
56
56
  * It must be a child of the Popup component.
57
57
  */
58
- export declare const PopupContent: ({ children, boundary, offset, strategy, onClose, testId, rootBoundary, shouldFlip, placement, fallbackPlacements, popupComponent, autoFocus, zIndex, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldDisableFocusLock, shouldFitContainer, }: PopupContentProps) => JSX.Element | null;
58
+ export declare const PopupContent: ({ children, boundary, offset, strategy, onClose, testId, rootBoundary, shouldFlip, placement, fallbackPlacements, popupComponent, autoFocus, zIndex, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldDisableFocusLock, shouldFitContainer, shouldFitViewport, }: PopupContentProps) => JSX.Element | null;
59
59
  export {};
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { type PopperWrapperProps } from './types';
3
- declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, shouldReturnFocus, strategy, role, label, titleId, modifiers, }: 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, shouldFitContainer, shouldDisableFocusLock, shouldReturnFocus, strategy, role, label, titleId, modifiers, shouldFitViewport, }: PopperWrapperProps): jsx.JSX.Element;
4
4
  export default PopperWrapper;
@@ -5,6 +5,7 @@ export interface TriggerProps {
5
5
  'aria-controls'?: string;
6
6
  'aria-expanded': boolean;
7
7
  'aria-haspopup': boolean | 'dialog';
8
+ 'data-ds--level'?: string;
8
9
  }
9
10
  export type PopupRef = HTMLDivElement | null;
10
11
  export type TriggerRef = HTMLElement | HTMLButtonElement | null;
@@ -133,7 +134,7 @@ interface BaseProps {
133
134
  * This happens either when clicking away from the popup or pressing the escape key.
134
135
  * You'll want to use this to set open state accordingly, and then pump it back into the `isOpen` prop.
135
136
  */
136
- onClose?(event: Event | React.MouseEvent | React.KeyboardEvent): void;
137
+ onClose?(event: Event | React.MouseEvent | React.KeyboardEvent, currentLevel?: number | any): void;
137
138
  /**
138
139
  * The element that is shown when `isOpen` prop is `true`.
139
140
  * The result of the `content` prop will be placed as children here.
@@ -199,6 +200,11 @@ interface BaseProps {
199
200
  * for more details - https://popper.js.org/docs/v1/#modifiers
200
201
  */
201
202
  modifiers?: Partial<Modifier<string, object>>[];
203
+ /**
204
+ * Determines if the popup will have a `max-width` and `max-height` set to
205
+ * constrain it to the viewport.
206
+ */
207
+ shouldFitViewport?: boolean;
202
208
  }
203
209
  interface InternalPopupProps extends BaseProps {
204
210
  /**
@@ -36,7 +36,7 @@ export type PopupTriggerProps = {
36
36
  * It must be a child of the Popup component.
37
37
  */
38
38
  export declare const PopupTrigger: ({ children }: PopupTriggerProps) => JSX.Element;
39
- type CommonContentPopupProps = Pick<LegacyPopupProps, 'boundary' | 'offset' | 'onClose' | 'testId' | 'placement' | 'fallbackPlacements' | 'popupComponent' | 'shouldFlip' | 'rootBoundary' | 'autoFocus' | 'shouldRenderToParent' | 'shouldUseCaptureOnOutsideClick' | 'shouldDisableFocusLock' | 'strategy' | 'zIndex'> & {
39
+ type CommonContentPopupProps = Pick<LegacyPopupProps, 'boundary' | 'offset' | 'onClose' | 'testId' | 'placement' | 'fallbackPlacements' | 'popupComponent' | 'shouldFlip' | 'rootBoundary' | 'autoFocus' | 'shouldRenderToParent' | 'shouldUseCaptureOnOutsideClick' | 'shouldDisableFocusLock' | 'strategy' | 'zIndex' | 'shouldFitViewport'> & {
40
40
  children: (props: ContentProps) => React.ReactNode;
41
41
  };
42
42
  type ShouldFitContainerContentPopupProps = CommonContentPopupProps & {
@@ -55,5 +55,5 @@ export type PopupContentProps = ShouldFitContainerContentPopupProps | StandardPo
55
55
  *
56
56
  * It must be a child of the Popup component.
57
57
  */
58
- export declare const PopupContent: ({ children, boundary, offset, strategy, onClose, testId, rootBoundary, shouldFlip, placement, fallbackPlacements, popupComponent, autoFocus, zIndex, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldDisableFocusLock, shouldFitContainer, }: PopupContentProps) => JSX.Element | null;
58
+ export declare const PopupContent: ({ children, boundary, offset, strategy, onClose, testId, rootBoundary, shouldFlip, placement, fallbackPlacements, popupComponent, autoFocus, zIndex, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldDisableFocusLock, shouldFitContainer, shouldFitViewport, }: PopupContentProps) => JSX.Element | null;
59
59
  export {};
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { type PopperWrapperProps } from './types';
3
- declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, shouldReturnFocus, strategy, role, label, titleId, modifiers, }: 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, shouldFitContainer, shouldDisableFocusLock, shouldReturnFocus, strategy, role, label, titleId, modifiers, shouldFitViewport, }: PopperWrapperProps): jsx.JSX.Element;
4
4
  export default PopperWrapper;
@@ -5,6 +5,7 @@ export interface TriggerProps {
5
5
  'aria-controls'?: string;
6
6
  'aria-expanded': boolean;
7
7
  'aria-haspopup': boolean | 'dialog';
8
+ 'data-ds--level'?: string;
8
9
  }
9
10
  export type PopupRef = HTMLDivElement | null;
10
11
  export type TriggerRef = HTMLElement | HTMLButtonElement | null;
@@ -136,7 +137,7 @@ interface BaseProps {
136
137
  * This happens either when clicking away from the popup or pressing the escape key.
137
138
  * You'll want to use this to set open state accordingly, and then pump it back into the `isOpen` prop.
138
139
  */
139
- onClose?(event: Event | React.MouseEvent | React.KeyboardEvent): void;
140
+ onClose?(event: Event | React.MouseEvent | React.KeyboardEvent, currentLevel?: number | any): void;
140
141
  /**
141
142
  * The element that is shown when `isOpen` prop is `true`.
142
143
  * The result of the `content` prop will be placed as children here.
@@ -202,6 +203,11 @@ interface BaseProps {
202
203
  * for more details - https://popper.js.org/docs/v1/#modifiers
203
204
  */
204
205
  modifiers?: Partial<Modifier<string, object>>[];
206
+ /**
207
+ * Determines if the popup will have a `max-width` and `max-height` set to
208
+ * constrain it to the viewport.
209
+ */
210
+ shouldFitViewport?: boolean;
205
211
  }
206
212
  interface InternalPopupProps extends BaseProps {
207
213
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "1.24.2",
3
+ "version": "1.25.0",
4
4
  "description": "A popup displays brief content in an overlay.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/ds-lib": "^2.5.0",
40
40
  "@atlaskit/layering": "^0.4.0",
41
41
  "@atlaskit/platform-feature-flags": "^0.3.0",
42
- "@atlaskit/popper": "^6.2.0",
42
+ "@atlaskit/popper": "^6.3.0",
43
43
  "@atlaskit/portal": "^4.9.0",
44
44
  "@atlaskit/primitives": "^12.1.0",
45
45
  "@atlaskit/theme": "^13.0.0",
@@ -60,10 +60,10 @@
60
60
  "@af/integration-testing": "*",
61
61
  "@af/visual-regression": "*",
62
62
  "@atlaskit/button": "^20.1.0",
63
- "@atlaskit/icon": "^22.15.0",
63
+ "@atlaskit/icon": "^22.16.0",
64
64
  "@atlaskit/ssr": "*",
65
65
  "@atlaskit/textfield": "^6.5.0",
66
- "@atlaskit/toggle": "^13.3.0",
66
+ "@atlaskit/toggle": "^13.4.0",
67
67
  "@atlaskit/visual-regression": "*",
68
68
  "@atlassian/feature-flags-test-utils": "*",
69
69
  "@testing-library/dom": "^10.1.0",
@@ -108,6 +108,12 @@
108
108
  },
109
109
  "platform-design-system-dsp-20476-dropdown-menu": {
110
110
  "type": "boolean"
111
+ },
112
+ "design-system-closed-all-when-click-outside": {
113
+ "type": "boolean"
114
+ },
115
+ "sibling-dropdown-close-issue": {
116
+ "type": "boolean"
111
117
  }
112
118
  },
113
119
  "homepage": "https://atlassian.design/components/popup/"