@atlaskit/popup 1.17.2 → 1.19.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/dist/cjs/popup.js CHANGED
@@ -12,13 +12,22 @@ 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");
18
19
  /* eslint-disable @repo/internal/react/require-jsdoc */
20
+ /**
21
+ * @jsxRuntime classic
22
+ */
19
23
  /** @jsx jsx */
20
24
 
25
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
+
21
27
  var defaultLayer = _constants.layers.layer();
28
+ var wrapperStyles = (0, _primitives.xcss)({
29
+ position: 'relative'
30
+ });
22
31
  var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
23
32
  var isOpen = _ref.isOpen,
24
33
  providedId = _ref.id,
@@ -44,6 +53,8 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
44
53
  shouldUseCaptureOnOutsideClick = _ref$shouldUseCapture === void 0 ? false : _ref$shouldUseCapture,
45
54
  _ref$shouldRenderToPa = _ref.shouldRenderToParent,
46
55
  shouldRenderToParent = _ref$shouldRenderToPa === void 0 ? false : _ref$shouldRenderToPa,
56
+ _ref$shouldFitContain = _ref.shouldFitContainer,
57
+ shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
47
58
  _ref$shouldDisableFoc = _ref.shouldDisableFocusLock,
48
59
  shouldDisableFocusLock = _ref$shouldDisableFoc === void 0 ? false : _ref$shouldDisableFoc,
49
60
  strategy = _ref.strategy,
@@ -74,15 +85,16 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
74
85
  onClose: onClose,
75
86
  autoFocus: autoFocus,
76
87
  shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick,
77
- shouldRenderToParent: shouldRenderToParent,
88
+ shouldRenderToParent: shouldRenderToParent || shouldFitContainer,
89
+ shouldFitContainer: shouldFitContainer,
78
90
  shouldDisableFocusLock: shouldDisableFocusLock,
79
91
  triggerRef: triggerRef,
80
- strategy: strategy,
92
+ strategy: shouldFitContainer ? 'absolute' : strategy,
81
93
  role: role,
82
94
  label: label,
83
95
  titleId: titleId
84
96
  }));
85
- return (0, _react2.jsx)(_popper.Manager, null, (0, _react2.jsx)(_popper.Reference, null, function (_ref2) {
97
+ var popupContent = (0, _react2.jsx)(_popper.Manager, null, (0, _react2.jsx)(_popper.Reference, null, function (_ref2) {
86
98
  var ref = _ref2.ref;
87
99
  return trigger({
88
100
  ref: getMergedTriggerRef(ref, setTriggerRef, isOpen),
@@ -90,8 +102,14 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
90
102
  'aria-expanded': isOpen,
91
103
  'aria-haspopup': true
92
104
  });
93
- }), isOpen && (shouldRenderToParent ? renderPopperWrapper : (0, _react2.jsx)(_portal.default, {
105
+ }), isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper : (0, _react2.jsx)(_portal.default, {
94
106
  zIndex: zIndex
95
107
  }, renderPopperWrapper)));
108
+ if (shouldFitContainer) {
109
+ return (0, _react2.jsx)(_primitives.Box, {
110
+ xcss: wrapperStyles
111
+ }, popupContent);
112
+ }
113
+ return popupContent;
96
114
  });
97
115
  var _default = exports.default = Popup;
@@ -1,6 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ /**
3
+ * @jsxRuntime classic
4
+ */
2
5
  /** @jsx jsx */
3
6
  import { forwardRef, useMemo, useState } from 'react';
7
+
8
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
4
9
  import { css, Global, jsx } from '@emotion/react';
5
10
  import { UNSAFE_useLayering } from '@atlaskit/layering';
6
11
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -11,6 +16,9 @@ import { CURRENT_SURFACE_CSS_VAR } from '@atlaskit/tokens';
11
16
  import { RepositionOnUpdate } from './reposition-on-update';
12
17
  import { useCloseManager } from './use-close-manager';
13
18
  import { useFocusManager } from './use-focus-manager';
19
+ const popupFullWidthStyles = css({
20
+ width: '100%'
21
+ });
14
22
  const popupStyles = css({
15
23
  display: 'block',
16
24
  boxSizing: 'border-box',
@@ -20,7 +28,7 @@ const popupStyles = css({
20
28
  borderRadius: "var(--ds-border-radius, 3px)",
21
29
  boxShadow: `var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})`,
22
30
  [CURRENT_SURFACE_CSS_VAR]: `var(--ds-surface-overlay, ${N0})`,
23
- ':focus': {
31
+ '&:focus': {
24
32
  outline: 'none'
25
33
  }
26
34
  });
@@ -31,7 +39,7 @@ const popupOverflowStyles = css({
31
39
  // disables iframe pointer events while popup is open, except if iframe is nested inside popup
32
40
  // solves an issue of popup not being closed on iframe click
33
41
  const blockPointerEventsOnExternalIframeStyles = css({
34
- // 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
35
43
  'iframe:not([data-ds--level] iframe)': {
36
44
  pointerEvents: 'none'
37
45
  }
@@ -39,11 +47,12 @@ const blockPointerEventsOnExternalIframeStyles = css({
39
47
  const DefaultPopupComponent = /*#__PURE__*/forwardRef((props, ref) => {
40
48
  const {
41
49
  shouldRenderToParent,
50
+ shouldFitContainer,
42
51
  children,
43
52
  ...htmlAttributes
44
53
  } = props;
45
54
  return jsx("div", _extends({
46
- css: [popupStyles, !shouldRenderToParent && popupOverflowStyles]
55
+ css: [popupStyles, !shouldRenderToParent && popupOverflowStyles, shouldFitContainer && popupFullWidthStyles]
47
56
  }, htmlAttributes, {
48
57
  ref: ref
49
58
  }), children);
@@ -65,6 +74,7 @@ function PopperWrapper({
65
74
  triggerRef,
66
75
  shouldUseCaptureOnOutsideClick,
67
76
  shouldRenderToParent,
77
+ shouldFitContainer,
68
78
  shouldDisableFocusLock,
69
79
  strategy,
70
80
  role,
@@ -130,13 +140,16 @@ function PopperWrapper({
130
140
  }
131
141
  setPopupRef(node);
132
142
  }
133
- },
143
+ }
144
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
145
+ ,
134
146
  style: style
135
147
  // using tabIndex={-1} would cause a bug where Safari focuses
136
148
  // first on the browser address bar when using keyboard
137
149
  ,
138
150
  tabIndex: autoFocus ? 0 : undefined,
139
- shouldRenderToParent: shouldRenderToParent
151
+ shouldRenderToParent: shouldRenderToParent,
152
+ shouldFitContainer: shouldFitContainer
140
153
  }, getBooleanFF('platform.design-system-team.iframe_gojiv') && jsx(Global, {
141
154
  styles: blockPointerEventsOnExternalIframeStyles
142
155
  }), jsx(RepositionOnUpdate, {
@@ -1,15 +1,24 @@
1
1
  /* eslint-disable @repo/internal/react/require-jsdoc */
2
+ /**
3
+ * @jsxRuntime classic
4
+ */
2
5
  /** @jsx jsx */
3
6
  import { memo, useState } from 'react';
7
+
8
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
4
9
  import { jsx } from '@emotion/react';
5
10
  import { useUID } from 'react-uid';
6
11
  import { UNSAFE_LAYERING } from '@atlaskit/layering';
7
12
  import { Manager, Reference } from '@atlaskit/popper';
8
13
  import Portal from '@atlaskit/portal';
14
+ import { Box, xcss } from '@atlaskit/primitives';
9
15
  import { layers } from '@atlaskit/theme/constants';
10
16
  import PopperWrapper from './popper-wrapper';
11
17
  import { useGetMemoizedMergedTriggerRef } from './use-get-memoized-merged-trigger-ref';
12
18
  const defaultLayer = layers.layer();
19
+ const wrapperStyles = xcss({
20
+ position: 'relative'
21
+ });
13
22
  export const Popup = /*#__PURE__*/memo(({
14
23
  isOpen,
15
24
  id: providedId,
@@ -28,6 +37,7 @@ export const Popup = /*#__PURE__*/memo(({
28
37
  zIndex = defaultLayer,
29
38
  shouldUseCaptureOnOutsideClick = false,
30
39
  shouldRenderToParent = false,
40
+ shouldFitContainer = false,
31
41
  shouldDisableFocusLock = false,
32
42
  strategy,
33
43
  role,
@@ -55,15 +65,16 @@ export const Popup = /*#__PURE__*/memo(({
55
65
  onClose: onClose,
56
66
  autoFocus: autoFocus,
57
67
  shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick,
58
- shouldRenderToParent: shouldRenderToParent,
68
+ shouldRenderToParent: shouldRenderToParent || shouldFitContainer,
69
+ shouldFitContainer: shouldFitContainer,
59
70
  shouldDisableFocusLock: shouldDisableFocusLock,
60
71
  triggerRef: triggerRef,
61
- strategy: strategy,
72
+ strategy: shouldFitContainer ? 'absolute' : strategy,
62
73
  role: role,
63
74
  label: label,
64
75
  titleId: titleId
65
76
  }));
66
- return jsx(Manager, null, jsx(Reference, null, ({
77
+ const popupContent = jsx(Manager, null, jsx(Reference, null, ({
67
78
  ref
68
79
  }) => {
69
80
  return trigger({
@@ -72,8 +83,14 @@ export const Popup = /*#__PURE__*/memo(({
72
83
  'aria-expanded': isOpen,
73
84
  'aria-haspopup': true
74
85
  });
75
- }), isOpen && (shouldRenderToParent ? renderPopperWrapper : jsx(Portal, {
86
+ }), isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper : jsx(Portal, {
76
87
  zIndex: zIndex
77
88
  }, renderPopperWrapper)));
89
+ if (shouldFitContainer) {
90
+ return jsx(Box, {
91
+ xcss: wrapperStyles
92
+ }, popupContent);
93
+ }
94
+ return popupContent;
78
95
  });
79
96
  export default Popup;
@@ -2,10 +2,15 @@ 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
+ /**
8
+ * @jsxRuntime classic
9
+ */
7
10
  /** @jsx jsx */
8
11
  import { forwardRef, useMemo, useState } from 'react';
12
+
13
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
14
  import { css, Global, jsx } from '@emotion/react';
10
15
  import { UNSAFE_useLayering } from '@atlaskit/layering';
11
16
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -16,6 +21,9 @@ import { CURRENT_SURFACE_CSS_VAR } from '@atlaskit/tokens';
16
21
  import { RepositionOnUpdate } from './reposition-on-update';
17
22
  import { useCloseManager } from './use-close-manager';
18
23
  import { useFocusManager } from './use-focus-manager';
24
+ var popupFullWidthStyles = css({
25
+ width: '100%'
26
+ });
19
27
  var popupStyles = css((_css = {
20
28
  display: 'block',
21
29
  boxSizing: 'border-box',
@@ -24,7 +32,7 @@ var popupStyles = css((_css = {
24
32
  backgroundColor: "var(--ds-surface-overlay, ".concat(N0, ")"),
25
33
  borderRadius: "var(--ds-border-radius, 3px)",
26
34
  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', {
35
+ }, _defineProperty(_css, CURRENT_SURFACE_CSS_VAR, "var(--ds-surface-overlay, ".concat(N0, ")")), _defineProperty(_css, '&:focus', {
28
36
  outline: 'none'
29
37
  }), _css));
30
38
  var popupOverflowStyles = css({
@@ -34,17 +42,18 @@ var popupOverflowStyles = css({
34
42
  // disables iframe pointer events while popup is open, except if iframe is nested inside popup
35
43
  // solves an issue of popup not being closed on iframe click
36
44
  var blockPointerEventsOnExternalIframeStyles = css({
37
- // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
45
+ // 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
46
  'iframe:not([data-ds--level] iframe)': {
39
47
  pointerEvents: 'none'
40
48
  }
41
49
  });
42
50
  var DefaultPopupComponent = /*#__PURE__*/forwardRef(function (props, ref) {
43
51
  var shouldRenderToParent = props.shouldRenderToParent,
52
+ shouldFitContainer = props.shouldFitContainer,
44
53
  children = props.children,
45
54
  htmlAttributes = _objectWithoutProperties(props, _excluded);
46
55
  return jsx("div", _extends({
47
- css: [popupStyles, !shouldRenderToParent && popupOverflowStyles]
56
+ css: [popupStyles, !shouldRenderToParent && popupOverflowStyles, shouldFitContainer && popupFullWidthStyles]
48
57
  }, htmlAttributes, {
49
58
  ref: ref
50
59
  }), children);
@@ -69,6 +78,7 @@ function PopperWrapper(_ref) {
69
78
  triggerRef = _ref.triggerRef,
70
79
  shouldUseCaptureOnOutsideClick = _ref.shouldUseCaptureOnOutsideClick,
71
80
  shouldRenderToParent = _ref.shouldRenderToParent,
81
+ shouldFitContainer = _ref.shouldFitContainer,
72
82
  shouldDisableFocusLock = _ref.shouldDisableFocusLock,
73
83
  strategy = _ref.strategy,
74
84
  role = _ref.role,
@@ -139,13 +149,16 @@ function PopperWrapper(_ref) {
139
149
  }
140
150
  setPopupRef(node);
141
151
  }
142
- },
152
+ }
153
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
154
+ ,
143
155
  style: style
144
156
  // using tabIndex={-1} would cause a bug where Safari focuses
145
157
  // first on the browser address bar when using keyboard
146
158
  ,
147
159
  tabIndex: autoFocus ? 0 : undefined,
148
- shouldRenderToParent: shouldRenderToParent
160
+ shouldRenderToParent: shouldRenderToParent,
161
+ shouldFitContainer: shouldFitContainer
149
162
  }, getBooleanFF('platform.design-system-team.iframe_gojiv') && jsx(Global, {
150
163
  styles: blockPointerEventsOnExternalIframeStyles
151
164
  }), jsx(RepositionOnUpdate, {
package/dist/esm/popup.js CHANGED
@@ -1,16 +1,25 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  /* eslint-disable @repo/internal/react/require-jsdoc */
3
+ /**
4
+ * @jsxRuntime classic
5
+ */
3
6
  /** @jsx jsx */
4
7
  import { memo, useState } from 'react';
8
+
9
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
5
10
  import { jsx } from '@emotion/react';
6
11
  import { useUID } from 'react-uid';
7
12
  import { UNSAFE_LAYERING } from '@atlaskit/layering';
8
13
  import { Manager, Reference } from '@atlaskit/popper';
9
14
  import Portal from '@atlaskit/portal';
15
+ import { Box, xcss } from '@atlaskit/primitives';
10
16
  import { layers } from '@atlaskit/theme/constants';
11
17
  import PopperWrapper from './popper-wrapper';
12
18
  import { useGetMemoizedMergedTriggerRef } from './use-get-memoized-merged-trigger-ref';
13
19
  var defaultLayer = layers.layer();
20
+ var wrapperStyles = xcss({
21
+ position: 'relative'
22
+ });
14
23
  export var Popup = /*#__PURE__*/memo(function (_ref) {
15
24
  var isOpen = _ref.isOpen,
16
25
  providedId = _ref.id,
@@ -36,6 +45,8 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
36
45
  shouldUseCaptureOnOutsideClick = _ref$shouldUseCapture === void 0 ? false : _ref$shouldUseCapture,
37
46
  _ref$shouldRenderToPa = _ref.shouldRenderToParent,
38
47
  shouldRenderToParent = _ref$shouldRenderToPa === void 0 ? false : _ref$shouldRenderToPa,
48
+ _ref$shouldFitContain = _ref.shouldFitContainer,
49
+ shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
39
50
  _ref$shouldDisableFoc = _ref.shouldDisableFocusLock,
40
51
  shouldDisableFocusLock = _ref$shouldDisableFoc === void 0 ? false : _ref$shouldDisableFoc,
41
52
  strategy = _ref.strategy,
@@ -66,15 +77,16 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
66
77
  onClose: onClose,
67
78
  autoFocus: autoFocus,
68
79
  shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick,
69
- shouldRenderToParent: shouldRenderToParent,
80
+ shouldRenderToParent: shouldRenderToParent || shouldFitContainer,
81
+ shouldFitContainer: shouldFitContainer,
70
82
  shouldDisableFocusLock: shouldDisableFocusLock,
71
83
  triggerRef: triggerRef,
72
- strategy: strategy,
84
+ strategy: shouldFitContainer ? 'absolute' : strategy,
73
85
  role: role,
74
86
  label: label,
75
87
  titleId: titleId
76
88
  }));
77
- return jsx(Manager, null, jsx(Reference, null, function (_ref2) {
89
+ var popupContent = jsx(Manager, null, jsx(Reference, null, function (_ref2) {
78
90
  var ref = _ref2.ref;
79
91
  return trigger({
80
92
  ref: getMergedTriggerRef(ref, setTriggerRef, isOpen),
@@ -82,8 +94,14 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
82
94
  'aria-expanded': isOpen,
83
95
  'aria-haspopup': true
84
96
  });
85
- }), isOpen && (shouldRenderToParent ? renderPopperWrapper : jsx(Portal, {
97
+ }), isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper : jsx(Portal, {
86
98
  zIndex: zIndex
87
99
  }, renderPopperWrapper)));
100
+ if (shouldFitContainer) {
101
+ return jsx(Box, {
102
+ xcss: wrapperStyles
103
+ }, popupContent);
104
+ }
105
+ return popupContent;
88
106
  });
89
107
  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
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, shouldDisableFocusLock, strategy, role, label, titleId, }: 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, strategy, role, label, titleId, }: PopperWrapperProps): jsx.JSX.Element;
4
4
  export default PopperWrapper;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ */
1
4
  /** @jsx jsx */
2
5
  import { type FC } from 'react';
3
6
  import { type PopupProps } from './types';
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { type RepositionOnUpdateProps } from './types';
3
- export declare const RepositionOnUpdate: ({ children, update, }: RepositionOnUpdateProps) => JSX.Element;
3
+ export declare const RepositionOnUpdate: ({ children, update }: RepositionOnUpdateProps) => JSX.Element;
@@ -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
  }
@@ -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
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, shouldDisableFocusLock, strategy, role, label, titleId, }: 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, strategy, role, label, titleId, }: PopperWrapperProps): jsx.JSX.Element;
4
4
  export default PopperWrapper;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ */
1
4
  /** @jsx jsx */
2
5
  import { type FC } from 'react';
3
6
  import { type PopupProps } from './types';
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { type RepositionOnUpdateProps } from './types';
3
- export declare const RepositionOnUpdate: ({ children, update, }: RepositionOnUpdateProps) => JSX.Element;
3
+ export declare const RepositionOnUpdate: ({ children, update }: RepositionOnUpdateProps) => JSX.Element;
@@ -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
  }