@atlaskit/popup 4.11.0 → 4.12.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,19 @@
1
1
  # @atlaskit/popup
2
2
 
3
+ ## 4.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2f8e40fb0a94f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2f8e40fb0a94f) -
8
+ Popups using `shouldFitViewport` will now be scrollable even if they are rendered to parent using
9
+ `shouldRenderToParent`. Previously, only popups rendered in portals would be scrollable.
10
+
11
+ This change is behind the feature gate `platform_dst_nav4_flyoutmenuitem_render_to_parent`.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 4.11.0
4
18
 
5
19
  ### Minor Changes
@@ -21,7 +21,7 @@ var _popper = require("@atlaskit/popper");
21
21
  var _repositionOnUpdate = require("./reposition-on-update");
22
22
  var _useCloseManager = require("./use-close-manager");
23
23
  var _useFocusManager = require("./use-focus-manager");
24
- var _excluded = ["shouldRenderToParent", "shouldFitContainer", "children", "appearance", "className", "isReferenceHidden"];
24
+ var _excluded = ["shouldRenderToParent", "shouldFitContainer", "children", "appearance", "className", "isReferenceHidden", "shouldFitViewport"];
25
25
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
26
26
  var LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
27
27
  var fullWidthStyles = null;
@@ -42,10 +42,11 @@ var DefaultPopupComponent = /*#__PURE__*/(0, _react.forwardRef)(function (props,
42
42
  appearance = props.appearance,
43
43
  className = props.className,
44
44
  _isReferenceHidden = props.isReferenceHidden,
45
+ shouldFitViewport = props.shouldFitViewport,
45
46
  htmlAttributes = (0, _objectWithoutProperties2.default)(props, _excluded);
46
47
  return /*#__PURE__*/React.createElement("div", (0, _extends2.default)({
47
48
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
48
- className: (0, _runtime.ax)([wrapperStyles.root, (0, _platformFeatureFlags.fg)('platform-dst-shape-theme-default') && wrapperStyles.rootT26Shape, appearance === 'UNSAFE_modal-below-sm' && "_dk5d1b66 _c71ldtre _kqsw1n9t _152t1b66", !shouldRenderToParent && "_1reo1wug _18m91wug", shouldFitContainer && "_1bsb1osq", className])
49
+ className: (0, _runtime.ax)([wrapperStyles.root, (0, _platformFeatureFlags.fg)('platform-dst-shape-theme-default') && wrapperStyles.rootT26Shape, appearance === 'UNSAFE_modal-below-sm' && "_dk5d1b66 _c71ldtre _kqsw1n9t _152t1b66", (!shouldRenderToParent || shouldFitViewport && (0, _platformFeatureFlags.fg)('platform_dst_nav4_flyoutmenuitem_render_to_parent')) && "_1reo1wug _18m91wug", shouldFitContainer && "_1bsb1osq", className])
49
50
  }, htmlAttributes, {
50
51
  ref: ref
51
52
  }), children);
@@ -172,6 +173,7 @@ function PopperWrapper(_ref) {
172
173
  tabIndex: autoFocus ? 0 : undefined,
173
174
  shouldRenderToParent: shouldRenderToParent,
174
175
  shouldFitContainer: shouldFitContainer,
176
+ shouldFitViewport: shouldFitViewport,
175
177
  isReferenceHidden: isReferenceHidden
176
178
  }, /*#__PURE__*/React.createElement(_repositionOnUpdate.RepositionOnUpdate, {
177
179
  update: update
@@ -30,11 +30,12 @@ const DefaultPopupComponent = /*#__PURE__*/forwardRef((props, ref) => {
30
30
  appearance,
31
31
  className,
32
32
  isReferenceHidden: _isReferenceHidden,
33
+ shouldFitViewport,
33
34
  ...htmlAttributes
34
35
  } = props;
35
36
  return /*#__PURE__*/React.createElement("div", _extends({
36
37
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
37
- className: ax([wrapperStyles.root, fg('platform-dst-shape-theme-default') && wrapperStyles.rootT26Shape, appearance === 'UNSAFE_modal-below-sm' && "_dk5d1b66 _c71ldtre _kqsw1n9t _152t1b66", !shouldRenderToParent && "_1reo1wug _18m91wug", shouldFitContainer && "_1bsb1osq", className])
38
+ className: ax([wrapperStyles.root, fg('platform-dst-shape-theme-default') && wrapperStyles.rootT26Shape, appearance === 'UNSAFE_modal-below-sm' && "_dk5d1b66 _c71ldtre _kqsw1n9t _152t1b66", (!shouldRenderToParent || shouldFitViewport && fg('platform_dst_nav4_flyoutmenuitem_render_to_parent')) && "_1reo1wug _18m91wug", shouldFitContainer && "_1bsb1osq", className])
38
39
  }, htmlAttributes, {
39
40
  ref: ref
40
41
  }), children);
@@ -152,6 +153,7 @@ function PopperWrapper({
152
153
  tabIndex: autoFocus ? 0 : undefined,
153
154
  shouldRenderToParent: shouldRenderToParent,
154
155
  shouldFitContainer: shouldFitContainer,
156
+ shouldFitViewport: shouldFitViewport,
155
157
  isReferenceHidden: isReferenceHidden
156
158
  }, /*#__PURE__*/React.createElement(RepositionOnUpdate, {
157
159
  update: update
@@ -3,7 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _extends from "@babel/runtime/helpers/extends";
5
5
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
6
- var _excluded = ["shouldRenderToParent", "shouldFitContainer", "children", "appearance", "className", "isReferenceHidden"];
6
+ var _excluded = ["shouldRenderToParent", "shouldFitContainer", "children", "appearance", "className", "isReferenceHidden", "shouldFitViewport"];
7
7
  import "./popper-wrapper.compiled.css";
8
8
  import * as React from 'react';
9
9
  import { forwardRef, Fragment, useMemo, useState } from 'react';
@@ -33,10 +33,11 @@ var DefaultPopupComponent = /*#__PURE__*/forwardRef(function (props, ref) {
33
33
  appearance = props.appearance,
34
34
  className = props.className,
35
35
  _isReferenceHidden = props.isReferenceHidden,
36
+ shouldFitViewport = props.shouldFitViewport,
36
37
  htmlAttributes = _objectWithoutProperties(props, _excluded);
37
38
  return /*#__PURE__*/React.createElement("div", _extends({
38
39
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
39
- className: ax([wrapperStyles.root, fg('platform-dst-shape-theme-default') && wrapperStyles.rootT26Shape, appearance === 'UNSAFE_modal-below-sm' && "_dk5d1b66 _c71ldtre _kqsw1n9t _152t1b66", !shouldRenderToParent && "_1reo1wug _18m91wug", shouldFitContainer && "_1bsb1osq", className])
40
+ className: ax([wrapperStyles.root, fg('platform-dst-shape-theme-default') && wrapperStyles.rootT26Shape, appearance === 'UNSAFE_modal-below-sm' && "_dk5d1b66 _c71ldtre _kqsw1n9t _152t1b66", (!shouldRenderToParent || shouldFitViewport && fg('platform_dst_nav4_flyoutmenuitem_render_to_parent')) && "_1reo1wug _18m91wug", shouldFitContainer && "_1bsb1osq", className])
40
41
  }, htmlAttributes, {
41
42
  ref: ref
42
43
  }), children);
@@ -163,6 +164,7 @@ function PopperWrapper(_ref) {
163
164
  tabIndex: autoFocus ? 0 : undefined,
164
165
  shouldRenderToParent: shouldRenderToParent,
165
166
  shouldFitContainer: shouldFitContainer,
167
+ shouldFitViewport: shouldFitViewport,
166
168
  isReferenceHidden: isReferenceHidden
167
169
  }, /*#__PURE__*/React.createElement(RepositionOnUpdate, {
168
170
  update: update
@@ -90,6 +90,11 @@ export interface PopupComponentProps {
90
90
  * The default is `false`.
91
91
  */
92
92
  shouldFitContainer?: boolean;
93
+ /**
94
+ * Determines if the popup will have a `max-width` and `max-height` set to
95
+ * constrain it to the viewport.
96
+ */
97
+ shouldFitViewport?: boolean;
93
98
  /**
94
99
  * The "default" appearance is used for standard popups.
95
100
  * The "UNSAFE_modal-below-sm" appearance makes the popup appear as a modal when the viewport is smaller than "sm".
@@ -90,6 +90,11 @@ export interface PopupComponentProps {
90
90
  * The default is `false`.
91
91
  */
92
92
  shouldFitContainer?: boolean;
93
+ /**
94
+ * Determines if the popup will have a `max-width` and `max-height` set to
95
+ * constrain it to the viewport.
96
+ */
97
+ shouldFitViewport?: boolean;
93
98
  /**
94
99
  * The "default" appearance is used for standard popups.
95
100
  * The "UNSAFE_modal-below-sm" appearance makes the popup appear as a modal when the viewport is smaller than "sm".
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "4.11.0",
3
+ "version": "4.12.0",
4
4
  "description": "A popup displays brief content in an overlay.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,12 +34,12 @@
34
34
  "dependencies": {
35
35
  "@atlaskit/css": "^0.19.0",
36
36
  "@atlaskit/ds-lib": "^5.3.0",
37
- "@atlaskit/layering": "^3.5.0",
37
+ "@atlaskit/layering": "^3.6.0",
38
38
  "@atlaskit/platform-feature-flags": "^1.1.0",
39
39
  "@atlaskit/popper": "^7.1.0",
40
40
  "@atlaskit/portal": "^5.1.0",
41
41
  "@atlaskit/primitives": "^17.0.0",
42
- "@atlaskit/tokens": "^9.0.0",
42
+ "@atlaskit/tokens": "^9.1.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "@compiled/react": "^0.18.6",
45
45
  "bind-event-listener": "^3.0.0",
@@ -119,6 +119,9 @@
119
119
  },
120
120
  "platform_dst_nav4_flyout_menu_slots_close_button": {
121
121
  "type": "boolean"
122
+ },
123
+ "platform_dst_nav4_flyoutmenuitem_render_to_parent": {
124
+ "type": "boolean"
122
125
  }
123
126
  },
124
127
  "homepage": "https://atlassian.design/components/popup/"