@atlaskit/editor-plugin-mentions 4.3.0 → 4.3.2

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/editor-plugin-mentions
2
2
 
3
+ ## 4.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 4.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#137012](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/137012)
14
+ [`4dc7b6496e62c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4dc7b6496e62c) -
15
+ [ux] Match the popup behaviour in vanilla mention node to the existing behaviour.
16
+
3
17
  ## 4.3.0
4
18
 
5
19
  ### Minor Changes
@@ -26,7 +26,7 @@ var ACTIONS = exports.ACTIONS = {
26
26
  SET_PROVIDER: 'SET_PROVIDER'
27
27
  };
28
28
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
29
- var PACKAGE_VERSION = "4.3.0";
29
+ var PACKAGE_VERSION = "4.3.2";
30
30
  var setProvider = function setProvider(provider) {
31
31
  return function (state, dispatch) {
32
32
  if (dispatch) {
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.Popup = Popup;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _popper = require("@atlaskit/popper");
10
+ var _portal = _interopRequireDefault(require("@atlaskit/portal"));
11
+ /**
12
+ * A popup wrapper to match the behaviour of `@atlaskit/popup`
13
+ *
14
+ * Why not `@atlaskit/popup` directly? It requires a trigger element.
15
+ * We can use this when we have a direct reference to the element
16
+ * and it is more convenient to work directly with the lower level API.
17
+ *
18
+ * @param referenceElement HTMLElement - Replacement reference element to position popper relative to.
19
+ * @param children React.ReactNode - Returns the element to be positioned.
20
+ * @returns React popper component
21
+ */
22
+ function Popup(_ref) {
23
+ var referenceElement = _ref.referenceElement,
24
+ children = _ref.children;
25
+ return /*#__PURE__*/_react.default.createElement(_portal.default, null, /*#__PURE__*/_react.default.createElement(_popper.Popper, {
26
+ referenceElement: referenceElement,
27
+ offset: [0, 8],
28
+ placement: "bottom-end",
29
+ strategy: "fixed"
30
+ }, function (_ref2) {
31
+ var ref = _ref2.ref,
32
+ style = _ref2.style;
33
+ return (
34
+ /*#__PURE__*/
35
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
36
+ _react.default.createElement("div", {
37
+ ref: ref,
38
+ style: style
39
+ }, children)
40
+ );
41
+ }));
42
+ }
@@ -16,9 +16,8 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
16
16
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
17
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
18
18
  var _bindEventListener = require("bind-event-listener");
19
- var _ui = require("@atlaskit/editor-common/ui");
20
- var _portal = _interopRequireDefault(require("@atlaskit/portal"));
21
19
  var _user = require("@atlaskit/profilecard/user");
20
+ var _PopperWrapper = require("./PopperWrapper");
22
21
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
23
22
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
24
23
  var styles = {
@@ -169,14 +168,8 @@ function ProfileCardComponent(_ref4) {
169
168
  return null;
170
169
  }
171
170
  var cloudId = provider.cloudId;
172
- return /*#__PURE__*/React.createElement(_portal.default, null, /*#__PURE__*/React.createElement(_ui.Popup, {
173
- target: dom,
174
- absoluteOffset: {
175
- top: 8
176
- },
177
- stick: true
178
- }, /*#__PURE__*/React.createElement(_react.Suspense, {
179
- fallback: null
171
+ return /*#__PURE__*/React.createElement(_PopperWrapper.Popup, {
172
+ referenceElement: dom
180
173
  }, /*#__PURE__*/React.createElement(LoadingWrapper, {
181
174
  isLoading: isLoading
182
175
  }, /*#__PURE__*/React.createElement(_user.ProfileCardLazy, {
@@ -201,5 +194,5 @@ function ProfileCardComponent(_ref4) {
201
194
  reportingLines: reportingLinesData,
202
195
  isKudosEnabled: shouldShowGiveKudos,
203
196
  teamCentralBaseUrl: teamCentralBaseUrl
204
- })))));
197
+ })));
205
198
  }
@@ -15,7 +15,7 @@ export const ACTIONS = {
15
15
  SET_PROVIDER: 'SET_PROVIDER'
16
16
  };
17
17
  const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
18
- const PACKAGE_VERSION = "4.3.0";
18
+ const PACKAGE_VERSION = "4.3.2";
19
19
  const setProvider = provider => (state, dispatch) => {
20
20
  if (dispatch) {
21
21
  dispatch(state.tr.setMeta(mentionPluginKey, {
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { Popper as ReactPopper } from '@atlaskit/popper';
3
+ import Portal from '@atlaskit/portal';
4
+ /**
5
+ * A popup wrapper to match the behaviour of `@atlaskit/popup`
6
+ *
7
+ * Why not `@atlaskit/popup` directly? It requires a trigger element.
8
+ * We can use this when we have a direct reference to the element
9
+ * and it is more convenient to work directly with the lower level API.
10
+ *
11
+ * @param referenceElement HTMLElement - Replacement reference element to position popper relative to.
12
+ * @param children React.ReactNode - Returns the element to be positioned.
13
+ * @returns React popper component
14
+ */
15
+ export function Popup({
16
+ referenceElement,
17
+ children
18
+ }) {
19
+ return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(ReactPopper, {
20
+ referenceElement: referenceElement,
21
+ offset: [0, 8],
22
+ placement: "bottom-end",
23
+ strategy: "fixed"
24
+ }, ({
25
+ ref,
26
+ style
27
+ }) =>
28
+ /*#__PURE__*/
29
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
30
+ React.createElement("div", {
31
+ ref: ref,
32
+ style: style
33
+ }, children)));
34
+ }
@@ -2,11 +2,10 @@
2
2
  import "./ProfileCardComponent.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
- import { useEffect, useState, useMemo, Suspense } from 'react';
5
+ import { useEffect, useState, useMemo } from 'react';
6
6
  import { bind } from 'bind-event-listener';
7
- import { Popup } from '@atlaskit/editor-common/ui';
8
- import Portal from '@atlaskit/portal';
9
7
  import { ProfileCardLazy } from '@atlaskit/profilecard/user';
8
+ import { Popup } from './PopperWrapper';
10
9
  const styles = {
11
10
  loadingStyles: "_2rkoglpi _16qs1cd0"
12
11
  };
@@ -107,14 +106,8 @@ export function ProfileCardComponent({
107
106
  const {
108
107
  cloudId
109
108
  } = provider;
110
- return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(Popup, {
111
- target: dom,
112
- absoluteOffset: {
113
- top: 8
114
- },
115
- stick: true
116
- }, /*#__PURE__*/React.createElement(Suspense, {
117
- fallback: null
109
+ return /*#__PURE__*/React.createElement(Popup, {
110
+ referenceElement: dom
118
111
  }, /*#__PURE__*/React.createElement(LoadingWrapper, {
119
112
  isLoading: isLoading
120
113
  }, /*#__PURE__*/React.createElement(ProfileCardLazy, {
@@ -139,5 +132,5 @@ export function ProfileCardComponent({
139
132
  reportingLines: reportingLinesData,
140
133
  isKudosEnabled: shouldShowGiveKudos,
141
134
  teamCentralBaseUrl: teamCentralBaseUrl
142
- })))));
135
+ })));
143
136
  }
@@ -18,7 +18,7 @@ export var ACTIONS = {
18
18
  SET_PROVIDER: 'SET_PROVIDER'
19
19
  };
20
20
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
21
- var PACKAGE_VERSION = "4.3.0";
21
+ var PACKAGE_VERSION = "4.3.2";
22
22
  var setProvider = function setProvider(provider) {
23
23
  return function (state, dispatch) {
24
24
  if (dispatch) {
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { Popper as ReactPopper } from '@atlaskit/popper';
3
+ import Portal from '@atlaskit/portal';
4
+ /**
5
+ * A popup wrapper to match the behaviour of `@atlaskit/popup`
6
+ *
7
+ * Why not `@atlaskit/popup` directly? It requires a trigger element.
8
+ * We can use this when we have a direct reference to the element
9
+ * and it is more convenient to work directly with the lower level API.
10
+ *
11
+ * @param referenceElement HTMLElement - Replacement reference element to position popper relative to.
12
+ * @param children React.ReactNode - Returns the element to be positioned.
13
+ * @returns React popper component
14
+ */
15
+ export function Popup(_ref) {
16
+ var referenceElement = _ref.referenceElement,
17
+ children = _ref.children;
18
+ return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(ReactPopper, {
19
+ referenceElement: referenceElement,
20
+ offset: [0, 8],
21
+ placement: "bottom-end",
22
+ strategy: "fixed"
23
+ }, function (_ref2) {
24
+ var ref = _ref2.ref,
25
+ style = _ref2.style;
26
+ return (
27
+ /*#__PURE__*/
28
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
29
+ React.createElement("div", {
30
+ ref: ref,
31
+ style: style
32
+ }, children)
33
+ );
34
+ }));
35
+ }
@@ -5,11 +5,10 @@ import "./ProfileCardComponent.compiled.css";
5
5
  import * as React from 'react';
6
6
  import { ax, ix } from "@compiled/react/runtime";
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
- import { useEffect, useState, useMemo, Suspense } from 'react';
8
+ import { useEffect, useState, useMemo } from 'react';
9
9
  import { bind } from 'bind-event-listener';
10
- import { Popup } from '@atlaskit/editor-common/ui';
11
- import Portal from '@atlaskit/portal';
12
10
  import { ProfileCardLazy } from '@atlaskit/profilecard/user';
11
+ import { Popup } from './PopperWrapper';
13
12
  var styles = {
14
13
  loadingStyles: "_2rkoglpi _16qs1cd0"
15
14
  };
@@ -158,14 +157,8 @@ export function ProfileCardComponent(_ref4) {
158
157
  return null;
159
158
  }
160
159
  var cloudId = provider.cloudId;
161
- return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(Popup, {
162
- target: dom,
163
- absoluteOffset: {
164
- top: 8
165
- },
166
- stick: true
167
- }, /*#__PURE__*/React.createElement(Suspense, {
168
- fallback: null
160
+ return /*#__PURE__*/React.createElement(Popup, {
161
+ referenceElement: dom
169
162
  }, /*#__PURE__*/React.createElement(LoadingWrapper, {
170
163
  isLoading: isLoading
171
164
  }, /*#__PURE__*/React.createElement(ProfileCardLazy, {
@@ -190,5 +183,5 @@ export function ProfileCardComponent(_ref4) {
190
183
  reportingLines: reportingLinesData,
191
184
  isKudosEnabled: shouldShowGiveKudos,
192
185
  teamCentralBaseUrl: teamCentralBaseUrl
193
- })))));
186
+ })));
194
187
  }
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ /**
4
+ * Replacement reference element to position popper relative to.
5
+ */
6
+ referenceElement: HTMLElement;
7
+ /**
8
+ * Returns the element to be positioned.
9
+ */
10
+ children: React.ReactNode;
11
+ }
12
+ /**
13
+ * A popup wrapper to match the behaviour of `@atlaskit/popup`
14
+ *
15
+ * Why not `@atlaskit/popup` directly? It requires a trigger element.
16
+ * We can use this when we have a direct reference to the element
17
+ * and it is more convenient to work directly with the lower level API.
18
+ *
19
+ * @param referenceElement HTMLElement - Replacement reference element to position popper relative to.
20
+ * @param children React.ReactNode - Returns the element to be positioned.
21
+ * @returns React popper component
22
+ */
23
+ export declare function Popup({ referenceElement, children }: Props): React.JSX.Element;
24
+ export {};
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ /**
4
+ * Replacement reference element to position popper relative to.
5
+ */
6
+ referenceElement: HTMLElement;
7
+ /**
8
+ * Returns the element to be positioned.
9
+ */
10
+ children: React.ReactNode;
11
+ }
12
+ /**
13
+ * A popup wrapper to match the behaviour of `@atlaskit/popup`
14
+ *
15
+ * Why not `@atlaskit/popup` directly? It requires a trigger element.
16
+ * We can use this when we have a direct reference to the element
17
+ * and it is more convenient to work directly with the lower level API.
18
+ *
19
+ * @param referenceElement HTMLElement - Replacement reference element to position popper relative to.
20
+ * @param children React.ReactNode - Returns the element to be positioned.
21
+ * @returns React popper component
22
+ */
23
+ export declare function Popup({ referenceElement, children }: Props): React.JSX.Element;
24
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-mentions",
3
- "version": "4.3.0",
3
+ "version": "4.3.2",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^47.6.0",
37
37
  "@atlaskit/css": "^0.10.0",
38
- "@atlaskit/editor-common": "^102.18.0",
38
+ "@atlaskit/editor-common": "^103.0.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
40
40
  "@atlaskit/editor-plugin-base": "^2.3.0",
41
41
  "@atlaskit/editor-plugin-context-identifier": "^2.0.0",
@@ -45,11 +45,12 @@
45
45
  "@atlaskit/icon": "^25.5.0",
46
46
  "@atlaskit/mention": "^24.1.0",
47
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
+ "@atlaskit/popper": "^7.0.0",
48
49
  "@atlaskit/portal": "^5.1.0",
49
50
  "@atlaskit/profilecard": "^23.7.0",
50
51
  "@atlaskit/theme": "^18.0.0",
51
52
  "@atlaskit/tmp-editor-statsig": "^4.6.0",
52
- "@atlaskit/tokens": "^4.6.0",
53
+ "@atlaskit/tokens": "^4.7.0",
53
54
  "@babel/runtime": "^7.0.0",
54
55
  "@compiled/react": "^0.18.3",
55
56
  "bind-event-listener": "^3.0.0",