@atlaskit/inline-dialog 17.2.8 → 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 +20 -0
- package/dist/cjs/InlineDialog/index.js +11 -12
- package/dist/cjs/InlineDialog/styled/container.compiled.css +1 -1
- package/dist/cjs/InlineDialog/styled/container.js +1 -1
- package/dist/es2019/InlineDialog/index.js +9 -10
- package/dist/es2019/InlineDialog/styled/container.compiled.css +1 -1
- package/dist/es2019/InlineDialog/styled/container.js +1 -1
- package/dist/esm/InlineDialog/index.js +11 -12
- package/dist/esm/InlineDialog/styled/container.compiled.css +1 -1
- package/dist/esm/InlineDialog/styled/container.js +1 -1
- package/package.json +6 -15
- package/dist/cjs/InlineDialog/node-resolver-wrapper.js +0 -35
- package/dist/es2019/InlineDialog/node-resolver-wrapper.js +0 -29
- package/dist/esm/InlineDialog/node-resolver-wrapper.js +0 -28
- package/dist/types/InlineDialog/node-resolver-wrapper.d.ts +0 -18
- package/dist/types-ts4.5/InlineDialog/node-resolver-wrapper.d.ts +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
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
|
+
|
|
15
|
+
## 17.2.9
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`255837cfba315`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/255837cfba315) -
|
|
20
|
+
Internal changes to how border radius is applied.
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 17.2.8
|
|
4
24
|
|
|
5
25
|
### 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) {
|
|
@@ -78,7 +76,7 @@ var InlineDialog = /*#__PURE__*/(0, _react.memo)(function InlineDialog(_ref2) {
|
|
|
78
76
|
action: 'closed',
|
|
79
77
|
componentName: 'inlineDialog',
|
|
80
78
|
packageName: "@atlaskit/inline-dialog",
|
|
81
|
-
packageVersion: "
|
|
79
|
+
packageVersion: "0.0.0-development"
|
|
82
80
|
});
|
|
83
81
|
|
|
84
82
|
// we put this into a ref to avoid handleCloseRequest having this as a dependency
|
|
@@ -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
|
|
180
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
-
|
|
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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
._11q717w6{background:var(--_902zhz)}
|
|
2
|
-
.
|
|
2
|
+
._2rkofajl{border-radius:var(--ds-radius-small,3px)}
|
|
3
3
|
._16qs11gm{box-shadow:var(--_uojrza)}
|
|
4
4
|
._1pbyowjs{z-index:300}
|
|
5
5
|
._1q51pxbi{padding-block-start:var(--ds-space-200,1pc)}
|
|
@@ -42,7 +42,7 @@ var Container = exports.Container = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
42
42
|
ref: ref
|
|
43
43
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
44
44
|
,
|
|
45
|
-
className: (0, _runtime.ax)(["_11q717w6
|
|
45
|
+
className: (0, _runtime.ax)(["_11q717w6 _2rkofajl _vchh1ntv _p12f184t _c71l184t _1pbyowjs _16qs11gm _syaz1xgh _85i5pxbi _1q51pxbi _y4ti1ejb _bozg1ejb _nt751r31 _49pcglyw _1hvw1o36"]),
|
|
46
46
|
style: _objectSpread(_objectSpread({}, _objectSpread((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, CSS_THEME_BACKGROUND, "var(--ds-surface-overlay, ".concat(_colors.N0, ")")), CSS_THEME_COLOR, "var(--ds-text, ".concat(_colors.N900, ")")), CSS_THEME_BOX_SHADOW, "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N50A, ", 0 0 1px ").concat(_colors.N60A), ")")), style)), {}, {
|
|
47
47
|
"--_n6nwya": (0, _runtime.ix)("".concat(8 * 56, "px")),
|
|
48
48
|
"--_902zhz": (0, _runtime.ix)("var(".concat(CSS_THEME_BACKGROUND, ")")),
|
|
@@ -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) {
|
|
@@ -63,7 +61,7 @@ const InlineDialog = /*#__PURE__*/memo(function InlineDialog({
|
|
|
63
61
|
action: 'closed',
|
|
64
62
|
componentName: 'inlineDialog',
|
|
65
63
|
packageName: "@atlaskit/inline-dialog",
|
|
66
|
-
packageVersion: "
|
|
64
|
+
packageVersion: "0.0.0-development"
|
|
67
65
|
});
|
|
68
66
|
|
|
69
67
|
// we put this into a ref to avoid handleCloseRequest having this as a dependency
|
|
@@ -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(
|
|
165
|
-
|
|
166
|
-
|
|
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(
|
|
168
|
+
ref(firstElementChild);
|
|
169
169
|
} else {
|
|
170
|
-
ref.current =
|
|
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, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
._11q7gluh{background:var(--theme-background)}
|
|
2
|
-
.
|
|
2
|
+
._2rkofajl{border-radius:var(--ds-radius-small,3px)}
|
|
3
3
|
._16qs1r44{box-shadow:var(--theme-box-shadow)}
|
|
4
4
|
._1pbyowjs{z-index:300}
|
|
5
5
|
._1q51pxbi{padding-block-start:var(--ds-space-200,1pc)}
|
|
@@ -37,6 +37,6 @@ export const Container = /*#__PURE__*/forwardRef(({
|
|
|
37
37
|
[CSS_THEME_BOX_SHADOW]: `var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})`,
|
|
38
38
|
...style
|
|
39
39
|
},
|
|
40
|
-
className: ax(["_11q7gluh
|
|
40
|
+
className: ax(["_11q7gluh _2rkofajl _vchh1ntv _p12flti4 _c71llti4 _1pbyowjs _16qs1r44 _syazjslb _85i5pxbi _1q51pxbi _y4ti1ejb _bozg1ejb _nt751r31 _49pcglyw _1hvw1o36"])
|
|
41
41
|
}, typeof children === 'function' ? children() : children);
|
|
42
42
|
});
|
|
@@ -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) {
|
|
@@ -69,7 +67,7 @@ var InlineDialog = /*#__PURE__*/memo(function InlineDialog(_ref2) {
|
|
|
69
67
|
action: 'closed',
|
|
70
68
|
componentName: 'inlineDialog',
|
|
71
69
|
packageName: "@atlaskit/inline-dialog",
|
|
72
|
-
packageVersion: "
|
|
70
|
+
packageVersion: "0.0.0-development"
|
|
73
71
|
});
|
|
74
72
|
|
|
75
73
|
// we put this into a ref to avoid handleCloseRequest having this as a dependency
|
|
@@ -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
|
|
171
|
-
return /*#__PURE__*/React.createElement(
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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
|
-
|
|
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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
._11q717w6{background:var(--_902zhz)}
|
|
2
|
-
.
|
|
2
|
+
._2rkofajl{border-radius:var(--ds-radius-small,3px)}
|
|
3
3
|
._16qs11gm{box-shadow:var(--_uojrza)}
|
|
4
4
|
._1pbyowjs{z-index:300}
|
|
5
5
|
._1q51pxbi{padding-block-start:var(--ds-space-200,1pc)}
|
|
@@ -33,7 +33,7 @@ export var Container = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
33
33
|
ref: ref
|
|
34
34
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
35
35
|
,
|
|
36
|
-
className: ax(["_11q717w6
|
|
36
|
+
className: ax(["_11q717w6 _2rkofajl _vchh1ntv _p12f184t _c71l184t _1pbyowjs _16qs11gm _syaz1xgh _85i5pxbi _1q51pxbi _y4ti1ejb _bozg1ejb _nt751r31 _49pcglyw _1hvw1o36"]),
|
|
37
37
|
style: _objectSpread(_objectSpread({}, _objectSpread(_defineProperty(_defineProperty(_defineProperty({}, CSS_THEME_BACKGROUND, "var(--ds-surface-overlay, ".concat(N0, ")")), CSS_THEME_COLOR, "var(--ds-text, ".concat(N900, ")")), CSS_THEME_BOX_SHADOW, "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N50A, ", 0 0 1px ").concat(N60A), ")")), style)), {}, {
|
|
38
38
|
"--_n6nwya": ix("".concat(8 * 56, "px")),
|
|
39
39
|
"--_902zhz": ix("var(".concat(CSS_THEME_BACKGROUND, ")")),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/inline-dialog",
|
|
3
|
-
"version": "
|
|
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/"
|
|
@@ -16,10 +16,6 @@
|
|
|
16
16
|
"**/*.compiled.css"
|
|
17
17
|
],
|
|
18
18
|
"atlaskit:src": "src/index.tsx",
|
|
19
|
-
"af:exports": {
|
|
20
|
-
".": "./src/index.tsx",
|
|
21
|
-
"./types": "./src/types.tsx"
|
|
22
|
-
},
|
|
23
19
|
"atlassian": {
|
|
24
20
|
"team": "Design System Team",
|
|
25
21
|
"website": {
|
|
@@ -44,11 +40,10 @@
|
|
|
44
40
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
41
|
"@atlaskit/popper": "^7.1.0",
|
|
46
42
|
"@atlaskit/theme": "^20.0.0",
|
|
47
|
-
"@atlaskit/tokens": "^6.
|
|
43
|
+
"@atlaskit/tokens": "^6.3.0",
|
|
48
44
|
"@babel/runtime": "^7.0.0",
|
|
49
45
|
"@compiled/react": "^0.18.3",
|
|
50
|
-
"bind-event-listener": "^3.0.0"
|
|
51
|
-
"react-node-resolver": "^1.0.1"
|
|
46
|
+
"bind-event-listener": "^3.0.0"
|
|
52
47
|
},
|
|
53
48
|
"peerDependencies": {
|
|
54
49
|
"react": "^18.2.0"
|
|
@@ -58,18 +53,17 @@
|
|
|
58
53
|
"@af/integration-testing": "workspace:^",
|
|
59
54
|
"@af/visual-regression": "workspace:^",
|
|
60
55
|
"@atlaskit/button": "^23.4.0",
|
|
61
|
-
"@atlaskit/css": "^0.
|
|
56
|
+
"@atlaskit/css": "^0.14.0",
|
|
62
57
|
"@atlaskit/datetime-picker": "^17.0.0",
|
|
63
58
|
"@atlaskit/docs": "^11.0.0",
|
|
64
59
|
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
65
60
|
"@atlaskit/link": "^3.2.0",
|
|
66
61
|
"@atlaskit/modal-dialog": "^14.3.0",
|
|
67
|
-
"@atlaskit/primitives": "^14.
|
|
68
|
-
"@atlaskit/section-message": "^8.
|
|
62
|
+
"@atlaskit/primitives": "^14.14.0",
|
|
63
|
+
"@atlaskit/section-message": "^8.7.0",
|
|
69
64
|
"@atlaskit/select": "^21.2.0",
|
|
70
65
|
"@atlassian/ssr-tests": "^0.3.0",
|
|
71
66
|
"@testing-library/react": "^13.4.0",
|
|
72
|
-
"@types/react-node-resolver": "^2.0.0",
|
|
73
67
|
"react-dom": "^18.2.0",
|
|
74
68
|
"react-lorem-component": "^0.13.0"
|
|
75
69
|
},
|
|
@@ -109,9 +103,6 @@
|
|
|
109
103
|
}
|
|
110
104
|
},
|
|
111
105
|
"platform-feature-flags": {
|
|
112
|
-
"platform_design_system_team_portal_logic_r18_fix": {
|
|
113
|
-
"type": "boolean"
|
|
114
|
-
},
|
|
115
106
|
"dst-a11y__replace-anchor-with-link__design-system-": {
|
|
116
107
|
"type": "boolean"
|
|
117
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;
|