@atlaskit/popup 1.17.1 → 1.18.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +446 -431
  2. package/__perf__/closed.tsx +30 -30
  3. package/__perf__/default.tsx +19 -19
  4. package/__perf__/open.tsx +19 -23
  5. package/__perf__/popup.tsx +26 -26
  6. package/__perf__/utils/interaction-tasks.tsx +37 -50
  7. package/codemods/1.0.0-lite-mode.tsx +150 -182
  8. package/codemods/__tests__/1.0.0-lite-mode.tsx +88 -88
  9. package/codemods/utils/helpers.tsx +253 -263
  10. package/dist/cjs/popper-wrapper.js +15 -6
  11. package/dist/cjs/popup.js +17 -4
  12. package/dist/es2019/popper-wrapper.js +15 -5
  13. package/dist/es2019/popup.js +16 -4
  14. package/dist/esm/popper-wrapper.js +16 -6
  15. package/dist/esm/popup.js +17 -4
  16. package/dist/types/compositional/popup.d.ts +1 -1
  17. package/dist/types/entry-points/experimental/compositional.d.ts +1 -1
  18. package/dist/types/index.d.ts +1 -1
  19. package/dist/types/popper-wrapper.d.ts +2 -2
  20. package/dist/types/reposition-on-update.d.ts +2 -2
  21. package/dist/types/types.d.ts +26 -3
  22. package/dist/types/use-focus-manager.d.ts +1 -1
  23. package/dist/types/use-get-memoized-merged-trigger-ref.d.ts +1 -1
  24. package/dist/types-ts4.5/compositional/popup.d.ts +1 -1
  25. package/dist/types-ts4.5/entry-points/experimental/compositional.d.ts +1 -1
  26. package/dist/types-ts4.5/index.d.ts +1 -1
  27. package/dist/types-ts4.5/popper-wrapper.d.ts +2 -2
  28. package/dist/types-ts4.5/reposition-on-update.d.ts +2 -2
  29. package/dist/types-ts4.5/types.d.ts +26 -3
  30. package/dist/types-ts4.5/use-focus-manager.d.ts +1 -1
  31. package/dist/types-ts4.5/use-get-memoized-merged-trigger-ref.d.ts +1 -1
  32. package/package.json +117 -118
  33. package/report.api.md +41 -40
package/dist/cjs/popup.js CHANGED
@@ -12,6 +12,7 @@ var _reactUid = require("react-uid");
12
12
  var _layering = require("@atlaskit/layering");
13
13
  var _popper = require("@atlaskit/popper");
14
14
  var _portal = _interopRequireDefault(require("@atlaskit/portal"));
15
+ var _primitives = require("@atlaskit/primitives");
15
16
  var _constants = require("@atlaskit/theme/constants");
16
17
  var _popperWrapper = _interopRequireDefault(require("./popper-wrapper"));
17
18
  var _useGetMemoizedMergedTriggerRef = require("./use-get-memoized-merged-trigger-ref");
@@ -19,6 +20,9 @@ var _useGetMemoizedMergedTriggerRef = require("./use-get-memoized-merged-trigger
19
20
  /** @jsx jsx */
20
21
 
21
22
  var defaultLayer = _constants.layers.layer();
23
+ var wrapperStyles = (0, _primitives.xcss)({
24
+ position: 'relative'
25
+ });
22
26
  var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
23
27
  var isOpen = _ref.isOpen,
24
28
  providedId = _ref.id,
@@ -44,6 +48,8 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
44
48
  shouldUseCaptureOnOutsideClick = _ref$shouldUseCapture === void 0 ? false : _ref$shouldUseCapture,
45
49
  _ref$shouldRenderToPa = _ref.shouldRenderToParent,
46
50
  shouldRenderToParent = _ref$shouldRenderToPa === void 0 ? false : _ref$shouldRenderToPa,
51
+ _ref$shouldFitContain = _ref.shouldFitContainer,
52
+ shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
47
53
  _ref$shouldDisableFoc = _ref.shouldDisableFocusLock,
48
54
  shouldDisableFocusLock = _ref$shouldDisableFoc === void 0 ? false : _ref$shouldDisableFoc,
49
55
  strategy = _ref.strategy,
@@ -74,15 +80,16 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
74
80
  onClose: onClose,
75
81
  autoFocus: autoFocus,
76
82
  shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick,
77
- shouldRenderToParent: shouldRenderToParent,
83
+ shouldRenderToParent: shouldRenderToParent || shouldFitContainer,
84
+ shouldFitContainer: shouldFitContainer,
78
85
  shouldDisableFocusLock: shouldDisableFocusLock,
79
86
  triggerRef: triggerRef,
80
- strategy: strategy,
87
+ strategy: shouldFitContainer ? 'absolute' : strategy,
81
88
  role: role,
82
89
  label: label,
83
90
  titleId: titleId
84
91
  }));
85
- return (0, _react2.jsx)(_popper.Manager, null, (0, _react2.jsx)(_popper.Reference, null, function (_ref2) {
92
+ var popupContent = (0, _react2.jsx)(_popper.Manager, null, (0, _react2.jsx)(_popper.Reference, null, function (_ref2) {
86
93
  var ref = _ref2.ref;
87
94
  return trigger({
88
95
  ref: getMergedTriggerRef(ref, setTriggerRef, isOpen),
@@ -90,8 +97,14 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
90
97
  'aria-expanded': isOpen,
91
98
  'aria-haspopup': true
92
99
  });
93
- }), isOpen && (shouldRenderToParent ? renderPopperWrapper : (0, _react2.jsx)(_portal.default, {
100
+ }), isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper : (0, _react2.jsx)(_portal.default, {
94
101
  zIndex: zIndex
95
102
  }, renderPopperWrapper)));
103
+ if (shouldFitContainer) {
104
+ return (0, _react2.jsx)(_primitives.Box, {
105
+ xcss: wrapperStyles
106
+ }, popupContent);
107
+ }
108
+ return popupContent;
96
109
  });
97
110
  var _default = exports.default = Popup;
@@ -1,6 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
3
  import { forwardRef, useMemo, useState } from 'react';
4
+
5
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles -- Ignored via go/DSP-18766
4
6
  import { css, Global, jsx } from '@emotion/react';
5
7
  import { UNSAFE_useLayering } from '@atlaskit/layering';
6
8
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -11,6 +13,9 @@ import { CURRENT_SURFACE_CSS_VAR } from '@atlaskit/tokens';
11
13
  import { RepositionOnUpdate } from './reposition-on-update';
12
14
  import { useCloseManager } from './use-close-manager';
13
15
  import { useFocusManager } from './use-focus-manager';
16
+ const popupFullWidthStyles = css({
17
+ width: '100%'
18
+ });
14
19
  const popupStyles = css({
15
20
  display: 'block',
16
21
  boxSizing: 'border-box',
@@ -20,7 +25,7 @@ const popupStyles = css({
20
25
  borderRadius: "var(--ds-border-radius, 3px)",
21
26
  boxShadow: `var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})`,
22
27
  [CURRENT_SURFACE_CSS_VAR]: `var(--ds-surface-overlay, ${N0})`,
23
- ':focus': {
28
+ '&:focus': {
24
29
  outline: 'none'
25
30
  }
26
31
  });
@@ -31,7 +36,7 @@ const popupOverflowStyles = css({
31
36
  // disables iframe pointer events while popup is open, except if iframe is nested inside popup
32
37
  // solves an issue of popup not being closed on iframe click
33
38
  const blockPointerEventsOnExternalIframeStyles = css({
34
- // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
39
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
35
40
  'iframe:not([data-ds--level] iframe)': {
36
41
  pointerEvents: 'none'
37
42
  }
@@ -39,11 +44,12 @@ const blockPointerEventsOnExternalIframeStyles = css({
39
44
  const DefaultPopupComponent = /*#__PURE__*/forwardRef((props, ref) => {
40
45
  const {
41
46
  shouldRenderToParent,
47
+ shouldFitContainer,
42
48
  children,
43
49
  ...htmlAttributes
44
50
  } = props;
45
51
  return jsx("div", _extends({
46
- css: [popupStyles, !shouldRenderToParent && popupOverflowStyles]
52
+ css: [popupStyles, !shouldRenderToParent && popupOverflowStyles, shouldFitContainer && popupFullWidthStyles]
47
53
  }, htmlAttributes, {
48
54
  ref: ref
49
55
  }), children);
@@ -65,6 +71,7 @@ function PopperWrapper({
65
71
  triggerRef,
66
72
  shouldUseCaptureOnOutsideClick,
67
73
  shouldRenderToParent,
74
+ shouldFitContainer,
68
75
  shouldDisableFocusLock,
69
76
  strategy,
70
77
  role,
@@ -130,13 +137,16 @@ function PopperWrapper({
130
137
  }
131
138
  setPopupRef(node);
132
139
  }
133
- },
140
+ }
141
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
142
+ ,
134
143
  style: style
135
144
  // using tabIndex={-1} would cause a bug where Safari focuses
136
145
  // first on the browser address bar when using keyboard
137
146
  ,
138
147
  tabIndex: autoFocus ? 0 : undefined,
139
- shouldRenderToParent: shouldRenderToParent
148
+ shouldRenderToParent: shouldRenderToParent,
149
+ shouldFitContainer: shouldFitContainer
140
150
  }, getBooleanFF('platform.design-system-team.iframe_gojiv') && jsx(Global, {
141
151
  styles: blockPointerEventsOnExternalIframeStyles
142
152
  }), jsx(RepositionOnUpdate, {
@@ -6,10 +6,14 @@ import { useUID } from 'react-uid';
6
6
  import { UNSAFE_LAYERING } from '@atlaskit/layering';
7
7
  import { Manager, Reference } from '@atlaskit/popper';
8
8
  import Portal from '@atlaskit/portal';
9
+ import { Box, xcss } from '@atlaskit/primitives';
9
10
  import { layers } from '@atlaskit/theme/constants';
10
11
  import PopperWrapper from './popper-wrapper';
11
12
  import { useGetMemoizedMergedTriggerRef } from './use-get-memoized-merged-trigger-ref';
12
13
  const defaultLayer = layers.layer();
14
+ const wrapperStyles = xcss({
15
+ position: 'relative'
16
+ });
13
17
  export const Popup = /*#__PURE__*/memo(({
14
18
  isOpen,
15
19
  id: providedId,
@@ -28,6 +32,7 @@ export const Popup = /*#__PURE__*/memo(({
28
32
  zIndex = defaultLayer,
29
33
  shouldUseCaptureOnOutsideClick = false,
30
34
  shouldRenderToParent = false,
35
+ shouldFitContainer = false,
31
36
  shouldDisableFocusLock = false,
32
37
  strategy,
33
38
  role,
@@ -55,15 +60,16 @@ export const Popup = /*#__PURE__*/memo(({
55
60
  onClose: onClose,
56
61
  autoFocus: autoFocus,
57
62
  shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick,
58
- shouldRenderToParent: shouldRenderToParent,
63
+ shouldRenderToParent: shouldRenderToParent || shouldFitContainer,
64
+ shouldFitContainer: shouldFitContainer,
59
65
  shouldDisableFocusLock: shouldDisableFocusLock,
60
66
  triggerRef: triggerRef,
61
- strategy: strategy,
67
+ strategy: shouldFitContainer ? 'absolute' : strategy,
62
68
  role: role,
63
69
  label: label,
64
70
  titleId: titleId
65
71
  }));
66
- return jsx(Manager, null, jsx(Reference, null, ({
72
+ const popupContent = jsx(Manager, null, jsx(Reference, null, ({
67
73
  ref
68
74
  }) => {
69
75
  return trigger({
@@ -72,8 +78,14 @@ export const Popup = /*#__PURE__*/memo(({
72
78
  'aria-expanded': isOpen,
73
79
  'aria-haspopup': true
74
80
  });
75
- }), isOpen && (shouldRenderToParent ? renderPopperWrapper : jsx(Portal, {
81
+ }), isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper : jsx(Portal, {
76
82
  zIndex: zIndex
77
83
  }, renderPopperWrapper)));
84
+ if (shouldFitContainer) {
85
+ return jsx(Box, {
86
+ xcss: wrapperStyles
87
+ }, popupContent);
88
+ }
89
+ return popupContent;
78
90
  });
79
91
  export default Popup;
@@ -2,10 +2,12 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- var _excluded = ["shouldRenderToParent", "children"];
5
+ var _excluded = ["shouldRenderToParent", "shouldFitContainer", "children"];
6
6
  var _css;
7
7
  /** @jsx jsx */
8
8
  import { forwardRef, useMemo, useState } from 'react';
9
+
10
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles -- Ignored via go/DSP-18766
9
11
  import { css, Global, jsx } from '@emotion/react';
10
12
  import { UNSAFE_useLayering } from '@atlaskit/layering';
11
13
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -16,6 +18,9 @@ import { CURRENT_SURFACE_CSS_VAR } from '@atlaskit/tokens';
16
18
  import { RepositionOnUpdate } from './reposition-on-update';
17
19
  import { useCloseManager } from './use-close-manager';
18
20
  import { useFocusManager } from './use-focus-manager';
21
+ var popupFullWidthStyles = css({
22
+ width: '100%'
23
+ });
19
24
  var popupStyles = css((_css = {
20
25
  display: 'block',
21
26
  boxSizing: 'border-box',
@@ -24,7 +29,7 @@ var popupStyles = css((_css = {
24
29
  backgroundColor: "var(--ds-surface-overlay, ".concat(N0, ")"),
25
30
  borderRadius: "var(--ds-border-radius, 3px)",
26
31
  boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N50A, ", 0 0 1px ").concat(N60A), ")")
27
- }, _defineProperty(_css, CURRENT_SURFACE_CSS_VAR, "var(--ds-surface-overlay, ".concat(N0, ")")), _defineProperty(_css, ':focus', {
32
+ }, _defineProperty(_css, CURRENT_SURFACE_CSS_VAR, "var(--ds-surface-overlay, ".concat(N0, ")")), _defineProperty(_css, '&:focus', {
28
33
  outline: 'none'
29
34
  }), _css));
30
35
  var popupOverflowStyles = css({
@@ -34,17 +39,18 @@ var popupOverflowStyles = css({
34
39
  // disables iframe pointer events while popup is open, except if iframe is nested inside popup
35
40
  // solves an issue of popup not being closed on iframe click
36
41
  var blockPointerEventsOnExternalIframeStyles = css({
37
- // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
42
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
38
43
  'iframe:not([data-ds--level] iframe)': {
39
44
  pointerEvents: 'none'
40
45
  }
41
46
  });
42
47
  var DefaultPopupComponent = /*#__PURE__*/forwardRef(function (props, ref) {
43
48
  var shouldRenderToParent = props.shouldRenderToParent,
49
+ shouldFitContainer = props.shouldFitContainer,
44
50
  children = props.children,
45
51
  htmlAttributes = _objectWithoutProperties(props, _excluded);
46
52
  return jsx("div", _extends({
47
- css: [popupStyles, !shouldRenderToParent && popupOverflowStyles]
53
+ css: [popupStyles, !shouldRenderToParent && popupOverflowStyles, shouldFitContainer && popupFullWidthStyles]
48
54
  }, htmlAttributes, {
49
55
  ref: ref
50
56
  }), children);
@@ -69,6 +75,7 @@ function PopperWrapper(_ref) {
69
75
  triggerRef = _ref.triggerRef,
70
76
  shouldUseCaptureOnOutsideClick = _ref.shouldUseCaptureOnOutsideClick,
71
77
  shouldRenderToParent = _ref.shouldRenderToParent,
78
+ shouldFitContainer = _ref.shouldFitContainer,
72
79
  shouldDisableFocusLock = _ref.shouldDisableFocusLock,
73
80
  strategy = _ref.strategy,
74
81
  role = _ref.role,
@@ -139,13 +146,16 @@ function PopperWrapper(_ref) {
139
146
  }
140
147
  setPopupRef(node);
141
148
  }
142
- },
149
+ }
150
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
151
+ ,
143
152
  style: style
144
153
  // using tabIndex={-1} would cause a bug where Safari focuses
145
154
  // first on the browser address bar when using keyboard
146
155
  ,
147
156
  tabIndex: autoFocus ? 0 : undefined,
148
- shouldRenderToParent: shouldRenderToParent
157
+ shouldRenderToParent: shouldRenderToParent,
158
+ shouldFitContainer: shouldFitContainer
149
159
  }, getBooleanFF('platform.design-system-team.iframe_gojiv') && jsx(Global, {
150
160
  styles: blockPointerEventsOnExternalIframeStyles
151
161
  }), jsx(RepositionOnUpdate, {
package/dist/esm/popup.js CHANGED
@@ -7,10 +7,14 @@ import { useUID } from 'react-uid';
7
7
  import { UNSAFE_LAYERING } from '@atlaskit/layering';
8
8
  import { Manager, Reference } from '@atlaskit/popper';
9
9
  import Portal from '@atlaskit/portal';
10
+ import { Box, xcss } from '@atlaskit/primitives';
10
11
  import { layers } from '@atlaskit/theme/constants';
11
12
  import PopperWrapper from './popper-wrapper';
12
13
  import { useGetMemoizedMergedTriggerRef } from './use-get-memoized-merged-trigger-ref';
13
14
  var defaultLayer = layers.layer();
15
+ var wrapperStyles = xcss({
16
+ position: 'relative'
17
+ });
14
18
  export var Popup = /*#__PURE__*/memo(function (_ref) {
15
19
  var isOpen = _ref.isOpen,
16
20
  providedId = _ref.id,
@@ -36,6 +40,8 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
36
40
  shouldUseCaptureOnOutsideClick = _ref$shouldUseCapture === void 0 ? false : _ref$shouldUseCapture,
37
41
  _ref$shouldRenderToPa = _ref.shouldRenderToParent,
38
42
  shouldRenderToParent = _ref$shouldRenderToPa === void 0 ? false : _ref$shouldRenderToPa,
43
+ _ref$shouldFitContain = _ref.shouldFitContainer,
44
+ shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
39
45
  _ref$shouldDisableFoc = _ref.shouldDisableFocusLock,
40
46
  shouldDisableFocusLock = _ref$shouldDisableFoc === void 0 ? false : _ref$shouldDisableFoc,
41
47
  strategy = _ref.strategy,
@@ -66,15 +72,16 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
66
72
  onClose: onClose,
67
73
  autoFocus: autoFocus,
68
74
  shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick,
69
- shouldRenderToParent: shouldRenderToParent,
75
+ shouldRenderToParent: shouldRenderToParent || shouldFitContainer,
76
+ shouldFitContainer: shouldFitContainer,
70
77
  shouldDisableFocusLock: shouldDisableFocusLock,
71
78
  triggerRef: triggerRef,
72
- strategy: strategy,
79
+ strategy: shouldFitContainer ? 'absolute' : strategy,
73
80
  role: role,
74
81
  label: label,
75
82
  titleId: titleId
76
83
  }));
77
- return jsx(Manager, null, jsx(Reference, null, function (_ref2) {
84
+ var popupContent = jsx(Manager, null, jsx(Reference, null, function (_ref2) {
78
85
  var ref = _ref2.ref;
79
86
  return trigger({
80
87
  ref: getMergedTriggerRef(ref, setTriggerRef, isOpen),
@@ -82,8 +89,14 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
82
89
  'aria-expanded': isOpen,
83
90
  'aria-haspopup': true
84
91
  });
85
- }), isOpen && (shouldRenderToParent ? renderPopperWrapper : jsx(Portal, {
92
+ }), isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper : jsx(Portal, {
86
93
  zIndex: zIndex
87
94
  }, renderPopperWrapper)));
95
+ if (shouldFitContainer) {
96
+ return jsx(Box, {
97
+ xcss: wrapperStyles
98
+ }, popupContent);
99
+ }
100
+ return popupContent;
88
101
  });
89
102
  export default Popup;
@@ -24,7 +24,7 @@ export type PopupProps = {
24
24
  * </Popup>
25
25
  * ```
26
26
  */
27
- export declare const Popup: ({ children, id: providedId, isOpen, }: PopupProps) => JSX.Element;
27
+ export declare const Popup: ({ children, id: providedId, isOpen }: PopupProps) => JSX.Element;
28
28
  export type PopupTriggerProps = {
29
29
  children: (props: TriggerProps) => React.ReactNode;
30
30
  };
@@ -1,2 +1,2 @@
1
1
  export { Popup, PopupContent, PopupTrigger } from '../../compositional/popup';
2
- export type { PopupProps, PopupContentProps, PopupTriggerProps, } from '../../compositional/popup';
2
+ export type { PopupProps, PopupContentProps, PopupTriggerProps } from '../../compositional/popup';
@@ -1,4 +1,4 @@
1
1
  import { Popup } from './popup';
2
- export type { ContentProps, PopupComponentProps, PopupProps, TriggerProps, } from './types';
2
+ export type { ContentProps, PopupComponentProps, PopupProps, TriggerProps } from './types';
3
3
  export { Popup };
4
4
  export default Popup;
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
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, strategy, role, label, titleId, }: PopperWrapperProps): jsx.JSX.Element;
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, strategy, role, label, titleId, }: PopperWrapperProps): jsx.JSX.Element;
4
4
  export default PopperWrapper;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { RepositionOnUpdateProps } from './types';
3
- export declare const RepositionOnUpdate: ({ children, update, }: RepositionOnUpdateProps) => JSX.Element;
2
+ import { type RepositionOnUpdateProps } from './types';
3
+ export declare const RepositionOnUpdate: ({ children, update }: RepositionOnUpdateProps) => JSX.Element;
@@ -1,5 +1,5 @@
1
- import React, { ComponentType, CSSProperties, Dispatch, PropsWithChildren, ReactNode, Ref, SetStateAction } from 'react';
2
- import { Placement, PopperChildrenProps } from '@atlaskit/popper';
1
+ import { type ComponentType, type CSSProperties, type Dispatch, type PropsWithChildren, type default as React, type ReactNode, type Ref, type SetStateAction } from 'react';
2
+ import { type Placement, type PopperChildrenProps } from '@atlaskit/popper';
3
3
  export interface TriggerProps {
4
4
  ref: Ref<any>;
5
5
  'aria-controls'?: string;
@@ -61,6 +61,13 @@ export interface PopupComponentProps {
61
61
  * The default is `false`.
62
62
  */
63
63
  shouldRenderToParent?: boolean;
64
+ /**
65
+ * This fits the popup width to its parent's width.
66
+ * When set to `true`, the trigger and popup elements will be wrapped in a `div` with `position: relative`.
67
+ * The popup will be rendered as a sibling to the trigger element, and will be full width.
68
+ * The default is `false`.
69
+ */
70
+ shouldFitContainer?: boolean;
64
71
  /**
65
72
  * Use this to set the accessibility role for the popup.
66
73
  * We strongly recommend using only `menu` or `dialog`.
@@ -149,6 +156,13 @@ interface BaseProps {
149
156
  * Defaults to `false`.
150
157
  */
151
158
  shouldRenderToParent?: boolean;
159
+ /**
160
+ * This fits the popup width to its parent's width.
161
+ * When set to `true`, the trigger and popup elements will be wrapped in a `div` with `position: relative`.
162
+ * The popup will be rendered as a sibling to the trigger element, and will be full width.
163
+ * The default is `false`.
164
+ */
165
+ shouldFitContainer?: boolean;
152
166
  /**
153
167
  * This allows the popup disable focus lock. It will only work when `shouldRenderToParent` is `true`.
154
168
  * The default is `false`.
@@ -176,7 +190,7 @@ interface BaseProps {
176
190
  */
177
191
  titleId?: string;
178
192
  }
179
- export interface PopupProps extends BaseProps {
193
+ interface InternalPopupProps extends BaseProps {
180
194
  /**
181
195
  * Render props used to anchor the popup to your content.
182
196
  * Make this an interactive element,
@@ -190,6 +204,15 @@ export interface PopupProps extends BaseProps {
190
204
  */
191
205
  zIndex?: number;
192
206
  }
207
+ type StandardPopupProps = InternalPopupProps & {
208
+ shouldFitContainer?: false;
209
+ };
210
+ type ShouldFitContainerPopupProps = InternalPopupProps & {
211
+ shouldFitContainer: true;
212
+ shouldRenderToParent?: true;
213
+ strategy?: 'absolute';
214
+ };
215
+ export type PopupProps = StandardPopupProps | ShouldFitContainerPopupProps;
193
216
  export interface PopperWrapperProps extends BaseProps {
194
217
  triggerRef: TriggerRef;
195
218
  }
@@ -1,2 +1,2 @@
1
- import { FocusManagerHook } from './types';
1
+ import { type FocusManagerHook } from './types';
2
2
  export declare const useFocusManager: ({ initialFocusRef, popupRef, shouldCloseOnTab, }: FocusManagerHook) => void;
@@ -1,2 +1,2 @@
1
- import { Dispatch, SetStateAction } from 'react';
1
+ import { type Dispatch, type SetStateAction } from 'react';
2
2
  export declare const useGetMemoizedMergedTriggerRef: () => import("memoize-one").MemoizedFn<(ref: React.RefCallback<HTMLElement> | React.MutableRefObject<HTMLElement> | null, setTriggerRef: Dispatch<SetStateAction<HTMLElement | null>>, isOpen: boolean) => (node: HTMLElement | null) => void>;
@@ -24,7 +24,7 @@ export type PopupProps = {
24
24
  * </Popup>
25
25
  * ```
26
26
  */
27
- export declare const Popup: ({ children, id: providedId, isOpen, }: PopupProps) => JSX.Element;
27
+ export declare const Popup: ({ children, id: providedId, isOpen }: PopupProps) => JSX.Element;
28
28
  export type PopupTriggerProps = {
29
29
  children: (props: TriggerProps) => React.ReactNode;
30
30
  };
@@ -1,2 +1,2 @@
1
1
  export { Popup, PopupContent, PopupTrigger } from '../../compositional/popup';
2
- export type { PopupProps, PopupContentProps, PopupTriggerProps, } from '../../compositional/popup';
2
+ export type { PopupProps, PopupContentProps, PopupTriggerProps } from '../../compositional/popup';
@@ -1,4 +1,4 @@
1
1
  import { Popup } from './popup';
2
- export type { ContentProps, PopupComponentProps, PopupProps, TriggerProps, } from './types';
2
+ export type { ContentProps, PopupComponentProps, PopupProps, TriggerProps } from './types';
3
3
  export { Popup };
4
4
  export default Popup;
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
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, strategy, role, label, titleId, }: PopperWrapperProps): jsx.JSX.Element;
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, strategy, role, label, titleId, }: PopperWrapperProps): jsx.JSX.Element;
4
4
  export default PopperWrapper;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { RepositionOnUpdateProps } from './types';
3
- export declare const RepositionOnUpdate: ({ children, update, }: RepositionOnUpdateProps) => JSX.Element;
2
+ import { type RepositionOnUpdateProps } from './types';
3
+ export declare const RepositionOnUpdate: ({ children, update }: RepositionOnUpdateProps) => JSX.Element;
@@ -1,5 +1,5 @@
1
- import React, { ComponentType, CSSProperties, Dispatch, PropsWithChildren, ReactNode, Ref, SetStateAction } from 'react';
2
- import { Placement, PopperChildrenProps } from '@atlaskit/popper';
1
+ import { type ComponentType, type CSSProperties, type Dispatch, type PropsWithChildren, type default as React, type ReactNode, type Ref, type SetStateAction } from 'react';
2
+ import { type Placement, type PopperChildrenProps } from '@atlaskit/popper';
3
3
  export interface TriggerProps {
4
4
  ref: Ref<any>;
5
5
  'aria-controls'?: string;
@@ -61,6 +61,13 @@ export interface PopupComponentProps {
61
61
  * The default is `false`.
62
62
  */
63
63
  shouldRenderToParent?: boolean;
64
+ /**
65
+ * This fits the popup width to its parent's width.
66
+ * When set to `true`, the trigger and popup elements will be wrapped in a `div` with `position: relative`.
67
+ * The popup will be rendered as a sibling to the trigger element, and will be full width.
68
+ * The default is `false`.
69
+ */
70
+ shouldFitContainer?: boolean;
64
71
  /**
65
72
  * Use this to set the accessibility role for the popup.
66
73
  * We strongly recommend using only `menu` or `dialog`.
@@ -152,6 +159,13 @@ interface BaseProps {
152
159
  * Defaults to `false`.
153
160
  */
154
161
  shouldRenderToParent?: boolean;
162
+ /**
163
+ * This fits the popup width to its parent's width.
164
+ * When set to `true`, the trigger and popup elements will be wrapped in a `div` with `position: relative`.
165
+ * The popup will be rendered as a sibling to the trigger element, and will be full width.
166
+ * The default is `false`.
167
+ */
168
+ shouldFitContainer?: boolean;
155
169
  /**
156
170
  * This allows the popup disable focus lock. It will only work when `shouldRenderToParent` is `true`.
157
171
  * The default is `false`.
@@ -179,7 +193,7 @@ interface BaseProps {
179
193
  */
180
194
  titleId?: string;
181
195
  }
182
- export interface PopupProps extends BaseProps {
196
+ interface InternalPopupProps extends BaseProps {
183
197
  /**
184
198
  * Render props used to anchor the popup to your content.
185
199
  * Make this an interactive element,
@@ -193,6 +207,15 @@ export interface PopupProps extends BaseProps {
193
207
  */
194
208
  zIndex?: number;
195
209
  }
210
+ type StandardPopupProps = InternalPopupProps & {
211
+ shouldFitContainer?: false;
212
+ };
213
+ type ShouldFitContainerPopupProps = InternalPopupProps & {
214
+ shouldFitContainer: true;
215
+ shouldRenderToParent?: true;
216
+ strategy?: 'absolute';
217
+ };
218
+ export type PopupProps = StandardPopupProps | ShouldFitContainerPopupProps;
196
219
  export interface PopperWrapperProps extends BaseProps {
197
220
  triggerRef: TriggerRef;
198
221
  }
@@ -1,2 +1,2 @@
1
- import { FocusManagerHook } from './types';
1
+ import { type FocusManagerHook } from './types';
2
2
  export declare const useFocusManager: ({ initialFocusRef, popupRef, shouldCloseOnTab, }: FocusManagerHook) => void;
@@ -1,2 +1,2 @@
1
- import { Dispatch, SetStateAction } from 'react';
1
+ import { type Dispatch, type SetStateAction } from 'react';
2
2
  export declare const useGetMemoizedMergedTriggerRef: () => import("memoize-one").MemoizedFn<(ref: React.RefCallback<HTMLElement> | React.MutableRefObject<HTMLElement> | null, setTriggerRef: Dispatch<SetStateAction<HTMLElement | null>>, isOpen: boolean) => (node: HTMLElement | null) => void>;