@atlaskit/link-create 2.13.20 → 2.15.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/common/constants.js +4 -1
- package/dist/cjs/common/ui/error-boundary-modal/index.js +13 -10
- package/dist/cjs/common/ui/error-boundary-modal/old/index.js +34 -0
- package/dist/cjs/common/ui/error-boundary-ui/error-svg/index.compiled.css +6 -0
- package/dist/cjs/common/ui/error-boundary-ui/error-svg/index.js +32 -25
- package/dist/cjs/common/ui/error-boundary-ui/error-svg/old/index.js +67 -0
- package/dist/cjs/common/ui/icon/index.compiled.css +7 -0
- package/dist/cjs/common/ui/icon/index.js +25 -20
- package/dist/cjs/common/ui/icon/old/index.js +26 -0
- package/dist/cjs/common/ui/message/index.compiled.css +11 -0
- package/dist/cjs/common/ui/message/index.js +33 -40
- package/dist/cjs/common/ui/message/old/index.js +81 -0
- package/dist/cjs/common/ui/modal-hero/index.js +11 -3
- package/dist/cjs/common/ui/modal-hero/old/index.js +27 -0
- package/dist/cjs/controllers/create-field/main.compiled.css +1 -0
- package/dist/cjs/controllers/create-field/main.js +30 -21
- package/dist/cjs/controllers/create-field/old/main.js +76 -0
- package/dist/cjs/ui/create-form/async-select/main.js +15 -10
- package/dist/cjs/ui/create-form/async-select/old/main.js +195 -0
- package/dist/cjs/ui/create-form/form-footer/main.compiled.css +5 -0
- package/dist/cjs/ui/create-form/form-footer/main.js +28 -28
- package/dist/cjs/ui/create-form/form-footer/old/main.js +64 -0
- package/dist/cjs/ui/create-form/form-loader/main.compiled.css +4 -0
- package/dist/cjs/ui/create-form/form-loader/main.js +22 -21
- package/dist/cjs/ui/create-form/form-loader/old/main.js +39 -0
- package/dist/cjs/ui/create-form/main.compiled.css +9 -0
- package/dist/cjs/ui/create-form/main.js +26 -21
- package/dist/cjs/ui/create-form/old/main.js +177 -0
- package/dist/cjs/ui/create-form/select/main.js +41 -20
- package/dist/cjs/ui/create-form/select/old/main.js +127 -0
- package/dist/cjs/ui/create-form/textfield/main.js +14 -13
- package/dist/cjs/ui/create-form/textfield/old/main.js +55 -0
- package/dist/cjs/ui/create-form/user-picker/main.js +14 -13
- package/dist/cjs/ui/create-form/user-picker/old/main.js +72 -0
- package/dist/cjs/ui/inline-create/index.js +17 -14
- package/dist/cjs/ui/inline-create/main.js +21 -19
- package/dist/cjs/ui/inline-create/old/index.js +38 -0
- package/dist/cjs/ui/inline-create/old/main.js +120 -0
- package/dist/cjs/ui/modal-create/index.js +19 -16
- package/dist/cjs/ui/modal-create/main.js +26 -23
- package/dist/cjs/ui/modal-create/old/index.js +44 -0
- package/dist/cjs/ui/modal-create/old/main.js +164 -0
- package/dist/es2019/common/constants.js +4 -1
- package/dist/es2019/common/ui/error-boundary-modal/index.js +12 -9
- package/dist/es2019/common/ui/error-boundary-modal/old/index.js +26 -0
- package/dist/es2019/common/ui/error-boundary-ui/error-svg/index.compiled.css +6 -0
- package/dist/es2019/common/ui/error-boundary-ui/error-svg/index.js +24 -23
- package/dist/es2019/common/ui/error-boundary-ui/error-svg/old/index.js +58 -0
- package/dist/es2019/common/ui/icon/index.compiled.css +7 -0
- package/dist/es2019/common/ui/icon/index.js +23 -18
- package/dist/es2019/common/ui/icon/old/index.js +18 -0
- package/dist/es2019/common/ui/message/index.compiled.css +11 -0
- package/dist/es2019/common/ui/message/index.js +30 -39
- package/dist/es2019/common/ui/message/old/index.js +74 -0
- package/dist/es2019/common/ui/modal-hero/index.js +10 -2
- package/dist/es2019/common/ui/modal-hero/old/index.js +19 -0
- package/dist/es2019/controllers/create-field/main.compiled.css +1 -0
- package/dist/es2019/controllers/create-field/main.js +26 -23
- package/dist/es2019/controllers/create-field/old/main.js +74 -0
- package/dist/es2019/ui/create-form/async-select/main.js +12 -11
- package/dist/es2019/ui/create-form/async-select/old/main.js +137 -0
- package/dist/es2019/ui/create-form/form-footer/main.compiled.css +5 -0
- package/dist/es2019/ui/create-form/form-footer/main.js +25 -27
- package/dist/es2019/ui/create-form/form-footer/old/main.js +57 -0
- package/dist/es2019/ui/create-form/form-loader/main.compiled.css +4 -0
- package/dist/es2019/ui/create-form/form-loader/main.js +19 -20
- package/dist/es2019/ui/create-form/form-loader/old/main.js +31 -0
- package/dist/es2019/ui/create-form/main.compiled.css +9 -0
- package/dist/es2019/ui/create-form/main.js +23 -23
- package/dist/es2019/ui/create-form/old/main.js +145 -0
- package/dist/es2019/ui/create-form/select/main.js +42 -22
- package/dist/es2019/ui/create-form/select/old/main.js +106 -0
- package/dist/es2019/ui/create-form/textfield/main.js +14 -12
- package/dist/es2019/ui/create-form/textfield/old/main.js +45 -0
- package/dist/es2019/ui/create-form/user-picker/main.js +14 -12
- package/dist/es2019/ui/create-form/user-picker/old/main.js +59 -0
- package/dist/es2019/ui/inline-create/index.js +14 -13
- package/dist/es2019/ui/inline-create/main.js +21 -18
- package/dist/es2019/ui/inline-create/old/index.js +30 -0
- package/dist/es2019/ui/inline-create/old/main.js +96 -0
- package/dist/es2019/ui/modal-create/index.js +16 -15
- package/dist/es2019/ui/modal-create/main.js +23 -22
- package/dist/es2019/ui/modal-create/old/index.js +36 -0
- package/dist/es2019/ui/modal-create/old/main.js +137 -0
- package/dist/esm/common/constants.js +4 -1
- package/dist/esm/common/ui/error-boundary-modal/index.js +12 -9
- package/dist/esm/common/ui/error-boundary-modal/old/index.js +25 -0
- package/dist/esm/common/ui/error-boundary-ui/error-svg/index.compiled.css +6 -0
- package/dist/esm/common/ui/error-boundary-ui/error-svg/index.js +28 -24
- package/dist/esm/common/ui/error-boundary-ui/error-svg/old/index.js +60 -0
- package/dist/esm/common/ui/icon/index.compiled.css +7 -0
- package/dist/esm/common/ui/icon/index.js +23 -18
- package/dist/esm/common/ui/icon/old/index.js +18 -0
- package/dist/esm/common/ui/message/index.compiled.css +11 -0
- package/dist/esm/common/ui/message/index.js +30 -39
- package/dist/esm/common/ui/message/old/index.js +73 -0
- package/dist/esm/common/ui/modal-hero/index.js +10 -2
- package/dist/esm/common/ui/modal-hero/old/index.js +18 -0
- package/dist/esm/controllers/create-field/main.compiled.css +1 -0
- package/dist/esm/controllers/create-field/main.js +25 -22
- package/dist/esm/controllers/create-field/old/main.js +72 -0
- package/dist/esm/ui/create-form/async-select/main.js +12 -11
- package/dist/esm/ui/create-form/async-select/old/main.js +188 -0
- package/dist/esm/ui/create-form/form-footer/main.compiled.css +5 -0
- package/dist/esm/ui/create-form/form-footer/main.js +24 -26
- package/dist/esm/ui/create-form/form-footer/old/main.js +56 -0
- package/dist/esm/ui/create-form/form-loader/main.compiled.css +4 -0
- package/dist/esm/ui/create-form/form-loader/main.js +18 -19
- package/dist/esm/ui/create-form/form-loader/old/main.js +31 -0
- package/dist/esm/ui/create-form/main.compiled.css +9 -0
- package/dist/esm/ui/create-form/main.js +23 -23
- package/dist/esm/ui/create-form/old/main.js +174 -0
- package/dist/esm/ui/create-form/select/main.js +41 -21
- package/dist/esm/ui/create-form/select/old/main.js +117 -0
- package/dist/esm/ui/create-form/textfield/main.js +13 -11
- package/dist/esm/ui/create-form/textfield/old/main.js +47 -0
- package/dist/esm/ui/create-form/user-picker/main.js +13 -11
- package/dist/esm/ui/create-form/user-picker/old/main.js +64 -0
- package/dist/esm/ui/inline-create/index.js +14 -13
- package/dist/esm/ui/inline-create/main.js +21 -18
- package/dist/esm/ui/inline-create/old/index.js +30 -0
- package/dist/esm/ui/inline-create/old/main.js +112 -0
- package/dist/esm/ui/modal-create/index.js +16 -15
- package/dist/esm/ui/modal-create/main.js +23 -22
- package/dist/esm/ui/modal-create/old/index.js +36 -0
- package/dist/esm/ui/modal-create/old/main.js +156 -0
- package/dist/types/common/constants.d.ts +3 -0
- package/dist/types/common/ui/Button/index.d.ts +8 -3
- package/dist/types/common/ui/ModalDialog/index.d.ts +1 -1
- package/dist/types/common/ui/confirm-dismiss-dialog/main.d.ts +2 -2
- package/dist/types/common/ui/edit-modal/index.d.ts +1 -1
- package/dist/types/common/ui/error-boundary/error-boundary-base/index.d.ts +1 -1
- package/dist/types/common/ui/error-boundary/index.d.ts +2 -2
- package/dist/types/common/ui/error-boundary-modal/index.d.ts +2 -2
- package/dist/types/common/ui/error-boundary-modal/old/index.d.ts +11 -0
- package/dist/types/common/ui/error-boundary-ui/error-svg/index.d.ts +2 -6
- package/dist/types/common/ui/error-boundary-ui/error-svg/old/index.d.ts +7 -0
- package/dist/types/common/ui/error-boundary-ui/index.d.ts +2 -2
- package/dist/types/common/ui/experience-tracker/index.d.ts +1 -1
- package/dist/types/common/ui/icon/index.d.ts +10 -6
- package/dist/types/common/ui/icon/old/index.d.ts +7 -0
- package/dist/types/common/ui/link-create-content/index.d.ts +2 -2
- package/dist/types/common/ui/message/index.d.ts +1 -2
- package/dist/types/common/ui/message/old/index.d.ts +15 -0
- package/dist/types/common/ui/modal-hero/index.d.ts +4 -2
- package/dist/types/common/ui/modal-hero/old/index.d.ts +4 -0
- package/dist/types/controllers/callback-context/main.d.ts +2 -2
- package/dist/types/controllers/create-field/main.d.ts +2 -2
- package/dist/types/controllers/create-field/old/main.d.ts +7 -0
- package/dist/types/controllers/edit-post-create-context/index.d.ts +1 -1
- package/dist/types/controllers/exit-warning-modal-context/index.d.ts +1 -1
- package/dist/types/controllers/form-context/main.d.ts +2 -2
- package/dist/types/controllers/plugin-context/index.d.ts +1 -1
- package/dist/types/ui/create-form/async-select/main.d.ts +2 -8
- package/dist/types/ui/create-form/async-select/old/main.d.ts +11 -0
- package/dist/types/ui/create-form/form-footer/edit-button/index.d.ts +2 -2
- package/dist/types/ui/create-form/form-footer/main.d.ts +2 -11
- package/dist/types/ui/create-form/form-footer/old/main.d.ts +16 -0
- package/dist/types/ui/create-form/form-footer/submit-button/index.d.ts +2 -2
- package/dist/types/ui/create-form/form-loader/main.d.ts +2 -10
- package/dist/types/ui/create-form/form-loader/old/main.d.ts +11 -0
- package/dist/types/ui/create-form/form-spy/index.d.ts +1 -1
- package/dist/types/ui/create-form/main.d.ts +1 -2
- package/dist/types/ui/create-form/old/main.d.ts +54 -0
- package/dist/types/ui/create-form/select/main.d.ts +5 -16
- package/dist/types/ui/create-form/select/old/main.d.ts +24 -0
- package/dist/types/ui/create-form/textfield/main.d.ts +2 -12
- package/dist/types/ui/create-form/textfield/old/main.d.ts +14 -0
- package/dist/types/ui/create-form/user-picker/main.d.ts +2 -9
- package/dist/types/ui/create-form/user-picker/old/main.d.ts +11 -0
- package/dist/types/ui/inline-create/index.d.ts +2 -3
- package/dist/types/ui/inline-create/inline-analytics/index.d.ts +2 -2
- package/dist/types/ui/inline-create/main.d.ts +2 -6
- package/dist/types/ui/inline-create/old/index.d.ts +5 -0
- package/dist/types/ui/inline-create/old/main.d.ts +8 -0
- package/dist/types/ui/modal-create/index.d.ts +2 -3
- package/dist/types/ui/modal-create/main.d.ts +2 -2
- package/dist/types/ui/modal-create/old/index.d.ts +5 -0
- package/dist/types/ui/modal-create/old/main.d.ts +4 -0
- package/dist/types-ts4.5/common/constants.d.ts +3 -0
- package/dist/types-ts4.5/common/ui/Button/index.d.ts +8 -3
- package/dist/types-ts4.5/common/ui/ModalDialog/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/confirm-dismiss-dialog/main.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/edit-modal/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/error-boundary/error-boundary-base/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/error-boundary/index.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/error-boundary-modal/index.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/error-boundary-modal/old/index.d.ts +11 -0
- package/dist/types-ts4.5/common/ui/error-boundary-ui/error-svg/index.d.ts +2 -6
- package/dist/types-ts4.5/common/ui/error-boundary-ui/error-svg/old/index.d.ts +7 -0
- package/dist/types-ts4.5/common/ui/error-boundary-ui/index.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/experience-tracker/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/icon/index.d.ts +10 -6
- package/dist/types-ts4.5/common/ui/icon/old/index.d.ts +7 -0
- package/dist/types-ts4.5/common/ui/link-create-content/index.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/message/index.d.ts +1 -2
- package/dist/types-ts4.5/common/ui/message/old/index.d.ts +15 -0
- package/dist/types-ts4.5/common/ui/modal-hero/index.d.ts +4 -2
- package/dist/types-ts4.5/common/ui/modal-hero/old/index.d.ts +4 -0
- package/dist/types-ts4.5/controllers/callback-context/main.d.ts +2 -2
- package/dist/types-ts4.5/controllers/create-field/main.d.ts +2 -2
- package/dist/types-ts4.5/controllers/create-field/old/main.d.ts +7 -0
- package/dist/types-ts4.5/controllers/edit-post-create-context/index.d.ts +1 -1
- package/dist/types-ts4.5/controllers/exit-warning-modal-context/index.d.ts +1 -1
- package/dist/types-ts4.5/controllers/form-context/main.d.ts +2 -2
- package/dist/types-ts4.5/controllers/plugin-context/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/create-form/async-select/main.d.ts +2 -8
- package/dist/types-ts4.5/ui/create-form/async-select/old/main.d.ts +11 -0
- package/dist/types-ts4.5/ui/create-form/form-footer/edit-button/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/create-form/form-footer/main.d.ts +2 -11
- package/dist/types-ts4.5/ui/create-form/form-footer/old/main.d.ts +16 -0
- package/dist/types-ts4.5/ui/create-form/form-footer/submit-button/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/create-form/form-loader/main.d.ts +2 -10
- package/dist/types-ts4.5/ui/create-form/form-loader/old/main.d.ts +11 -0
- package/dist/types-ts4.5/ui/create-form/form-spy/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/create-form/main.d.ts +1 -2
- package/dist/types-ts4.5/ui/create-form/old/main.d.ts +56 -0
- package/dist/types-ts4.5/ui/create-form/select/main.d.ts +5 -16
- package/dist/types-ts4.5/ui/create-form/select/old/main.d.ts +24 -0
- package/dist/types-ts4.5/ui/create-form/textfield/main.d.ts +2 -12
- package/dist/types-ts4.5/ui/create-form/textfield/old/main.d.ts +14 -0
- package/dist/types-ts4.5/ui/create-form/user-picker/main.d.ts +2 -9
- package/dist/types-ts4.5/ui/create-form/user-picker/old/main.d.ts +11 -0
- package/dist/types-ts4.5/ui/inline-create/index.d.ts +2 -3
- package/dist/types-ts4.5/ui/inline-create/inline-analytics/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/inline-create/main.d.ts +2 -6
- package/dist/types-ts4.5/ui/inline-create/old/index.d.ts +5 -0
- package/dist/types-ts4.5/ui/inline-create/old/main.d.ts +8 -0
- package/dist/types-ts4.5/ui/modal-create/index.d.ts +2 -3
- package/dist/types-ts4.5/ui/modal-create/main.d.ts +2 -2
- package/dist/types-ts4.5/ui/modal-create/old/index.d.ts +5 -0
- package/dist/types-ts4.5/ui/modal-create/old/main.d.ts +4 -0
- package/example-helpers/mock-disclaimer.tsx +1 -1
- package/package.json +37 -26
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
8
|
-
import { Box } from '@atlaskit/primitives';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
9
5
|
import { DEFAULT_TEST_ID, SCREEN_ID } from '../../common/constants';
|
|
10
6
|
import { ConfirmDismissDialog } from '../../common/ui/confirm-dismiss-dialog';
|
|
11
7
|
import { EditModal } from '../../common/ui/edit-modal';
|
|
@@ -17,6 +13,7 @@ import { useExitWarningModal } from '../../controllers/exit-warning-modal-contex
|
|
|
17
13
|
import { FormContextProvider } from '../../controllers/form-context';
|
|
18
14
|
import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../controllers/plugin-context';
|
|
19
15
|
import { InlineAnalytics } from './inline-analytics';
|
|
16
|
+
import InlineCreateOld from './old/main';
|
|
20
17
|
const InlineCreateContent = ({
|
|
21
18
|
onCreate,
|
|
22
19
|
onFailure,
|
|
@@ -38,32 +35,32 @@ const InlineCreateContent = ({
|
|
|
38
35
|
activePlugin
|
|
39
36
|
} = useLinkCreatePlugins();
|
|
40
37
|
const handleCloseExitWarning = () => setShowExitWarning(false);
|
|
41
|
-
return
|
|
38
|
+
return /*#__PURE__*/React.createElement(LinkCreateCallbackProvider, {
|
|
42
39
|
onCreate: onCreate,
|
|
43
40
|
onFailure: onFailure,
|
|
44
41
|
onCancel: withExitWarning(onCancel)
|
|
45
|
-
},
|
|
42
|
+
}, /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(InlineAnalytics, {
|
|
46
43
|
screen: SCREEN_ID
|
|
47
|
-
},
|
|
44
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
48
45
|
testId: testId
|
|
49
|
-
},
|
|
46
|
+
}, /*#__PURE__*/React.createElement(LinkCreateContent, {
|
|
50
47
|
plugins: plugins,
|
|
51
48
|
entityKey: entityKey
|
|
52
|
-
})))), onComplete &&
|
|
49
|
+
})))), onComplete && /*#__PURE__*/React.createElement(EditModal, {
|
|
53
50
|
onClose: onComplete,
|
|
54
51
|
editViewPayload: editViewPayload,
|
|
55
52
|
activePlugin: activePlugin
|
|
56
|
-
}),
|
|
53
|
+
}), /*#__PURE__*/React.createElement(ConfirmDismissDialog, {
|
|
57
54
|
active: showExitWarning,
|
|
58
55
|
onClose: handleCloseExitWarning,
|
|
59
56
|
onCancel: onCancel
|
|
60
57
|
}));
|
|
61
58
|
};
|
|
62
|
-
const
|
|
63
|
-
return
|
|
59
|
+
const InlineCreateNew = props => {
|
|
60
|
+
return /*#__PURE__*/React.createElement(LinkCreatePluginsProvider, {
|
|
64
61
|
plugins: props.plugins,
|
|
65
62
|
entityKey: props.entityKey
|
|
66
|
-
}, pluginsProvider =>
|
|
63
|
+
}, pluginsProvider => /*#__PURE__*/React.createElement(EditPostCreateModalProvider, {
|
|
67
64
|
active: true
|
|
68
65
|
}, ({
|
|
69
66
|
setEditViewPayload,
|
|
@@ -71,9 +68,9 @@ const InlineCreate = props => {
|
|
|
71
68
|
enableEditView
|
|
72
69
|
}) => {
|
|
73
70
|
var _pluginsProvider$acti;
|
|
74
|
-
return
|
|
71
|
+
return /*#__PURE__*/React.createElement(FormContextProvider, {
|
|
75
72
|
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
|
|
76
|
-
},
|
|
73
|
+
}, /*#__PURE__*/React.createElement(InlineCreateContent, _extends({}, props, {
|
|
77
74
|
onCreate: async payload => {
|
|
78
75
|
var _props$onCreate;
|
|
79
76
|
await ((_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload));
|
|
@@ -92,4 +89,10 @@ const InlineCreate = props => {
|
|
|
92
89
|
})));
|
|
93
90
|
}));
|
|
94
91
|
};
|
|
92
|
+
const InlineCreate = props => {
|
|
93
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
94
|
+
return /*#__PURE__*/React.createElement(InlineCreateNew, props);
|
|
95
|
+
}
|
|
96
|
+
return /*#__PURE__*/React.createElement(InlineCreateOld, props);
|
|
97
|
+
};
|
|
95
98
|
export default InlineCreate;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* eslint-disable @atlassian/tangerine/import/no-parent-imports */
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
+
import { jsx } from '@emotion/react';
|
|
10
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
11
|
+
import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
|
|
12
|
+
import { PACKAGE_DATA } from '../../../common/constants';
|
|
13
|
+
import { ErrorBoundary } from '../../../common/ui/error-boundary';
|
|
14
|
+
import { Experience } from '../../../common/ui/experience-tracker';
|
|
15
|
+
import { withLinkCreateAnalyticsContext } from '../../../common/utils/analytics';
|
|
16
|
+
import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
|
|
17
|
+
import i18nEN from '../../../i18n/en';
|
|
18
|
+
import InlineCreate from '../main';
|
|
19
|
+
const LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(props => {
|
|
20
|
+
return jsx(Experience, null, jsx(ErrorBoundary, null, jsx(InlineCreate, props)));
|
|
21
|
+
}));
|
|
22
|
+
const ComposedLinkCreateOld = /*#__PURE__*/memo(props => {
|
|
23
|
+
return jsx(AnalyticsContext, {
|
|
24
|
+
data: PACKAGE_DATA
|
|
25
|
+
}, jsx(IntlMessagesProvider, {
|
|
26
|
+
defaultMessages: i18nEN,
|
|
27
|
+
loaderFn: fetchMessagesForLocale
|
|
28
|
+
}, jsx(LinkCreateWithAnalyticsContext, props)));
|
|
29
|
+
});
|
|
30
|
+
export default ComposedLinkCreateOld;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/* eslint-disable @atlassian/tangerine/import/no-parent-imports */
|
|
3
|
+
/**
|
|
4
|
+
* @jsxRuntime classic
|
|
5
|
+
* @jsx jsx
|
|
6
|
+
*/
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
+
import { jsx } from '@emotion/react';
|
|
9
|
+
import { Box } from '@atlaskit/primitives';
|
|
10
|
+
import { DEFAULT_TEST_ID, SCREEN_ID } from '../../../common/constants';
|
|
11
|
+
import { ConfirmDismissDialog } from '../../../common/ui/confirm-dismiss-dialog';
|
|
12
|
+
import { EditModal } from '../../../common/ui/edit-modal';
|
|
13
|
+
import { ErrorBoundary } from '../../../common/ui/error-boundary';
|
|
14
|
+
import { LinkCreateContent } from '../../../common/ui/link-create-content';
|
|
15
|
+
import { LinkCreateCallbackProvider } from '../../../controllers/callback-context';
|
|
16
|
+
import { EditPostCreateModalProvider, useEditPostCreateModal } from '../../../controllers/edit-post-create-context';
|
|
17
|
+
import { useExitWarningModal } from '../../../controllers/exit-warning-modal-context';
|
|
18
|
+
import { FormContextProvider } from '../../../controllers/form-context';
|
|
19
|
+
import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../../controllers/plugin-context';
|
|
20
|
+
import { InlineAnalytics } from '../inline-analytics';
|
|
21
|
+
const InlineCreateContent = ({
|
|
22
|
+
onCreate,
|
|
23
|
+
onFailure,
|
|
24
|
+
onCancel,
|
|
25
|
+
onComplete,
|
|
26
|
+
plugins,
|
|
27
|
+
entityKey,
|
|
28
|
+
testId = DEFAULT_TEST_ID
|
|
29
|
+
}) => {
|
|
30
|
+
const {
|
|
31
|
+
withExitWarning,
|
|
32
|
+
showExitWarning,
|
|
33
|
+
setShowExitWarning
|
|
34
|
+
} = useExitWarningModal();
|
|
35
|
+
const {
|
|
36
|
+
editViewPayload
|
|
37
|
+
} = useEditPostCreateModal();
|
|
38
|
+
const {
|
|
39
|
+
activePlugin
|
|
40
|
+
} = useLinkCreatePlugins();
|
|
41
|
+
const handleCloseExitWarning = () => setShowExitWarning(false);
|
|
42
|
+
return jsx(LinkCreateCallbackProvider, {
|
|
43
|
+
onCreate: onCreate,
|
|
44
|
+
onFailure: onFailure,
|
|
45
|
+
onCancel: withExitWarning(onCancel)
|
|
46
|
+
}, jsx(ErrorBoundary, null, jsx(InlineAnalytics, {
|
|
47
|
+
screen: SCREEN_ID
|
|
48
|
+
}, jsx(Box, {
|
|
49
|
+
testId: testId
|
|
50
|
+
}, jsx(LinkCreateContent, {
|
|
51
|
+
plugins: plugins,
|
|
52
|
+
entityKey: entityKey
|
|
53
|
+
})))), onComplete && jsx(EditModal, {
|
|
54
|
+
onClose: onComplete,
|
|
55
|
+
editViewPayload: editViewPayload,
|
|
56
|
+
activePlugin: activePlugin
|
|
57
|
+
}), jsx(ConfirmDismissDialog, {
|
|
58
|
+
active: showExitWarning,
|
|
59
|
+
onClose: handleCloseExitWarning,
|
|
60
|
+
onCancel: onCancel
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
const InlineCreateOld = props => {
|
|
64
|
+
return jsx(LinkCreatePluginsProvider, {
|
|
65
|
+
plugins: props.plugins,
|
|
66
|
+
entityKey: props.entityKey
|
|
67
|
+
}, pluginsProvider => jsx(EditPostCreateModalProvider, {
|
|
68
|
+
active: true
|
|
69
|
+
}, ({
|
|
70
|
+
setEditViewPayload,
|
|
71
|
+
shouldActivateEditView,
|
|
72
|
+
enableEditView
|
|
73
|
+
}) => {
|
|
74
|
+
var _pluginsProvider$acti;
|
|
75
|
+
return jsx(FormContextProvider, {
|
|
76
|
+
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
|
|
77
|
+
}, jsx(InlineCreateContent, _extends({}, props, {
|
|
78
|
+
onCreate: async payload => {
|
|
79
|
+
var _props$onCreate;
|
|
80
|
+
await ((_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload));
|
|
81
|
+
|
|
82
|
+
// if onComplete exists then there is an edit flow
|
|
83
|
+
if (props.onComplete) {
|
|
84
|
+
if (shouldActivateEditView()) {
|
|
85
|
+
//edit button is pressed
|
|
86
|
+
setEditViewPayload(payload);
|
|
87
|
+
} else {
|
|
88
|
+
//create button is pressed
|
|
89
|
+
props.onComplete();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
})));
|
|
94
|
+
}));
|
|
95
|
+
};
|
|
96
|
+
export default InlineCreateOld;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { memo } from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
-
import { jsx } from '@emotion/react';
|
|
1
|
+
import React, { memo } from 'react';
|
|
9
2
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
10
3
|
import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
5
|
import { PACKAGE_DATA } from '../../common/constants';
|
|
12
6
|
import { ErrorBoundary } from '../../common/ui/error-boundary';
|
|
13
7
|
import { ErrorBoundaryModal } from '../../common/ui/error-boundary-modal';
|
|
@@ -16,20 +10,27 @@ import { withLinkCreateAnalyticsContext } from '../../common/utils/analytics';
|
|
|
16
10
|
import { fetchMessagesForLocale } from '../../common/utils/locale/fetch-messages-for-locale';
|
|
17
11
|
import i18nEN from '../../i18n/en';
|
|
18
12
|
import LinkCreate from './main';
|
|
13
|
+
import ComposedLinkCreateOld from './old';
|
|
19
14
|
const LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(props => {
|
|
20
|
-
return
|
|
21
|
-
errorComponent:
|
|
15
|
+
return /*#__PURE__*/React.createElement(Experience, null, /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
16
|
+
errorComponent: /*#__PURE__*/React.createElement(ErrorBoundaryModal, {
|
|
22
17
|
active: props.active,
|
|
23
18
|
onClose: props.onCancel
|
|
24
19
|
})
|
|
25
|
-
},
|
|
20
|
+
}, /*#__PURE__*/React.createElement(LinkCreate, props)));
|
|
26
21
|
}));
|
|
27
|
-
const
|
|
28
|
-
return
|
|
22
|
+
const ComposedLinkCreateNew = /*#__PURE__*/memo(props => {
|
|
23
|
+
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
29
24
|
data: PACKAGE_DATA
|
|
30
|
-
},
|
|
25
|
+
}, /*#__PURE__*/React.createElement(IntlMessagesProvider, {
|
|
31
26
|
defaultMessages: i18nEN,
|
|
32
27
|
loaderFn: fetchMessagesForLocale
|
|
33
|
-
},
|
|
28
|
+
}, /*#__PURE__*/React.createElement(LinkCreateWithAnalyticsContext, props)));
|
|
29
|
+
});
|
|
30
|
+
const ComposedLinkCreate = /*#__PURE__*/memo(props => {
|
|
31
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
32
|
+
return /*#__PURE__*/React.createElement(ComposedLinkCreateNew, props);
|
|
33
|
+
}
|
|
34
|
+
return /*#__PURE__*/React.createElement(ComposedLinkCreateOld, props);
|
|
34
35
|
});
|
|
35
36
|
export default ComposedLinkCreate;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
* @jsxRuntime classic
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
import { useLayoutEffect, useRef } from 'react';
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
-
import { jsx } from '@emotion/react';
|
|
2
|
+
import React, { useLayoutEffect, useRef } from 'react';
|
|
10
3
|
import { useIntl } from 'react-intl-next';
|
|
11
4
|
import { Layering } from '@atlaskit/layering';
|
|
12
5
|
import { ModalBody, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
13
|
-
import {
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
14
8
|
import { CREATE_FORM_MAX_WIDTH_IN_PX, DEFAULT_TEST_ID, SCREEN_ID } from '../../common/constants';
|
|
15
9
|
import { ConfirmDismissDialog } from '../../common/ui/confirm-dismiss-dialog';
|
|
16
10
|
import { EditModal } from '../../common/ui/edit-modal';
|
|
@@ -24,6 +18,7 @@ import { ExitWarningModalProvider, useExitWarningModal } from '../../controllers
|
|
|
24
18
|
import { FormContextProvider } from '../../controllers/form-context';
|
|
25
19
|
import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../controllers/plugin-context';
|
|
26
20
|
import { messages } from './messages';
|
|
21
|
+
import LinkCreateModalOld from './old/main';
|
|
27
22
|
const LinkCreateWithModal = ({
|
|
28
23
|
active,
|
|
29
24
|
modalTitle,
|
|
@@ -51,11 +46,11 @@ const LinkCreateWithModal = ({
|
|
|
51
46
|
activePlugin
|
|
52
47
|
} = useLinkCreatePlugins();
|
|
53
48
|
const handleCloseExitWarning = () => setShowExitWarning(false);
|
|
54
|
-
return
|
|
49
|
+
return /*#__PURE__*/React.createElement(LinkCreateCallbackProvider, {
|
|
55
50
|
onCreate: onCreate,
|
|
56
51
|
onFailure: onFailure,
|
|
57
52
|
onCancel: withExitWarning(onCancel)
|
|
58
|
-
},
|
|
53
|
+
}, /*#__PURE__*/React.createElement(ModalTransition, null, active && /*#__PURE__*/React.createElement(Modal, {
|
|
59
54
|
testId: "link-create-modal",
|
|
60
55
|
screen: SCREEN_ID,
|
|
61
56
|
onClose: withExitWarning(onCancel),
|
|
@@ -63,27 +58,27 @@ const LinkCreateWithModal = ({
|
|
|
63
58
|
onOpenComplete: onOpenComplete,
|
|
64
59
|
onCloseComplete: onCloseComplete,
|
|
65
60
|
width: `${CREATE_FORM_MAX_WIDTH_IN_PX}px`
|
|
66
|
-
},
|
|
61
|
+
}, /*#__PURE__*/React.createElement(ModalHero, {
|
|
67
62
|
hero: modalHero
|
|
68
|
-
}),
|
|
63
|
+
}), /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Box, {
|
|
69
64
|
testId: testId
|
|
70
|
-
},
|
|
65
|
+
}, /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(LinkCreateContent, {
|
|
71
66
|
plugins: plugins,
|
|
72
67
|
entityKey: entityKey
|
|
73
|
-
})))))), onComplete &&
|
|
68
|
+
})))))), onComplete && /*#__PURE__*/React.createElement(EditModal, {
|
|
74
69
|
onCloseComplete: onCloseComplete,
|
|
75
70
|
onClose: onComplete,
|
|
76
71
|
editViewPayload: editViewPayload,
|
|
77
72
|
activePlugin: activePlugin
|
|
78
|
-
}),
|
|
73
|
+
}), /*#__PURE__*/React.createElement(Layering, {
|
|
79
74
|
isDisabled: false
|
|
80
|
-
},
|
|
75
|
+
}, /*#__PURE__*/React.createElement(ConfirmDismissDialog, {
|
|
81
76
|
active: showExitWarning,
|
|
82
77
|
onClose: handleCloseExitWarning,
|
|
83
78
|
onCancel: onCancel
|
|
84
79
|
})));
|
|
85
80
|
};
|
|
86
|
-
const
|
|
81
|
+
const LinkCreateModalNew = props => {
|
|
87
82
|
const shouldCallCloseComplete = useRef(!props.active);
|
|
88
83
|
|
|
89
84
|
// modal calls onCloseComplete in a useEffect(), so we can track whether
|
|
@@ -93,10 +88,10 @@ const LinkCreateModal = props => {
|
|
|
93
88
|
// onCloseComplete should only be called when it is not active
|
|
94
89
|
shouldCallCloseComplete.current = !props.active;
|
|
95
90
|
}, [props.active]);
|
|
96
|
-
return
|
|
91
|
+
return /*#__PURE__*/React.createElement(LinkCreatePluginsProvider, {
|
|
97
92
|
plugins: props.plugins,
|
|
98
93
|
entityKey: props.entityKey
|
|
99
|
-
}, pluginsProvider =>
|
|
94
|
+
}, pluginsProvider => /*#__PURE__*/React.createElement(EditPostCreateModalProvider, {
|
|
100
95
|
active: !!props.active
|
|
101
96
|
}, ({
|
|
102
97
|
setEditViewPayload,
|
|
@@ -105,9 +100,9 @@ const LinkCreateModal = props => {
|
|
|
105
100
|
enableEditView
|
|
106
101
|
}) => {
|
|
107
102
|
var _pluginsProvider$acti;
|
|
108
|
-
return
|
|
103
|
+
return /*#__PURE__*/React.createElement(FormContextProvider, {
|
|
109
104
|
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
|
|
110
|
-
},
|
|
105
|
+
}, /*#__PURE__*/React.createElement(ExitWarningModalProvider, null, /*#__PURE__*/React.createElement(LinkCreateWithModal, _extends({}, props, {
|
|
111
106
|
active: props.active && !editViewPayload,
|
|
112
107
|
onCreate: async payload => {
|
|
113
108
|
var _props$onCreate;
|
|
@@ -133,4 +128,10 @@ const LinkCreateModal = props => {
|
|
|
133
128
|
}))));
|
|
134
129
|
}));
|
|
135
130
|
};
|
|
131
|
+
const LinkCreateModal = props => {
|
|
132
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
133
|
+
return /*#__PURE__*/React.createElement(LinkCreateModalNew, props);
|
|
134
|
+
}
|
|
135
|
+
return /*#__PURE__*/React.createElement(LinkCreateModalOld, props);
|
|
136
|
+
};
|
|
136
137
|
export default LinkCreateModal;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable @atlassian/tangerine/import/no-parent-imports */
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
+
import { jsx } from '@emotion/react';
|
|
10
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
11
|
+
import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
|
|
12
|
+
import { PACKAGE_DATA } from '../../../common/constants';
|
|
13
|
+
import { ErrorBoundary } from '../../../common/ui/error-boundary';
|
|
14
|
+
import { ErrorBoundaryModal } from '../../../common/ui/error-boundary-modal';
|
|
15
|
+
import { Experience } from '../../../common/ui/experience-tracker';
|
|
16
|
+
import { withLinkCreateAnalyticsContext } from '../../../common/utils/analytics';
|
|
17
|
+
import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
|
|
18
|
+
import i18nEN from '../../../i18n/en';
|
|
19
|
+
import LinkCreate from '../main';
|
|
20
|
+
const LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(props => {
|
|
21
|
+
return jsx(Experience, null, jsx(ErrorBoundary, {
|
|
22
|
+
errorComponent: jsx(ErrorBoundaryModal, {
|
|
23
|
+
active: props.active,
|
|
24
|
+
onClose: props.onCancel
|
|
25
|
+
})
|
|
26
|
+
}, jsx(LinkCreate, props)));
|
|
27
|
+
}));
|
|
28
|
+
const ComposedLinkCreateOld = /*#__PURE__*/memo(props => {
|
|
29
|
+
return jsx(AnalyticsContext, {
|
|
30
|
+
data: PACKAGE_DATA
|
|
31
|
+
}, jsx(IntlMessagesProvider, {
|
|
32
|
+
defaultMessages: i18nEN,
|
|
33
|
+
loaderFn: fetchMessagesForLocale
|
|
34
|
+
}, jsx(LinkCreateWithAnalyticsContext, props)));
|
|
35
|
+
});
|
|
36
|
+
export default ComposedLinkCreateOld;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/* eslint-disable @atlassian/tangerine/import/no-parent-imports */
|
|
3
|
+
/**
|
|
4
|
+
* @jsxRuntime classic
|
|
5
|
+
* @jsx jsx
|
|
6
|
+
*/
|
|
7
|
+
import { useLayoutEffect, useRef } from 'react';
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
|
+
import { jsx } from '@emotion/react';
|
|
11
|
+
import { useIntl } from 'react-intl-next';
|
|
12
|
+
import { Layering } from '@atlaskit/layering';
|
|
13
|
+
import { ModalBody, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
14
|
+
import { Box } from '@atlaskit/primitives';
|
|
15
|
+
import { CREATE_FORM_MAX_WIDTH_IN_PX, DEFAULT_TEST_ID, SCREEN_ID } from '../../../common/constants';
|
|
16
|
+
import { ConfirmDismissDialog } from '../../../common/ui/confirm-dismiss-dialog';
|
|
17
|
+
import { EditModal } from '../../../common/ui/edit-modal';
|
|
18
|
+
import { ErrorBoundary } from '../../../common/ui/error-boundary';
|
|
19
|
+
import { LinkCreateContent } from '../../../common/ui/link-create-content';
|
|
20
|
+
import { ModalHero } from '../../../common/ui/modal-hero';
|
|
21
|
+
import { Modal } from '../../../common/ui/ModalDialog';
|
|
22
|
+
import { LinkCreateCallbackProvider } from '../../../controllers/callback-context';
|
|
23
|
+
import { EditPostCreateModalProvider, useEditPostCreateModal } from '../../../controllers/edit-post-create-context';
|
|
24
|
+
import { ExitWarningModalProvider, useExitWarningModal } from '../../../controllers/exit-warning-modal-context';
|
|
25
|
+
import { FormContextProvider } from '../../../controllers/form-context';
|
|
26
|
+
import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../../controllers/plugin-context';
|
|
27
|
+
import { messages } from '../messages';
|
|
28
|
+
const LinkCreateWithModal = ({
|
|
29
|
+
active,
|
|
30
|
+
modalTitle,
|
|
31
|
+
onCreate,
|
|
32
|
+
onFailure,
|
|
33
|
+
onCancel,
|
|
34
|
+
onComplete,
|
|
35
|
+
onOpenComplete,
|
|
36
|
+
onCloseComplete,
|
|
37
|
+
testId = DEFAULT_TEST_ID,
|
|
38
|
+
plugins,
|
|
39
|
+
entityKey,
|
|
40
|
+
modalHero
|
|
41
|
+
}) => {
|
|
42
|
+
const intl = useIntl();
|
|
43
|
+
const {
|
|
44
|
+
withExitWarning,
|
|
45
|
+
showExitWarning,
|
|
46
|
+
setShowExitWarning
|
|
47
|
+
} = useExitWarningModal();
|
|
48
|
+
const {
|
|
49
|
+
editViewPayload
|
|
50
|
+
} = useEditPostCreateModal();
|
|
51
|
+
const {
|
|
52
|
+
activePlugin
|
|
53
|
+
} = useLinkCreatePlugins();
|
|
54
|
+
const handleCloseExitWarning = () => setShowExitWarning(false);
|
|
55
|
+
return jsx(LinkCreateCallbackProvider, {
|
|
56
|
+
onCreate: onCreate,
|
|
57
|
+
onFailure: onFailure,
|
|
58
|
+
onCancel: withExitWarning(onCancel)
|
|
59
|
+
}, jsx(ModalTransition, null, active && jsx(Modal, {
|
|
60
|
+
testId: "link-create-modal",
|
|
61
|
+
screen: SCREEN_ID,
|
|
62
|
+
onClose: withExitWarning(onCancel),
|
|
63
|
+
shouldScrollInViewport: true,
|
|
64
|
+
onOpenComplete: onOpenComplete,
|
|
65
|
+
onCloseComplete: onCloseComplete,
|
|
66
|
+
width: `${CREATE_FORM_MAX_WIDTH_IN_PX}px`
|
|
67
|
+
}, jsx(ModalHero, {
|
|
68
|
+
hero: modalHero
|
|
69
|
+
}), jsx(ModalHeader, null, jsx(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), jsx(ModalBody, null, jsx(Box, {
|
|
70
|
+
testId: testId
|
|
71
|
+
}, jsx(ErrorBoundary, null, jsx(LinkCreateContent, {
|
|
72
|
+
plugins: plugins,
|
|
73
|
+
entityKey: entityKey
|
|
74
|
+
})))))), onComplete && jsx(EditModal, {
|
|
75
|
+
onCloseComplete: onCloseComplete,
|
|
76
|
+
onClose: onComplete,
|
|
77
|
+
editViewPayload: editViewPayload,
|
|
78
|
+
activePlugin: activePlugin
|
|
79
|
+
}), jsx(Layering, {
|
|
80
|
+
isDisabled: false
|
|
81
|
+
}, jsx(ConfirmDismissDialog, {
|
|
82
|
+
active: showExitWarning,
|
|
83
|
+
onClose: handleCloseExitWarning,
|
|
84
|
+
onCancel: onCancel
|
|
85
|
+
})));
|
|
86
|
+
};
|
|
87
|
+
const LinkCreateModalOld = props => {
|
|
88
|
+
const shouldCallCloseComplete = useRef(!props.active);
|
|
89
|
+
|
|
90
|
+
// modal calls onCloseComplete in a useEffect(), so we can track whether
|
|
91
|
+
// or not we should execute it based on the active prop in a
|
|
92
|
+
// useLayoutEffect() which will be run before child useEffect()s
|
|
93
|
+
useLayoutEffect(() => {
|
|
94
|
+
// onCloseComplete should only be called when it is not active
|
|
95
|
+
shouldCallCloseComplete.current = !props.active;
|
|
96
|
+
}, [props.active]);
|
|
97
|
+
return jsx(LinkCreatePluginsProvider, {
|
|
98
|
+
plugins: props.plugins,
|
|
99
|
+
entityKey: props.entityKey
|
|
100
|
+
}, pluginsProvider => jsx(EditPostCreateModalProvider, {
|
|
101
|
+
active: !!props.active
|
|
102
|
+
}, ({
|
|
103
|
+
setEditViewPayload,
|
|
104
|
+
editViewPayload,
|
|
105
|
+
shouldActivateEditView,
|
|
106
|
+
enableEditView
|
|
107
|
+
}) => {
|
|
108
|
+
var _pluginsProvider$acti;
|
|
109
|
+
return jsx(FormContextProvider, {
|
|
110
|
+
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
|
|
111
|
+
}, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
|
|
112
|
+
active: props.active && !editViewPayload,
|
|
113
|
+
onCreate: async payload => {
|
|
114
|
+
var _props$onCreate;
|
|
115
|
+
await ((_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload));
|
|
116
|
+
|
|
117
|
+
// if onComplete exists then there is an edit flow
|
|
118
|
+
if (props.onComplete) {
|
|
119
|
+
if (shouldActivateEditView()) {
|
|
120
|
+
//edit button is pressed
|
|
121
|
+
setEditViewPayload(payload);
|
|
122
|
+
} else {
|
|
123
|
+
//create button is pressed
|
|
124
|
+
props.onComplete();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
onCloseComplete: (...args) => {
|
|
129
|
+
if (shouldCallCloseComplete.current) {
|
|
130
|
+
var _props$onCloseComplet;
|
|
131
|
+
(_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 ? void 0 : _props$onCloseComplet.call(props, ...args);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}))));
|
|
135
|
+
}));
|
|
136
|
+
};
|
|
137
|
+
export default LinkCreateModalOld;
|
|
@@ -3,11 +3,14 @@ export var COMPONENT_NAME = 'linkCreate';
|
|
|
3
3
|
export var SCREEN_ID = 'linkCreateScreen';
|
|
4
4
|
export var DEFAULT_TEST_ID = 'link-create';
|
|
5
5
|
export var CREATE_FORM_MAX_WIDTH_IN_PX = '480';
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Remove on FF clean up platform_bandicoots-link-create-css
|
|
8
|
+
*/
|
|
6
9
|
export var CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
|
|
7
10
|
export var LINK_CREATE_FORM_POST_CREATE_FIELD = '__post_create__';
|
|
8
11
|
export var PACKAGE_DATA = {
|
|
9
12
|
packageName: "@atlaskit/link-create" || '',
|
|
10
|
-
packageVersion: "2.
|
|
13
|
+
packageVersion: "2.15.0" || '',
|
|
11
14
|
component: COMPONENT_NAME,
|
|
12
15
|
componentName: COMPONENT_NAME
|
|
13
16
|
};
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
1
|
+
import React from 'react';
|
|
7
2
|
import Modal, { ModalBody, ModalTransition } from '@atlaskit/modal-dialog';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
4
|
import { CREATE_FORM_MAX_WIDTH_IN_PX } from '../../constants';
|
|
9
5
|
import { ErrorBoundaryUI } from '../error-boundary-ui';
|
|
6
|
+
import { ErrorBoundaryModalOld } from './old';
|
|
10
7
|
|
|
11
8
|
/**
|
|
12
9
|
* ErrorBoundaryModal props are the same as those passed to LinkCreate, which
|
|
13
10
|
* are used to control its active state
|
|
14
11
|
*/
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
var ErrorBoundaryModalNew = function ErrorBoundaryModalNew(_ref) {
|
|
17
14
|
var active = _ref.active,
|
|
18
15
|
onClose = _ref.onClose;
|
|
19
|
-
return
|
|
16
|
+
return /*#__PURE__*/React.createElement(ModalTransition, null, active && /*#__PURE__*/React.createElement(Modal, {
|
|
20
17
|
testId: "link-create-error-boundary-modal",
|
|
21
18
|
onClose: onClose,
|
|
22
19
|
shouldScrollInViewport: true,
|
|
23
20
|
width: "".concat(CREATE_FORM_MAX_WIDTH_IN_PX, "px")
|
|
24
|
-
},
|
|
21
|
+
}, /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(ErrorBoundaryUI, null))));
|
|
22
|
+
};
|
|
23
|
+
export var ErrorBoundaryModal = function ErrorBoundaryModal(props) {
|
|
24
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
25
|
+
return /*#__PURE__*/React.createElement(ErrorBoundaryModalNew, props);
|
|
26
|
+
}
|
|
27
|
+
return /*#__PURE__*/React.createElement(ErrorBoundaryModalOld, props);
|
|
25
28
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
import Modal, { ModalBody, ModalTransition } from '@atlaskit/modal-dialog';
|
|
8
|
+
import { CREATE_FORM_MAX_WIDTH_IN_PX } from '../../../constants';
|
|
9
|
+
import { ErrorBoundaryUI } from '../../error-boundary-ui';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* ErrorBoundaryModal props are the same as those passed to LinkCreate, which
|
|
13
|
+
* are used to control its active state
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export var ErrorBoundaryModalOld = function ErrorBoundaryModalOld(_ref) {
|
|
17
|
+
var active = _ref.active,
|
|
18
|
+
onClose = _ref.onClose;
|
|
19
|
+
return jsx(ModalTransition, null, active && jsx(Modal, {
|
|
20
|
+
testId: "link-create-error-boundary-modal",
|
|
21
|
+
onClose: onClose,
|
|
22
|
+
shouldScrollInViewport: true,
|
|
23
|
+
width: "".concat(CREATE_FORM_MAX_WIDTH_IN_PX, "px")
|
|
24
|
+
}, jsx(ModalBody, null, jsx(ErrorBoundaryUI, null))));
|
|
25
|
+
};
|