@atlaskit/mention 24.3.2 → 24.4.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/mention
2
2
 
3
+ ## 24.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`7b39403f28495`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7b39403f28495) -
8
+ Clean up FG(mentions-migrate-react-dom) which migrates deprecated react-dom APIs findDOMNode,
9
+ unmountComponentAtNode via usage of createPortal
10
+
11
+ ## 24.3.3
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 24.3.2
4
18
 
5
19
  ### Patch Changes
@@ -0,0 +1,72 @@
1
+ {
2
+ "extends": "../../../../tsconfig.entry-points.products.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "target": "es5",
6
+ "outDir": "../../../../../tsDist/@atlaskit__mention/app",
7
+ "rootDir": "../",
8
+ "composite": true
9
+ },
10
+ "include": [
11
+ "../src/**/*.ts",
12
+ "../src/**/*.tsx"
13
+ ],
14
+ "exclude": [
15
+ "../src/**/__tests__/*",
16
+ "../src/**/*.test.*",
17
+ "../src/**/test.*",
18
+ "../src/**/examples.*",
19
+ "../src/**/examples/*",
20
+ "../src/**/examples/**/*",
21
+ "../src/**/*.stories.*",
22
+ "../src/**/stories/*",
23
+ "../src/**/stories/**/*"
24
+ ],
25
+ "references": [
26
+ {
27
+ "path": "../../../analytics/analytics-gas-types/afm-products/tsconfig.json"
28
+ },
29
+ {
30
+ "path": "../../../analytics/analytics-next/afm-products/tsconfig.json"
31
+ },
32
+ {
33
+ "path": "../../../design-system/avatar/afm-products/tsconfig.json"
34
+ },
35
+ {
36
+ "path": "../../../design-system/focus-ring/afm-products/tsconfig.json"
37
+ },
38
+ {
39
+ "path": "../../../design-system/heading/afm-products/tsconfig.json"
40
+ },
41
+ {
42
+ "path": "../../../design-system/icon/afm-products/tsconfig.json"
43
+ },
44
+ {
45
+ "path": "../../../design-system/lozenge/afm-products/tsconfig.json"
46
+ },
47
+ {
48
+ "path": "../../../platform/feature-flags/afm-products/tsconfig.json"
49
+ },
50
+ {
51
+ "path": "../../../design-system/primitives/afm-products/tsconfig.json"
52
+ },
53
+ {
54
+ "path": "../../../people-and-teams/teams-avatar/afm-products/tsconfig.json"
55
+ },
56
+ {
57
+ "path": "../../../design-system/theme/afm-products/tsconfig.json"
58
+ },
59
+ {
60
+ "path": "../../../design-system/tokens/afm-products/tsconfig.json"
61
+ },
62
+ {
63
+ "path": "../../../design-system/tooltip/afm-products/tsconfig.json"
64
+ },
65
+ {
66
+ "path": "../../../data/ufo-external/afm-products/tsconfig.json"
67
+ },
68
+ {
69
+ "path": "../../util-service-support/afm-products/tsconfig.json"
70
+ }
71
+ ]
72
+ }
package/compass.yml CHANGED
@@ -7,6 +7,9 @@ ownerId: 'ari:cloud:teams::team/8c518cea-39e4-4a9e-976b-2eec1db07eb2'
7
7
  fields:
8
8
  tier: 2
9
9
  links:
10
+ - name: Root Repository
11
+ type: REPOSITORY
12
+ url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master
10
13
  - name: ''
11
14
  type: REPOSITORY
12
15
  url: 'https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/elements/mention/'
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -13,15 +12,13 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
13
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
14
  var _react = _interopRequireDefault(require("react"));
16
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
15
  var _logger = _interopRequireDefault(require("../../util/logger"));
18
16
  var _mouse = require("../../util/mouse");
19
- var _MentionItem = _interopRequireWildcard(require("../MentionItem"));
17
+ var _MentionItem = require("../MentionItem");
20
18
  var _MentionListError = _interopRequireDefault(require("../MentionListError"));
21
19
  var _MessagesIntlProvider = _interopRequireDefault(require("../MessagesIntlProvider"));
22
20
  var _Scrollable = _interopRequireDefault(require("../Scrollable"));
23
21
  var _styles = require("./styles");
24
- 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); }
25
22
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
26
23
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
27
24
  function wrapIndex(mentions, index) {
@@ -170,16 +167,9 @@ var MentionList = exports.default = /*#__PURE__*/function (_React$PureComponent)
170
167
  value:
171
168
  // Internal
172
169
  function revealItem(key) {
173
- if ((0, _platformFeatureFlags.fg)('mentions-migrate-react-dom')) {
174
- var itemRef = this.getItemRef(key);
175
- if (itemRef && this.scrollable) {
176
- itemRef && this.scrollable.revealRef(itemRef);
177
- }
178
- } else {
179
- var item = this.items[key];
180
- if (item && this.scrollable) {
181
- this.scrollable.reveal(item);
182
- }
170
+ var itemRef = this.getItemRef(key);
171
+ if (itemRef && this.scrollable) {
172
+ itemRef && this.scrollable.revealRef(itemRef);
183
173
  }
184
174
  }
185
175
 
@@ -200,43 +190,21 @@ var MentionList = exports.default = /*#__PURE__*/function (_React$PureComponent)
200
190
  var _this2 = this;
201
191
  var mentions = this.props.mentions;
202
192
  if (mentions && mentions.length) {
203
- this.items = {};
204
193
  return /*#__PURE__*/_react.default.createElement("div", null, this.props.initialHighlightElement, mentions.map(function (mention, idx) {
205
194
  var key = mention.id;
206
195
  var ref = _this2.createItemRef(key);
207
- if ((0, _platformFeatureFlags.fg)('mentions-migrate-react-dom')) {
208
- var item = /*#__PURE__*/_react.default.createElement(_MentionItem.MentionItemWithRef, {
209
- mention: mention,
210
- selected: _this2.isSelectedMention(mention, idx),
211
- key: key,
212
- onMouseMove: _this2.selectIndexOnHover
213
- /* Cannot use onclick, as onblur will close the element, and prevent
214
- * onClick from firing.
215
- */,
216
- onSelection: _this2.itemSelected,
217
- ref: ref
218
- });
219
- return item;
220
- } else {
221
- var _item = /*#__PURE__*/_react.default.createElement(_MentionItem.default, {
222
- mention: mention,
223
- selected: _this2.isSelectedMention(mention, idx),
224
- key: key,
225
- onMouseMove: _this2.selectIndexOnHover
226
- /* Cannot use onclick, as onblur will close the element, and prevent
227
- * onClick from firing.
228
- */,
229
- onSelection: _this2.itemSelected,
230
- ref: function ref(_ref) {
231
- if (_ref) {
232
- _this2.items[key] = _ref;
233
- } else {
234
- delete _this2.items[key];
235
- }
236
- }
237
- });
238
- return _item;
239
- }
196
+ var item = /*#__PURE__*/_react.default.createElement(_MentionItem.MentionItemWithRef, {
197
+ mention: mention,
198
+ selected: _this2.isSelectedMention(mention, idx),
199
+ key: key,
200
+ onMouseMove: _this2.selectIndexOnHover
201
+ /* Cannot use onclick, as onblur will close the element, and prevent
202
+ * onClick from firing.
203
+ */,
204
+ onSelection: _this2.itemSelected,
205
+ ref: ref
206
+ });
207
+ return item;
240
208
  }));
241
209
  }
242
210
  return null;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -13,16 +12,11 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
13
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
14
  var _react = _interopRequireDefault(require("react"));
16
- var _reactDom = _interopRequireWildcard(require("react-dom"));
17
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
- 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); }
15
+ var _reactDom = require("react-dom");
19
16
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
17
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
18
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
22
19
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
23
- /*
24
- * Simple implementation of popup while waiting for ak-inline-dialog
25
- */
26
20
  var Popup = exports.default = /*#__PURE__*/function (_React$PureComponent) {
27
21
  function Popup(props) {
28
22
  var _this;
@@ -46,28 +40,7 @@ var Popup = exports.default = /*#__PURE__*/function (_React$PureComponent) {
46
40
  }, {
47
41
  key: "componentDidMount",
48
42
  value: function componentDidMount() {
49
- if (!(0, _platformFeatureFlags.fg)('mentions-migrate-react-dom')) {
50
- this.popup = document.createElement('div');
51
- document.body.appendChild(this.popup);
52
- this.popup.style.position = 'absolute';
53
- }
54
43
  this._applyAbsolutePosition();
55
- this._renderContent();
56
- }
57
- }, {
58
- key: "componentDidUpdate",
59
- value: function componentDidUpdate() {
60
- this._renderContent();
61
- }
62
- }, {
63
- key: "componentWillUnmount",
64
- value: function componentWillUnmount() {
65
- if (!(0, _platformFeatureFlags.fg)('mentions-migrate-react-dom')) {
66
- if (this.popup) {
67
- _reactDom.default.unmountComponentAtNode(this.popup);
68
- document.body.removeChild(this.popup);
69
- }
70
- }
71
44
  }
72
45
  }, {
73
46
  key: "_applyBelowPosition",
@@ -77,19 +50,11 @@ var Popup = exports.default = /*#__PURE__*/function (_React$PureComponent) {
77
50
  var box = targetNode.getBoundingClientRect();
78
51
  var top = box.bottom + (this.props.offsetY || 0);
79
52
  var left = box.left + (this.props.offsetX || 0);
80
- if ((0, _platformFeatureFlags.fg)('mentions-migrate-react-dom')) {
81
- this.setPortalStyles({
82
- top: "".concat(top, "px"),
83
- bottom: '',
84
- left: "".concat(left, "px")
85
- });
86
- } else {
87
- if (this.popup) {
88
- this.popup.style.top = "".concat(top, "px");
89
- this.popup.style.bottom = '';
90
- this.popup.style.left = "".concat(left, "px");
91
- }
92
- }
53
+ this.setPortalStyles({
54
+ top: "".concat(top, "px"),
55
+ bottom: '',
56
+ left: "".concat(left, "px")
57
+ });
93
58
  }
94
59
  }
95
60
  }, {
@@ -100,19 +65,11 @@ var Popup = exports.default = /*#__PURE__*/function (_React$PureComponent) {
100
65
  var box = targetNode.getBoundingClientRect();
101
66
  var bottom = window.innerHeight - box.top + (this.props.offsetY || 0);
102
67
  var left = box.left + (this.props.offsetX || 0);
103
- if ((0, _platformFeatureFlags.fg)('mentions-migrate-react-dom')) {
104
- this.setPortalStyles({
105
- top: '',
106
- bottom: "".concat(bottom, "px"),
107
- left: "".concat(left, "px")
108
- });
109
- } else {
110
- if (this.popup) {
111
- this.popup.style.top = '';
112
- this.popup.style.bottom = "".concat(bottom, "px");
113
- this.popup.style.left = "".concat(left, "px");
114
- }
115
- }
68
+ this.setPortalStyles({
69
+ top: '',
70
+ bottom: "".concat(bottom, "px"),
71
+ left: "".concat(left, "px")
72
+ });
116
73
  }
117
74
  }
118
75
  }, {
@@ -134,41 +91,21 @@ var Popup = exports.default = /*#__PURE__*/function (_React$PureComponent) {
134
91
  }
135
92
  }
136
93
  }
137
- if ((0, _platformFeatureFlags.fg)('mentions-migrate-react-dom')) {
138
- if (this.props.zIndex) {
139
- this.setPortalStyles({
140
- zIndex: this.props.zIndex
141
- });
142
- }
143
- } else {
144
- if (this.props.zIndex && this.popup) {
145
- this.popup.style.zIndex = "".concat(this.props.zIndex);
146
- }
147
- }
148
- }
149
- }, {
150
- key: "_renderContent",
151
- value: function _renderContent() {
152
- if (!(0, _platformFeatureFlags.fg)('mentions-migrate-react-dom')) {
153
- if (this.popup) {
154
- _reactDom.default.render(this.props.children, this.popup);
155
- }
94
+ if (this.props.zIndex) {
95
+ this.setPortalStyles({
96
+ zIndex: this.props.zIndex
97
+ });
156
98
  }
157
99
  }
158
100
  }, {
159
101
  key: "render",
160
102
  value: function render() {
161
- if ((0, _platformFeatureFlags.fg)('mentions-migrate-react-dom')) {
162
- // https://atlassian.design/components/eslint-plugin-ui-styling-standard/migration-guide#dynamic-styles
163
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
164
- var content = /*#__PURE__*/_react.default.createElement("div", {
165
- style: this.portalStyles
166
- }, this.props.children);
167
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/(0, _reactDom.createPortal)(content, document.body));
168
- } else {
169
- // Placeholder element for react to render inplace
170
- /*#__PURE__*/_react.default.createElement("div", null);
171
- }
103
+ // https://atlassian.design/components/eslint-plugin-ui-styling-standard/migration-guide#dynamic-styles
104
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
105
+ var content = /*#__PURE__*/_react.default.createElement("div", {
106
+ style: this.portalStyles
107
+ }, this.props.children);
108
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/(0, _reactDom.createPortal)(content, document.body));
172
109
  }
173
110
  }]);
174
111
  }(_react.default.PureComponent);
@@ -12,7 +12,6 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
12
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _react = _interopRequireDefault(require("react"));
15
- var _reactDom = require("react-dom");
16
15
  var _styles = require("./styles");
17
16
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
18
17
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
@@ -24,21 +23,6 @@ var Scrollable = exports.default = /*#__PURE__*/function (_React$PureComponent)
24
23
  args[_key] = arguments[_key];
25
24
  }
26
25
  _this = _callSuper(this, Scrollable, [].concat(args));
27
- // Cleanup when removing mentions-migrate-react-dom
28
- (0, _defineProperty2.default)(_this, "reveal", function (child) {
29
- if (child && _this.scrollableDiv) {
30
- var childNode = (0, _reactDom.findDOMNode)(child);
31
- // Not using Element.scrollIntoView as it scrolls even to top/bottom of view even if
32
- // already visible
33
- var scrollableRect = _this.scrollableDiv.getBoundingClientRect();
34
- var elementRect = childNode.getBoundingClientRect();
35
- if (elementRect.top < scrollableRect.top) {
36
- _this.scrollableDiv.scrollTop += elementRect.top - scrollableRect.top;
37
- } else if (elementRect.bottom > scrollableRect.bottom) {
38
- _this.scrollableDiv.scrollTop += elementRect.bottom - scrollableRect.bottom;
39
- }
40
- }
41
- });
42
26
  (0, _defineProperty2.default)(_this, "revealRef", function (ref) {
43
27
  if (ref && ref.current && _this.scrollableDiv) {
44
28
  // Not using Element.scrollIntoView as it scrolls even to top/bottom of view even if
@@ -1,9 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  import debug from '../../util/logger';
5
4
  import { actualMouseMove, mouseLocation } from '../../util/mouse';
6
- import MentionItem, { MentionItemWithRef } from '../MentionItem';
5
+ import { MentionItemWithRef } from '../MentionItem';
7
6
  import MentionListError from '../MentionListError';
8
7
  import MessagesIntlProvider from '../MessagesIntlProvider';
9
8
  import Scrollable from '../Scrollable';
@@ -157,16 +156,9 @@ export default class MentionList extends React.PureComponent {
157
156
 
158
157
  // Internal
159
158
  revealItem(key) {
160
- if (fg('mentions-migrate-react-dom')) {
161
- const itemRef = this.getItemRef(key);
162
- if (itemRef && this.scrollable) {
163
- itemRef && this.scrollable.revealRef(itemRef);
164
- }
165
- } else {
166
- const item = this.items[key];
167
- if (item && this.scrollable) {
168
- this.scrollable.reveal(item);
169
- }
159
+ const itemRef = this.getItemRef(key);
160
+ if (itemRef && this.scrollable) {
161
+ itemRef && this.scrollable.revealRef(itemRef);
170
162
  }
171
163
  }
172
164
 
@@ -184,43 +176,21 @@ export default class MentionList extends React.PureComponent {
184
176
  mentions
185
177
  } = this.props;
186
178
  if (mentions && mentions.length) {
187
- this.items = {};
188
179
  return /*#__PURE__*/React.createElement("div", null, this.props.initialHighlightElement, mentions.map((mention, idx) => {
189
180
  const key = mention.id;
190
181
  const ref = this.createItemRef(key);
191
- if (fg('mentions-migrate-react-dom')) {
192
- const item = /*#__PURE__*/React.createElement(MentionItemWithRef, {
193
- mention: mention,
194
- selected: this.isSelectedMention(mention, idx),
195
- key: key,
196
- onMouseMove: this.selectIndexOnHover
197
- /* Cannot use onclick, as onblur will close the element, and prevent
198
- * onClick from firing.
199
- */,
200
- onSelection: this.itemSelected,
201
- ref: ref
202
- });
203
- return item;
204
- } else {
205
- const item = /*#__PURE__*/React.createElement(MentionItem, {
206
- mention: mention,
207
- selected: this.isSelectedMention(mention, idx),
208
- key: key,
209
- onMouseMove: this.selectIndexOnHover
210
- /* Cannot use onclick, as onblur will close the element, and prevent
211
- * onClick from firing.
212
- */,
213
- onSelection: this.itemSelected,
214
- ref: ref => {
215
- if (ref) {
216
- this.items[key] = ref;
217
- } else {
218
- delete this.items[key];
219
- }
220
- }
221
- });
222
- return item;
223
- }
182
+ const item = /*#__PURE__*/React.createElement(MentionItemWithRef, {
183
+ mention: mention,
184
+ selected: this.isSelectedMention(mention, idx),
185
+ key: key,
186
+ onMouseMove: this.selectIndexOnHover
187
+ /* Cannot use onclick, as onblur will close the element, and prevent
188
+ * onClick from firing.
189
+ */,
190
+ onSelection: this.itemSelected,
191
+ ref: ref
192
+ });
193
+ return item;
224
194
  }));
225
195
  }
226
196
  return null;
@@ -1,10 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
- import ReactDOM, { createPortal } from 'react-dom';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
- /*
6
- * Simple implementation of popup while waiting for ak-inline-dialog
7
- */
3
+ import { createPortal } from 'react-dom';
8
4
  export default class Popup extends React.PureComponent {
9
5
  constructor(props) {
10
6
  super(props);
@@ -23,24 +19,7 @@ export default class Popup extends React.PureComponent {
23
19
  };
24
20
  }
25
21
  componentDidMount() {
26
- if (!fg('mentions-migrate-react-dom')) {
27
- this.popup = document.createElement('div');
28
- document.body.appendChild(this.popup);
29
- this.popup.style.position = 'absolute';
30
- }
31
22
  this._applyAbsolutePosition();
32
- this._renderContent();
33
- }
34
- componentDidUpdate() {
35
- this._renderContent();
36
- }
37
- componentWillUnmount() {
38
- if (!fg('mentions-migrate-react-dom')) {
39
- if (this.popup) {
40
- ReactDOM.unmountComponentAtNode(this.popup);
41
- document.body.removeChild(this.popup);
42
- }
43
- }
44
23
  }
45
24
  _applyBelowPosition() {
46
25
  const targetNode = this.props.target && document.getElementById(this.props.target);
@@ -48,19 +27,11 @@ export default class Popup extends React.PureComponent {
48
27
  const box = targetNode.getBoundingClientRect();
49
28
  const top = box.bottom + (this.props.offsetY || 0);
50
29
  const left = box.left + (this.props.offsetX || 0);
51
- if (fg('mentions-migrate-react-dom')) {
52
- this.setPortalStyles({
53
- top: `${top}px`,
54
- bottom: '',
55
- left: `${left}px`
56
- });
57
- } else {
58
- if (this.popup) {
59
- this.popup.style.top = `${top}px`;
60
- this.popup.style.bottom = '';
61
- this.popup.style.left = `${left}px`;
62
- }
63
- }
30
+ this.setPortalStyles({
31
+ top: `${top}px`,
32
+ bottom: '',
33
+ left: `${left}px`
34
+ });
64
35
  }
65
36
  }
66
37
  _applyAbovePosition() {
@@ -69,19 +40,11 @@ export default class Popup extends React.PureComponent {
69
40
  const box = targetNode.getBoundingClientRect();
70
41
  const bottom = window.innerHeight - box.top + (this.props.offsetY || 0);
71
42
  const left = box.left + (this.props.offsetX || 0);
72
- if (fg('mentions-migrate-react-dom')) {
73
- this.setPortalStyles({
74
- top: '',
75
- bottom: `${bottom}px`,
76
- left: `${left}px`
77
- });
78
- } else {
79
- if (this.popup) {
80
- this.popup.style.top = '';
81
- this.popup.style.bottom = `${bottom}px`;
82
- this.popup.style.left = `${left}px`;
83
- }
84
- }
43
+ this.setPortalStyles({
44
+ top: '',
45
+ bottom: `${bottom}px`,
46
+ left: `${left}px`
47
+ });
85
48
  }
86
49
  }
87
50
  _applyAbsolutePosition() {
@@ -101,37 +64,19 @@ export default class Popup extends React.PureComponent {
101
64
  }
102
65
  }
103
66
  }
104
- if (fg('mentions-migrate-react-dom')) {
105
- if (this.props.zIndex) {
106
- this.setPortalStyles({
107
- zIndex: this.props.zIndex
108
- });
109
- }
110
- } else {
111
- if (this.props.zIndex && this.popup) {
112
- this.popup.style.zIndex = `${this.props.zIndex}`;
113
- }
114
- }
115
- }
116
- _renderContent() {
117
- if (!fg('mentions-migrate-react-dom')) {
118
- if (this.popup) {
119
- ReactDOM.render(this.props.children, this.popup);
120
- }
67
+ if (this.props.zIndex) {
68
+ this.setPortalStyles({
69
+ zIndex: this.props.zIndex
70
+ });
121
71
  }
122
72
  }
123
73
  render() {
124
- if (fg('mentions-migrate-react-dom')) {
125
- // https://atlassian.design/components/eslint-plugin-ui-styling-standard/migration-guide#dynamic-styles
126
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
127
- const content = /*#__PURE__*/React.createElement("div", {
128
- style: this.portalStyles
129
- }, this.props.children);
130
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/createPortal(content, document.body));
131
- } else {
132
- // Placeholder element for react to render inplace
133
- /*#__PURE__*/React.createElement("div", null);
134
- }
74
+ // https://atlassian.design/components/eslint-plugin-ui-styling-standard/migration-guide#dynamic-styles
75
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
76
+ const content = /*#__PURE__*/React.createElement("div", {
77
+ style: this.portalStyles
78
+ }, this.props.children);
79
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/createPortal(content, document.body));
135
80
  }
136
81
  }
137
82
  _defineProperty(Popup, "defaultProps", {
@@ -1,25 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
- import { findDOMNode } from 'react-dom';
4
3
  import { ScrollableStyle } from './styles';
5
4
  export default class Scrollable extends React.PureComponent {
6
5
  constructor(...args) {
7
6
  super(...args);
8
- // Cleanup when removing mentions-migrate-react-dom
9
- _defineProperty(this, "reveal", child => {
10
- if (child && this.scrollableDiv) {
11
- const childNode = findDOMNode(child);
12
- // Not using Element.scrollIntoView as it scrolls even to top/bottom of view even if
13
- // already visible
14
- const scrollableRect = this.scrollableDiv.getBoundingClientRect();
15
- const elementRect = childNode.getBoundingClientRect();
16
- if (elementRect.top < scrollableRect.top) {
17
- this.scrollableDiv.scrollTop += elementRect.top - scrollableRect.top;
18
- } else if (elementRect.bottom > scrollableRect.bottom) {
19
- this.scrollableDiv.scrollTop += elementRect.bottom - scrollableRect.bottom;
20
- }
21
- }
22
- });
23
7
  _defineProperty(this, "revealRef", ref => {
24
8
  if (ref && ref.current && this.scrollableDiv) {
25
9
  // Not using Element.scrollIntoView as it scrolls even to top/bottom of view even if