@atlaskit/link-create 1.9.0 → 1.9.1
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 +6 -0
- package/dist/cjs/ui/create-form/main.js +10 -2
- package/dist/cjs/ui/link-create/confirm-dismiss-dialog/main.js +1 -1
- package/dist/cjs/ui/link-create/main.js +32 -34
- package/dist/cjs/ui/main.js +1 -1
- package/dist/es2019/ui/create-form/main.js +10 -2
- package/dist/es2019/ui/link-create/confirm-dismiss-dialog/main.js +1 -1
- package/dist/es2019/ui/link-create/main.js +11 -12
- package/dist/es2019/ui/main.js +1 -1
- package/dist/esm/ui/create-form/main.js +10 -2
- package/dist/esm/ui/link-create/confirm-dismiss-dialog/main.js +1 -1
- package/dist/esm/ui/link-create/main.js +30 -33
- package/dist/esm/ui/main.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/link-create
|
|
2
2
|
|
|
3
|
+
## 1.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#43170](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43170) [`959e2b89af9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/959e2b89af9) - Change exit warning modal to show only when fields have been modified by user
|
|
8
|
+
|
|
3
9
|
## 1.9.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -118,10 +118,18 @@ var CreateForm = exports.CreateForm = function CreateForm(_ref) {
|
|
|
118
118
|
css: formStyles
|
|
119
119
|
}, (0, _react2.jsx)(_reactFinalForm.FormSpy, {
|
|
120
120
|
subscription: {
|
|
121
|
-
|
|
121
|
+
modified: true
|
|
122
122
|
},
|
|
123
123
|
onChange: function onChange(state) {
|
|
124
|
-
|
|
124
|
+
// determine if any of the fields have been modified
|
|
125
|
+
if (!state.modified) {
|
|
126
|
+
setShouldShowWarning(false);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
var isModified = Object.values(state.modified).some(function (value) {
|
|
130
|
+
return value;
|
|
131
|
+
});
|
|
132
|
+
setShouldShowWarning(isModified);
|
|
125
133
|
}
|
|
126
134
|
}), (0, _react2.jsx)(_primitives.Box, null, children), !hideFooter && (0, _react2.jsx)(_formFooter.CreateFormFooter, {
|
|
127
135
|
formErrorMessage: formErrorMessage,
|
|
@@ -41,7 +41,7 @@ var ConfirmDismissDialog = exports.ConfirmDismissDialog = function ConfirmDismis
|
|
|
41
41
|
onClose: onCancelDismiss,
|
|
42
42
|
width: "small"
|
|
43
43
|
}, /*#__PURE__*/_react.default.createElement(_components.ScreenViewedEvent, {
|
|
44
|
-
screen:
|
|
44
|
+
screen: screen
|
|
45
45
|
}), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalHeader, null, /*#__PURE__*/_react.default.createElement(_modalDialog.ModalTitle, null, intl.formatMessage(_messages.default.title))), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalBody, null, intl.formatMessage(_messages.default.description)), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_Button.Button, {
|
|
46
46
|
actionSubjectId: "cancel",
|
|
47
47
|
appearance: "subtle",
|
|
@@ -10,7 +10,6 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
14
13
|
var _react = require("react");
|
|
15
14
|
var _react2 = require("@emotion/react");
|
|
16
15
|
var _reactIntlNext = require("react-intl-next");
|
|
@@ -28,11 +27,10 @@ var _editModal = require("./edit-modal");
|
|
|
28
27
|
var _errorBoundary = require("./error-boundary");
|
|
29
28
|
var _messages = require("./messages");
|
|
30
29
|
var _trackMount = _interopRequireDefault(require("./track-mount"));
|
|
31
|
-
var _excluded = ["testId", "triggeredFrom"],
|
|
32
|
-
_excluded2 = ["active", "modalTitle", "onCreate", "onFailure", "onCancel", "onOpenComplete", "onCloseComplete"];
|
|
33
|
-
/** @jsx jsx */
|
|
34
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
31
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
32
|
+
/** @jsx jsx */
|
|
33
|
+
|
|
36
34
|
var TEST_ID = exports.TEST_ID = 'link-create';
|
|
37
35
|
var LinkCreateContent = function LinkCreateContent(_ref) {
|
|
38
36
|
var plugins = _ref.plugins,
|
|
@@ -45,29 +43,24 @@ var LinkCreateContent = function LinkCreateContent(_ref) {
|
|
|
45
43
|
}
|
|
46
44
|
return (0, _react2.jsx)(_react.Fragment, null, chosenOne.form);
|
|
47
45
|
};
|
|
48
|
-
var
|
|
49
|
-
var
|
|
46
|
+
var LinkCreateWithModal = function LinkCreateWithModal(_ref2) {
|
|
47
|
+
var active = _ref2.active,
|
|
48
|
+
modalTitle = _ref2.modalTitle,
|
|
49
|
+
onCreate = _ref2.onCreate,
|
|
50
|
+
onFailure = _ref2.onFailure,
|
|
51
|
+
onCancel = _ref2.onCancel,
|
|
52
|
+
onComplete = _ref2.onComplete,
|
|
53
|
+
onOpenComplete = _ref2.onOpenComplete,
|
|
54
|
+
onCloseComplete = _ref2.onCloseComplete,
|
|
55
|
+
_ref2$testId = _ref2.testId,
|
|
50
56
|
testId = _ref2$testId === void 0 ? TEST_ID : _ref2$testId,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return (0, _react2.jsx)(_primitives.Box, {
|
|
54
|
-
testId: testId
|
|
55
|
-
}, (0, _react2.jsx)(_errorBoundary.ErrorBoundary, null, (0, _react2.jsx)(_trackMount.default, null), (0, _react2.jsx)(LinkCreateContent, restProps)));
|
|
56
|
-
};
|
|
57
|
-
var LinkCreateWithModal = function LinkCreateWithModal(_ref3) {
|
|
58
|
-
var active = _ref3.active,
|
|
59
|
-
modalTitle = _ref3.modalTitle,
|
|
60
|
-
onCreate = _ref3.onCreate,
|
|
61
|
-
onFailure = _ref3.onFailure,
|
|
62
|
-
onCancel = _ref3.onCancel,
|
|
63
|
-
onOpenComplete = _ref3.onOpenComplete,
|
|
64
|
-
onCloseComplete = _ref3.onCloseComplete,
|
|
65
|
-
createProps = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
|
|
57
|
+
plugins = _ref2.plugins,
|
|
58
|
+
entityKey = _ref2.entityKey;
|
|
66
59
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
67
60
|
var _useFormContext = (0, _formContext.useFormContext)(),
|
|
68
61
|
setFormErrorMessage = _useFormContext.setFormErrorMessage;
|
|
69
62
|
var handleCreate = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
70
|
-
var
|
|
63
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(result) {
|
|
71
64
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
72
65
|
while (1) switch (_context.prev = _context.next) {
|
|
73
66
|
case 0:
|
|
@@ -86,7 +79,7 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref3) {
|
|
|
86
79
|
}, _callee);
|
|
87
80
|
}));
|
|
88
81
|
return function (_x) {
|
|
89
|
-
return
|
|
82
|
+
return _ref3.apply(this, arguments);
|
|
90
83
|
};
|
|
91
84
|
}(), [onCreate, setFormErrorMessage]);
|
|
92
85
|
var handleFailure = (0, _react.useCallback)(function (error) {
|
|
@@ -123,9 +116,14 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref3) {
|
|
|
123
116
|
onOpenComplete: onOpenComplete,
|
|
124
117
|
onCloseComplete: onCloseComplete,
|
|
125
118
|
width: "".concat(_constants.CREATE_FORM_MAX_WIDTH_IN_PX, "px")
|
|
126
|
-
}, (0, _react2.jsx)(_modalDialog.ModalHeader, null, (0, _react2.jsx)(_modalDialog.ModalTitle, null, modalTitle || intl.formatMessage(_messages.messages.heading))), (0, _react2.jsx)(_modalDialog.ModalBody, null, (0, _react2.jsx)(
|
|
119
|
+
}, (0, _react2.jsx)(_modalDialog.ModalHeader, null, (0, _react2.jsx)(_modalDialog.ModalTitle, null, modalTitle || intl.formatMessage(_messages.messages.heading))), (0, _react2.jsx)(_modalDialog.ModalBody, null, (0, _react2.jsx)(_primitives.Box, {
|
|
120
|
+
testId: testId
|
|
121
|
+
}, (0, _react2.jsx)(_errorBoundary.ErrorBoundary, null, (0, _react2.jsx)(_trackMount.default, null), (0, _react2.jsx)(LinkCreateContent, {
|
|
122
|
+
plugins: plugins,
|
|
123
|
+
entityKey: entityKey
|
|
124
|
+
})))))), (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.enable-edit') && onComplete && (0, _react2.jsx)(_editModal.EditModal, {
|
|
127
125
|
onCloseComplete: onCloseComplete,
|
|
128
|
-
onClose:
|
|
126
|
+
onClose: onComplete
|
|
129
127
|
}), (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.confirm-dismiss-dialog') && (0, _react2.jsx)(_confirmDismissDialog.ConfirmDismissDialog, {
|
|
130
128
|
active: showExitWarning,
|
|
131
129
|
onClose: handleCloseExitWarning
|
|
@@ -150,18 +148,18 @@ var LinkCreateModal = function LinkCreateModal(props) {
|
|
|
150
148
|
}, function (pluginsProvider) {
|
|
151
149
|
return (0, _react2.jsx)(_editPostCreateContext.EditPostCreateModalProvider, {
|
|
152
150
|
active: !!props.active
|
|
153
|
-
}, function (
|
|
151
|
+
}, function (_ref4) {
|
|
154
152
|
var _pluginsProvider$acti;
|
|
155
|
-
var setEditViewPayload =
|
|
156
|
-
editViewPayload =
|
|
157
|
-
shouldActivateEditView =
|
|
158
|
-
enableEditView =
|
|
153
|
+
var setEditViewPayload = _ref4.setEditViewPayload,
|
|
154
|
+
editViewPayload = _ref4.editViewPayload,
|
|
155
|
+
shouldActivateEditView = _ref4.shouldActivateEditView,
|
|
156
|
+
enableEditView = _ref4.enableEditView;
|
|
159
157
|
return (0, _react2.jsx)(_formContext.FormContextProvider, {
|
|
160
158
|
enableEditView: pluginsProvider !== null && pluginsProvider !== void 0 && (_pluginsProvider$acti = pluginsProvider.activePlugin) !== null && _pluginsProvider$acti !== void 0 && _pluginsProvider$acti.editView && props !== null && props !== void 0 && props.onComplete ? enableEditView : undefined
|
|
161
159
|
}, (0, _react2.jsx)(_exitWarningModalContext.ExitWarningModalProvider, null, (0, _react2.jsx)(LinkCreateWithModal, (0, _extends2.default)({}, props, {
|
|
162
160
|
active: props.active && !editViewPayload,
|
|
163
161
|
onCreate: /*#__PURE__*/function () {
|
|
164
|
-
var
|
|
162
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(payload) {
|
|
165
163
|
var _props$onCreate;
|
|
166
164
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
167
165
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -186,7 +184,7 @@ var LinkCreateModal = function LinkCreateModal(props) {
|
|
|
186
184
|
}, _callee2);
|
|
187
185
|
}));
|
|
188
186
|
return function (_x2) {
|
|
189
|
-
return
|
|
187
|
+
return _ref5.apply(this, arguments);
|
|
190
188
|
};
|
|
191
189
|
}(),
|
|
192
190
|
onCloseComplete: function onCloseComplete() {
|
|
@@ -204,7 +202,7 @@ var LinkCreateModal = function LinkCreateModal(props) {
|
|
|
204
202
|
}
|
|
205
203
|
return (0, _react2.jsx)(_formContext.FormContextProvider, null, (0, _react2.jsx)(_exitWarningModalContext.ExitWarningModalProvider, null, (0, _react2.jsx)(LinkCreateWithModal, (0, _extends2.default)({}, props, {
|
|
206
204
|
onCreate: /*#__PURE__*/function () {
|
|
207
|
-
var
|
|
205
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(payload) {
|
|
208
206
|
var _props$onCreate2, _props$onComplete;
|
|
209
207
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
210
208
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -220,7 +218,7 @@ var LinkCreateModal = function LinkCreateModal(props) {
|
|
|
220
218
|
}, _callee3);
|
|
221
219
|
}));
|
|
222
220
|
return function (_x3) {
|
|
223
|
-
return
|
|
221
|
+
return _ref6.apply(this, arguments);
|
|
224
222
|
};
|
|
225
223
|
}()
|
|
226
224
|
}))));
|
package/dist/cjs/ui/main.js
CHANGED
|
@@ -35,7 +35,7 @@ var LinkCreateWithAnalyticsContext = (0, _analytics.withLinkCreateAnalyticsConte
|
|
|
35
35
|
}));
|
|
36
36
|
var PACKAGE_DATA = exports.PACKAGE_DATA = {
|
|
37
37
|
packageName: "@atlaskit/link-create" || '',
|
|
38
|
-
packageVersion: "1.9.
|
|
38
|
+
packageVersion: "1.9.1" || '',
|
|
39
39
|
componentName: _constants.COMPONENT_NAME,
|
|
40
40
|
source: _constants.COMPONENT_NAME
|
|
41
41
|
};
|
|
@@ -91,9 +91,17 @@ export const CreateForm = ({
|
|
|
91
91
|
css: formStyles
|
|
92
92
|
}, jsx(FormSpy, {
|
|
93
93
|
subscription: {
|
|
94
|
-
|
|
94
|
+
modified: true
|
|
95
95
|
},
|
|
96
|
-
onChange: state =>
|
|
96
|
+
onChange: state => {
|
|
97
|
+
// determine if any of the fields have been modified
|
|
98
|
+
if (!state.modified) {
|
|
99
|
+
setShouldShowWarning(false);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const isModified = Object.values(state.modified).some(value => value);
|
|
103
|
+
setShouldShowWarning(isModified);
|
|
104
|
+
}
|
|
97
105
|
}), jsx(Box, null, children), !hideFooter && jsx(CreateFormFooter, {
|
|
98
106
|
formErrorMessage: formErrorMessage,
|
|
99
107
|
handleCancel: handleCancel,
|
|
@@ -31,7 +31,7 @@ export const ConfirmDismissDialog = ({
|
|
|
31
31
|
onClose: onCancelDismiss,
|
|
32
32
|
width: "small"
|
|
33
33
|
}, /*#__PURE__*/React.createElement(ScreenViewedEvent, {
|
|
34
|
-
screen:
|
|
34
|
+
screen: screen
|
|
35
35
|
}), /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(ModalTitle, null, intl.formatMessage(messages.title))), /*#__PURE__*/React.createElement(ModalBody, null, intl.formatMessage(messages.description)), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
36
36
|
actionSubjectId: "cancel",
|
|
37
37
|
appearance: "subtle",
|
|
@@ -28,24 +28,18 @@ const LinkCreateContent = ({
|
|
|
28
28
|
}
|
|
29
29
|
return jsx(Fragment, null, chosenOne.form);
|
|
30
30
|
};
|
|
31
|
-
const LinkCreate = ({
|
|
32
|
-
testId = TEST_ID,
|
|
33
|
-
triggeredFrom,
|
|
34
|
-
...restProps
|
|
35
|
-
}) => {
|
|
36
|
-
return jsx(Box, {
|
|
37
|
-
testId: testId
|
|
38
|
-
}, jsx(ErrorBoundary, null, jsx(TrackMount, null), jsx(LinkCreateContent, restProps)));
|
|
39
|
-
};
|
|
40
31
|
const LinkCreateWithModal = ({
|
|
41
32
|
active,
|
|
42
33
|
modalTitle,
|
|
43
34
|
onCreate,
|
|
44
35
|
onFailure,
|
|
45
36
|
onCancel,
|
|
37
|
+
onComplete,
|
|
46
38
|
onOpenComplete,
|
|
47
39
|
onCloseComplete,
|
|
48
|
-
|
|
40
|
+
testId = TEST_ID,
|
|
41
|
+
plugins,
|
|
42
|
+
entityKey
|
|
49
43
|
}) => {
|
|
50
44
|
const intl = useIntl();
|
|
51
45
|
const {
|
|
@@ -88,9 +82,14 @@ const LinkCreateWithModal = ({
|
|
|
88
82
|
onOpenComplete: onOpenComplete,
|
|
89
83
|
onCloseComplete: onCloseComplete,
|
|
90
84
|
width: `${CREATE_FORM_MAX_WIDTH_IN_PX}px`
|
|
91
|
-
}, jsx(ModalHeader, null, jsx(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), jsx(ModalBody, null, jsx(
|
|
85
|
+
}, jsx(ModalHeader, null, jsx(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), jsx(ModalBody, null, jsx(Box, {
|
|
86
|
+
testId: testId
|
|
87
|
+
}, jsx(ErrorBoundary, null, jsx(TrackMount, null), jsx(LinkCreateContent, {
|
|
88
|
+
plugins: plugins,
|
|
89
|
+
entityKey: entityKey
|
|
90
|
+
})))))), getBooleanFF('platform.linking-platform.link-create.enable-edit') && onComplete && jsx(EditModal, {
|
|
92
91
|
onCloseComplete: onCloseComplete,
|
|
93
|
-
onClose:
|
|
92
|
+
onClose: onComplete
|
|
94
93
|
}), getBooleanFF('platform.linking-platform.link-create.confirm-dismiss-dialog') && jsx(ConfirmDismissDialog, {
|
|
95
94
|
active: showExitWarning,
|
|
96
95
|
onClose: handleCloseExitWarning
|
package/dist/es2019/ui/main.js
CHANGED
|
@@ -26,7 +26,7 @@ const LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE
|
|
|
26
26
|
}));
|
|
27
27
|
export const PACKAGE_DATA = {
|
|
28
28
|
packageName: "@atlaskit/link-create" || '',
|
|
29
|
-
packageVersion: "1.9.
|
|
29
|
+
packageVersion: "1.9.1" || '',
|
|
30
30
|
componentName: COMPONENT_NAME,
|
|
31
31
|
source: COMPONENT_NAME
|
|
32
32
|
};
|
|
@@ -112,10 +112,18 @@ export var CreateForm = function CreateForm(_ref) {
|
|
|
112
112
|
css: formStyles
|
|
113
113
|
}, jsx(FormSpy, {
|
|
114
114
|
subscription: {
|
|
115
|
-
|
|
115
|
+
modified: true
|
|
116
116
|
},
|
|
117
117
|
onChange: function onChange(state) {
|
|
118
|
-
|
|
118
|
+
// determine if any of the fields have been modified
|
|
119
|
+
if (!state.modified) {
|
|
120
|
+
setShouldShowWarning(false);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
var isModified = Object.values(state.modified).some(function (value) {
|
|
124
|
+
return value;
|
|
125
|
+
});
|
|
126
|
+
setShouldShowWarning(isModified);
|
|
119
127
|
}
|
|
120
128
|
}), jsx(Box, null, children), !hideFooter && jsx(CreateFormFooter, {
|
|
121
129
|
formErrorMessage: formErrorMessage,
|
|
@@ -31,7 +31,7 @@ export var ConfirmDismissDialog = function ConfirmDismissDialog(_ref) {
|
|
|
31
31
|
onClose: onCancelDismiss,
|
|
32
32
|
width: "small"
|
|
33
33
|
}, /*#__PURE__*/React.createElement(ScreenViewedEvent, {
|
|
34
|
-
screen:
|
|
34
|
+
screen: screen
|
|
35
35
|
}), /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(ModalTitle, null, intl.formatMessage(messages.title))), /*#__PURE__*/React.createElement(ModalBody, null, intl.formatMessage(messages.description)), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
36
36
|
actionSubjectId: "cancel",
|
|
37
37
|
appearance: "subtle",
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["testId", "triggeredFrom"],
|
|
6
|
-
_excluded2 = ["active", "modalTitle", "onCreate", "onFailure", "onCancel", "onOpenComplete", "onCloseComplete"];
|
|
7
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
5
|
/** @jsx jsx */
|
|
9
6
|
import { Fragment, useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
@@ -35,29 +32,24 @@ var LinkCreateContent = function LinkCreateContent(_ref) {
|
|
|
35
32
|
}
|
|
36
33
|
return jsx(Fragment, null, chosenOne.form);
|
|
37
34
|
};
|
|
38
|
-
var
|
|
39
|
-
var
|
|
35
|
+
var LinkCreateWithModal = function LinkCreateWithModal(_ref2) {
|
|
36
|
+
var active = _ref2.active,
|
|
37
|
+
modalTitle = _ref2.modalTitle,
|
|
38
|
+
onCreate = _ref2.onCreate,
|
|
39
|
+
onFailure = _ref2.onFailure,
|
|
40
|
+
onCancel = _ref2.onCancel,
|
|
41
|
+
onComplete = _ref2.onComplete,
|
|
42
|
+
onOpenComplete = _ref2.onOpenComplete,
|
|
43
|
+
onCloseComplete = _ref2.onCloseComplete,
|
|
44
|
+
_ref2$testId = _ref2.testId,
|
|
40
45
|
testId = _ref2$testId === void 0 ? TEST_ID : _ref2$testId,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return jsx(Box, {
|
|
44
|
-
testId: testId
|
|
45
|
-
}, jsx(ErrorBoundary, null, jsx(TrackMount, null), jsx(LinkCreateContent, restProps)));
|
|
46
|
-
};
|
|
47
|
-
var LinkCreateWithModal = function LinkCreateWithModal(_ref3) {
|
|
48
|
-
var active = _ref3.active,
|
|
49
|
-
modalTitle = _ref3.modalTitle,
|
|
50
|
-
onCreate = _ref3.onCreate,
|
|
51
|
-
onFailure = _ref3.onFailure,
|
|
52
|
-
onCancel = _ref3.onCancel,
|
|
53
|
-
onOpenComplete = _ref3.onOpenComplete,
|
|
54
|
-
onCloseComplete = _ref3.onCloseComplete,
|
|
55
|
-
createProps = _objectWithoutProperties(_ref3, _excluded2);
|
|
46
|
+
plugins = _ref2.plugins,
|
|
47
|
+
entityKey = _ref2.entityKey;
|
|
56
48
|
var intl = useIntl();
|
|
57
49
|
var _useFormContext = useFormContext(),
|
|
58
50
|
setFormErrorMessage = _useFormContext.setFormErrorMessage;
|
|
59
51
|
var handleCreate = useCallback( /*#__PURE__*/function () {
|
|
60
|
-
var
|
|
52
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(result) {
|
|
61
53
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
62
54
|
while (1) switch (_context.prev = _context.next) {
|
|
63
55
|
case 0:
|
|
@@ -76,7 +68,7 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref3) {
|
|
|
76
68
|
}, _callee);
|
|
77
69
|
}));
|
|
78
70
|
return function (_x) {
|
|
79
|
-
return
|
|
71
|
+
return _ref3.apply(this, arguments);
|
|
80
72
|
};
|
|
81
73
|
}(), [onCreate, setFormErrorMessage]);
|
|
82
74
|
var handleFailure = useCallback(function (error) {
|
|
@@ -113,9 +105,14 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref3) {
|
|
|
113
105
|
onOpenComplete: onOpenComplete,
|
|
114
106
|
onCloseComplete: onCloseComplete,
|
|
115
107
|
width: "".concat(CREATE_FORM_MAX_WIDTH_IN_PX, "px")
|
|
116
|
-
}, jsx(ModalHeader, null, jsx(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), jsx(ModalBody, null, jsx(
|
|
108
|
+
}, jsx(ModalHeader, null, jsx(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), jsx(ModalBody, null, jsx(Box, {
|
|
109
|
+
testId: testId
|
|
110
|
+
}, jsx(ErrorBoundary, null, jsx(TrackMount, null), jsx(LinkCreateContent, {
|
|
111
|
+
plugins: plugins,
|
|
112
|
+
entityKey: entityKey
|
|
113
|
+
})))))), getBooleanFF('platform.linking-platform.link-create.enable-edit') && onComplete && jsx(EditModal, {
|
|
117
114
|
onCloseComplete: onCloseComplete,
|
|
118
|
-
onClose:
|
|
115
|
+
onClose: onComplete
|
|
119
116
|
}), getBooleanFF('platform.linking-platform.link-create.confirm-dismiss-dialog') && jsx(ConfirmDismissDialog, {
|
|
120
117
|
active: showExitWarning,
|
|
121
118
|
onClose: handleCloseExitWarning
|
|
@@ -140,18 +137,18 @@ var LinkCreateModal = function LinkCreateModal(props) {
|
|
|
140
137
|
}, function (pluginsProvider) {
|
|
141
138
|
return jsx(EditPostCreateModalProvider, {
|
|
142
139
|
active: !!props.active
|
|
143
|
-
}, function (
|
|
140
|
+
}, function (_ref4) {
|
|
144
141
|
var _pluginsProvider$acti;
|
|
145
|
-
var setEditViewPayload =
|
|
146
|
-
editViewPayload =
|
|
147
|
-
shouldActivateEditView =
|
|
148
|
-
enableEditView =
|
|
142
|
+
var setEditViewPayload = _ref4.setEditViewPayload,
|
|
143
|
+
editViewPayload = _ref4.editViewPayload,
|
|
144
|
+
shouldActivateEditView = _ref4.shouldActivateEditView,
|
|
145
|
+
enableEditView = _ref4.enableEditView;
|
|
149
146
|
return jsx(FormContextProvider, {
|
|
150
147
|
enableEditView: pluginsProvider !== null && pluginsProvider !== void 0 && (_pluginsProvider$acti = pluginsProvider.activePlugin) !== null && _pluginsProvider$acti !== void 0 && _pluginsProvider$acti.editView && props !== null && props !== void 0 && props.onComplete ? enableEditView : undefined
|
|
151
148
|
}, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
|
|
152
149
|
active: props.active && !editViewPayload,
|
|
153
150
|
onCreate: /*#__PURE__*/function () {
|
|
154
|
-
var
|
|
151
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(payload) {
|
|
155
152
|
var _props$onCreate;
|
|
156
153
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
157
154
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -176,7 +173,7 @@ var LinkCreateModal = function LinkCreateModal(props) {
|
|
|
176
173
|
}, _callee2);
|
|
177
174
|
}));
|
|
178
175
|
return function (_x2) {
|
|
179
|
-
return
|
|
176
|
+
return _ref5.apply(this, arguments);
|
|
180
177
|
};
|
|
181
178
|
}(),
|
|
182
179
|
onCloseComplete: function onCloseComplete() {
|
|
@@ -194,7 +191,7 @@ var LinkCreateModal = function LinkCreateModal(props) {
|
|
|
194
191
|
}
|
|
195
192
|
return jsx(FormContextProvider, null, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
|
|
196
193
|
onCreate: /*#__PURE__*/function () {
|
|
197
|
-
var
|
|
194
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(payload) {
|
|
198
195
|
var _props$onCreate2, _props$onComplete;
|
|
199
196
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
200
197
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -210,7 +207,7 @@ var LinkCreateModal = function LinkCreateModal(props) {
|
|
|
210
207
|
}, _callee3);
|
|
211
208
|
}));
|
|
212
209
|
return function (_x3) {
|
|
213
|
-
return
|
|
210
|
+
return _ref6.apply(this, arguments);
|
|
214
211
|
};
|
|
215
212
|
}()
|
|
216
213
|
}))));
|
package/dist/esm/ui/main.js
CHANGED
|
@@ -27,7 +27,7 @@ var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__
|
|
|
27
27
|
}));
|
|
28
28
|
export var PACKAGE_DATA = {
|
|
29
29
|
packageName: "@atlaskit/link-create" || '',
|
|
30
|
-
packageVersion: "1.9.
|
|
30
|
+
packageVersion: "1.9.1" || '',
|
|
31
31
|
componentName: COMPONENT_NAME,
|
|
32
32
|
source: COMPONENT_NAME
|
|
33
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-create",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "The driver component of meta creation flow",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
38
|
-
"@atlaskit/button": "^16.
|
|
38
|
+
"@atlaskit/button": "^16.16.0",
|
|
39
39
|
"@atlaskit/empty-state": "^7.6.0",
|
|
40
40
|
"@atlaskit/form": "^9.0.0",
|
|
41
41
|
"@atlaskit/icon": "^21.12.0",
|