@atlaskit/inline-dialog 17.2.9 → 18.0.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,17 @@
1
1
  # @atlaskit/inline-dialog
2
2
 
3
+ ## 18.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`d636af20c6304`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d636af20c6304) -
8
+ This replaces `react-node-resolver` which uses `findDOMNode` under the hood with a direct `ref`
9
+ functionality to pass the first child of an Inline Dialog around for internal use.
10
+
11
+ There is some risk to this as while we tested this internally via a feature gate with no issues,
12
+ this could be breaking in the instance where the children you pass to `<InlineDialog />` is either
13
+ inconsistent, or the first element is not the target we expected.
14
+
3
15
  ## 17.2.9
4
16
 
5
17
  ### Patch Changes
@@ -11,9 +11,7 @@ var _bindEventListener = require("bind-event-listener");
11
11
  var _analyticsNext = require("@atlaskit/analytics-next");
12
12
  var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
13
13
  var _layering = require("@atlaskit/layering");
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  var _popper = require("@atlaskit/popper");
16
- var _nodeResolverWrapper = _interopRequireDefault(require("./node-resolver-wrapper"));
17
15
  var _container = require("./styled/container");
18
16
  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); }
19
17
  var _checkIsChildOfPortal = function checkIsChildOfPortal(node) {
@@ -176,17 +174,18 @@ var InlineDialog = /*#__PURE__*/(0, _react.memo)(function InlineDialog(_ref2) {
176
174
  }, typeof content === 'function' ? content() : content);
177
175
  }) : null;
178
176
  return /*#__PURE__*/_react.default.createElement(_popper.Manager, null, /*#__PURE__*/_react.default.createElement(_popper.Reference, null, function (_ref5) {
179
- var ref = _ref5.ref;
180
- return /*#__PURE__*/_react.default.createElement(_nodeResolverWrapper.default, {
181
- innerRef: function innerRef(node) {
182
- triggerRef.current = node;
183
- if (typeof ref === 'function') {
184
- ref(node);
177
+ var _ref6 = _ref5.ref;
178
+ return /*#__PURE__*/_react.default.createElement("div", {
179
+ ref: function ref(node) {
180
+ // Resolve to the first element child of the div in `children`
181
+ var firstElementChild = (node === null || node === void 0 ? void 0 : node.firstElementChild) || null;
182
+ triggerRef.current = firstElementChild;
183
+ if (typeof _ref6 === 'function') {
184
+ _ref6(firstElementChild);
185
185
  } else {
186
- ref.current = node;
186
+ _ref6.current = firstElementChild;
187
187
  }
188
- },
189
- hasNodeResolver: !(0, _platformFeatureFlags.fg)('platform_design_system_team_portal_logic_r18_fix')
188
+ }
190
189
  }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children));
191
190
  }), isOpen ? /*#__PURE__*/_react.default.createElement(_layering.Layering, {
192
191
  isDisabled: false
@@ -3,9 +3,7 @@ import { bind } from 'bind-event-listener';
3
3
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
4
4
  import noop from '@atlaskit/ds-lib/noop';
5
5
  import { Layering, useCloseOnEscapePress, useLayering } from '@atlaskit/layering';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { Manager, Popper, Reference } from '@atlaskit/popper';
8
- import NodeResolverWrapper from './node-resolver-wrapper';
9
7
  import { Container } from './styled/container';
10
8
  const checkIsChildOfPortal = node => {
11
9
  if (!node) {
@@ -161,16 +159,17 @@ const InlineDialog = /*#__PURE__*/memo(function InlineDialog({
161
159
  }, typeof content === 'function' ? content() : content)) : null;
162
160
  return /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement(Reference, null, ({
163
161
  ref
164
- }) => /*#__PURE__*/React.createElement(NodeResolverWrapper, {
165
- innerRef: node => {
166
- triggerRef.current = node;
162
+ }) => /*#__PURE__*/React.createElement("div", {
163
+ ref: node => {
164
+ // Resolve to the first element child of the div in `children`
165
+ const firstElementChild = (node === null || node === void 0 ? void 0 : node.firstElementChild) || null;
166
+ triggerRef.current = firstElementChild;
167
167
  if (typeof ref === 'function') {
168
- ref(node);
168
+ ref(firstElementChild);
169
169
  } else {
170
- ref.current = node;
170
+ ref.current = firstElementChild;
171
171
  }
172
- },
173
- hasNodeResolver: !fg('platform_design_system_team_portal_logic_r18_fix')
172
+ }
174
173
  }, /*#__PURE__*/React.createElement(React.Fragment, null, children))), isOpen ? /*#__PURE__*/React.createElement(Layering, {
175
174
  isDisabled: false
176
175
  }, popper, /*#__PURE__*/React.createElement(CloseManager, {
@@ -3,9 +3,7 @@ import { bind } from 'bind-event-listener';
3
3
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
4
4
  import noop from '@atlaskit/ds-lib/noop';
5
5
  import { Layering, useCloseOnEscapePress, useLayering } from '@atlaskit/layering';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { Manager, Popper, Reference } from '@atlaskit/popper';
8
- import NodeResolverWrapper from './node-resolver-wrapper';
9
7
  import { Container } from './styled/container';
10
8
  var _checkIsChildOfPortal = function checkIsChildOfPortal(node) {
11
9
  if (!node) {
@@ -167,17 +165,18 @@ var InlineDialog = /*#__PURE__*/memo(function InlineDialog(_ref2) {
167
165
  }, typeof content === 'function' ? content() : content);
168
166
  }) : null;
169
167
  return /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement(Reference, null, function (_ref5) {
170
- var ref = _ref5.ref;
171
- return /*#__PURE__*/React.createElement(NodeResolverWrapper, {
172
- innerRef: function innerRef(node) {
173
- triggerRef.current = node;
174
- if (typeof ref === 'function') {
175
- ref(node);
168
+ var _ref6 = _ref5.ref;
169
+ return /*#__PURE__*/React.createElement("div", {
170
+ ref: function ref(node) {
171
+ // Resolve to the first element child of the div in `children`
172
+ var firstElementChild = (node === null || node === void 0 ? void 0 : node.firstElementChild) || null;
173
+ triggerRef.current = firstElementChild;
174
+ if (typeof _ref6 === 'function') {
175
+ _ref6(firstElementChild);
176
176
  } else {
177
- ref.current = node;
177
+ _ref6.current = firstElementChild;
178
178
  }
179
- },
180
- hasNodeResolver: !fg('platform_design_system_team_portal_logic_r18_fix')
179
+ }
181
180
  }, /*#__PURE__*/React.createElement(React.Fragment, null, children));
182
181
  }), isOpen ? /*#__PURE__*/React.createElement(Layering, {
183
182
  isDisabled: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-dialog",
3
- "version": "17.2.9",
3
+ "version": "18.0.0",
4
4
  "description": "An inline dialog is a pop-up container for small amounts of information. It can also contain controls.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,11 +40,10 @@
40
40
  "@atlaskit/platform-feature-flags": "^1.1.0",
41
41
  "@atlaskit/popper": "^7.1.0",
42
42
  "@atlaskit/theme": "^20.0.0",
43
- "@atlaskit/tokens": "^6.1.0",
43
+ "@atlaskit/tokens": "^6.3.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@compiled/react": "^0.18.3",
46
- "bind-event-listener": "^3.0.0",
47
- "react-node-resolver": "^1.0.1"
46
+ "bind-event-listener": "^3.0.0"
48
47
  },
49
48
  "peerDependencies": {
50
49
  "react": "^18.2.0"
@@ -54,18 +53,17 @@
54
53
  "@af/integration-testing": "workspace:^",
55
54
  "@af/visual-regression": "workspace:^",
56
55
  "@atlaskit/button": "^23.4.0",
57
- "@atlaskit/css": "^0.12.0",
56
+ "@atlaskit/css": "^0.14.0",
58
57
  "@atlaskit/datetime-picker": "^17.0.0",
59
58
  "@atlaskit/docs": "^11.0.0",
60
59
  "@atlaskit/dropdown-menu": "^16.3.0",
61
60
  "@atlaskit/link": "^3.2.0",
62
61
  "@atlaskit/modal-dialog": "^14.3.0",
63
- "@atlaskit/primitives": "^14.12.0",
62
+ "@atlaskit/primitives": "^14.14.0",
64
63
  "@atlaskit/section-message": "^8.7.0",
65
64
  "@atlaskit/select": "^21.2.0",
66
65
  "@atlassian/ssr-tests": "^0.3.0",
67
66
  "@testing-library/react": "^13.4.0",
68
- "@types/react-node-resolver": "^2.0.0",
69
67
  "react-dom": "^18.2.0",
70
68
  "react-lorem-component": "^0.13.0"
71
69
  },
@@ -105,9 +103,6 @@
105
103
  }
106
104
  },
107
105
  "platform-feature-flags": {
108
- "platform_design_system_team_portal_logic_r18_fix": {
109
- "type": "boolean"
110
- },
111
106
  "dst-a11y__replace-anchor-with-link__design-system-": {
112
107
  "type": "boolean"
113
108
  }
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _reactNodeResolver = _interopRequireDefault(require("react-node-resolver"));
10
- /**
11
- * A wrapper component that conditionally applies a NodeResolver to its children.
12
- *
13
- * Note: NodeResolver should not be used in React 18 concurrent mode. This component
14
- * is intended to be removed once the feature flag is removed.
15
- * @param {boolean} props.hasNodeResolver - Determines whether to apply the NodeResolver.
16
- * @param {ReactElement} props.children - The child elements to be wrapped.
17
- * @param {(instance: HTMLDivElement) => void} props.innerRef - A ref callback to get the instance of the HTMLDivElement.
18
- * @returns {ReactElement} The children wrapped with NodeResolver if hasNodeResolver is true, wrape the children in a div setting innerRef with ref to the div.
19
- */
20
- var NodeResolverWrapper = function NodeResolverWrapper(_ref) {
21
- var hasNodeResolver = _ref.hasNodeResolver,
22
- children = _ref.children,
23
- innerRef = _ref.innerRef;
24
- if (hasNodeResolver) {
25
- return /*#__PURE__*/_react.default.createElement(_reactNodeResolver.default, {
26
- innerRef: innerRef
27
- }, children);
28
- }
29
- return /*#__PURE__*/_react.default.createElement("div", {
30
- ref: function ref(node) {
31
- innerRef(node === null || node === void 0 ? void 0 : node.firstElementChild);
32
- }
33
- }, children);
34
- };
35
- var _default = exports.default = NodeResolverWrapper;
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
- import NodeResolver from 'react-node-resolver';
3
- /**
4
- * A wrapper component that conditionally applies a NodeResolver to its children.
5
- *
6
- * Note: NodeResolver should not be used in React 18 concurrent mode. This component
7
- * is intended to be removed once the feature flag is removed.
8
- * @param {boolean} props.hasNodeResolver - Determines whether to apply the NodeResolver.
9
- * @param {ReactElement} props.children - The child elements to be wrapped.
10
- * @param {(instance: HTMLDivElement) => void} props.innerRef - A ref callback to get the instance of the HTMLDivElement.
11
- * @returns {ReactElement} The children wrapped with NodeResolver if hasNodeResolver is true, wrape the children in a div setting innerRef with ref to the div.
12
- */
13
- const NodeResolverWrapper = ({
14
- hasNodeResolver,
15
- children,
16
- innerRef
17
- }) => {
18
- if (hasNodeResolver) {
19
- return /*#__PURE__*/React.createElement(NodeResolver, {
20
- innerRef: innerRef
21
- }, children);
22
- }
23
- return /*#__PURE__*/React.createElement("div", {
24
- ref: node => {
25
- innerRef(node === null || node === void 0 ? void 0 : node.firstElementChild);
26
- }
27
- }, children);
28
- };
29
- export default NodeResolverWrapper;
@@ -1,28 +0,0 @@
1
- import React from 'react';
2
- import NodeResolver from 'react-node-resolver';
3
- /**
4
- * A wrapper component that conditionally applies a NodeResolver to its children.
5
- *
6
- * Note: NodeResolver should not be used in React 18 concurrent mode. This component
7
- * is intended to be removed once the feature flag is removed.
8
- * @param {boolean} props.hasNodeResolver - Determines whether to apply the NodeResolver.
9
- * @param {ReactElement} props.children - The child elements to be wrapped.
10
- * @param {(instance: HTMLDivElement) => void} props.innerRef - A ref callback to get the instance of the HTMLDivElement.
11
- * @returns {ReactElement} The children wrapped with NodeResolver if hasNodeResolver is true, wrape the children in a div setting innerRef with ref to the div.
12
- */
13
- var NodeResolverWrapper = function NodeResolverWrapper(_ref) {
14
- var hasNodeResolver = _ref.hasNodeResolver,
15
- children = _ref.children,
16
- innerRef = _ref.innerRef;
17
- if (hasNodeResolver) {
18
- return /*#__PURE__*/React.createElement(NodeResolver, {
19
- innerRef: innerRef
20
- }, children);
21
- }
22
- return /*#__PURE__*/React.createElement("div", {
23
- ref: function ref(node) {
24
- innerRef(node === null || node === void 0 ? void 0 : node.firstElementChild);
25
- }
26
- }, children);
27
- };
28
- export default NodeResolverWrapper;
@@ -1,18 +0,0 @@
1
- import React, { type FC, type ReactElement } from 'react';
2
- interface NodeResolverWrapperProps {
3
- hasNodeResolver: boolean;
4
- innerRef: React.RefCallback<Element>;
5
- children: ReactElement;
6
- }
7
- /**
8
- * A wrapper component that conditionally applies a NodeResolver to its children.
9
- *
10
- * Note: NodeResolver should not be used in React 18 concurrent mode. This component
11
- * is intended to be removed once the feature flag is removed.
12
- * @param {boolean} props.hasNodeResolver - Determines whether to apply the NodeResolver.
13
- * @param {ReactElement} props.children - The child elements to be wrapped.
14
- * @param {(instance: HTMLDivElement) => void} props.innerRef - A ref callback to get the instance of the HTMLDivElement.
15
- * @returns {ReactElement} The children wrapped with NodeResolver if hasNodeResolver is true, wrape the children in a div setting innerRef with ref to the div.
16
- */
17
- declare const NodeResolverWrapper: FC<NodeResolverWrapperProps>;
18
- export default NodeResolverWrapper;
@@ -1,18 +0,0 @@
1
- import React, { type FC, type ReactElement } from 'react';
2
- interface NodeResolverWrapperProps {
3
- hasNodeResolver: boolean;
4
- innerRef: React.RefCallback<Element>;
5
- children: ReactElement;
6
- }
7
- /**
8
- * A wrapper component that conditionally applies a NodeResolver to its children.
9
- *
10
- * Note: NodeResolver should not be used in React 18 concurrent mode. This component
11
- * is intended to be removed once the feature flag is removed.
12
- * @param {boolean} props.hasNodeResolver - Determines whether to apply the NodeResolver.
13
- * @param {ReactElement} props.children - The child elements to be wrapped.
14
- * @param {(instance: HTMLDivElement) => void} props.innerRef - A ref callback to get the instance of the HTMLDivElement.
15
- * @returns {ReactElement} The children wrapped with NodeResolver if hasNodeResolver is true, wrape the children in a div setting innerRef with ref to the div.
16
- */
17
- declare const NodeResolverWrapper: FC<NodeResolverWrapperProps>;
18
- export default NodeResolverWrapper;