@atlaskit/link-create 1.15.9 → 2.1.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 +357 -310
- package/CONTRIBUTING.md +3 -0
- package/dist/cjs/common/constants.js +8 -2
- package/dist/cjs/{ui/link-create → common/ui}/confirm-dismiss-dialog/main.js +4 -6
- package/dist/cjs/{ui/link-create → common/ui}/edit-modal/index.js +4 -8
- package/dist/cjs/{ui/link-create → common/ui}/error-boundary/index.js +6 -15
- package/dist/cjs/{controllers → common/ui}/experience-tracker/index.js +3 -3
- package/dist/cjs/common/ui/link-create-content/index.js +21 -0
- package/dist/cjs/{ui/link-create → common/ui}/modal-hero/index.js +1 -3
- package/dist/cjs/controllers/callback-context/main.js +8 -15
- package/dist/cjs/ui/create-form/async-select/main.js +2 -5
- package/dist/cjs/ui/create-form/main.js +3 -4
- package/dist/cjs/ui/index.js +11 -4
- package/dist/cjs/ui/inline-create/index.js +38 -0
- package/dist/cjs/ui/inline-create/main.js +125 -0
- package/dist/cjs/ui/modal-create/index.js +38 -0
- package/dist/cjs/ui/{link-create → modal-create}/main.js +45 -81
- package/dist/es2019/common/constants.js +7 -1
- package/dist/es2019/{ui/link-create → common/ui}/confirm-dismiss-dialog/main.js +4 -7
- package/dist/es2019/{ui/link-create → common/ui}/edit-modal/index.js +4 -10
- package/dist/es2019/{ui/link-create → common/ui}/error-boundary/index.js +6 -15
- package/dist/es2019/{controllers → common/ui}/experience-tracker/index.js +3 -3
- package/dist/es2019/common/ui/link-create-content/index.js +11 -0
- package/dist/es2019/{ui/link-create → common/ui}/modal-hero/index.js +1 -3
- package/dist/es2019/controllers/callback-context/main.js +8 -15
- package/dist/es2019/index.js +4 -1
- package/dist/es2019/ui/create-form/async-select/main.js +2 -5
- package/dist/es2019/ui/create-form/main.js +3 -4
- package/dist/es2019/ui/index.js +2 -1
- package/dist/es2019/ui/inline-create/index.js +30 -0
- package/dist/es2019/ui/inline-create/main.js +100 -0
- package/dist/es2019/ui/modal-create/index.js +30 -0
- package/dist/es2019/ui/{link-create → modal-create}/main.js +22 -40
- package/dist/esm/common/constants.js +7 -1
- package/dist/esm/{ui/link-create → common/ui}/confirm-dismiss-dialog/main.js +4 -6
- package/dist/esm/{ui/link-create → common/ui}/edit-modal/index.js +4 -8
- package/dist/esm/{ui/link-create → common/ui}/error-boundary/index.js +6 -15
- package/dist/esm/{controllers → common/ui}/experience-tracker/index.js +3 -3
- package/dist/esm/common/ui/link-create-content/index.js +12 -0
- package/dist/esm/{ui/link-create → common/ui}/modal-hero/index.js +1 -3
- package/dist/esm/controllers/callback-context/main.js +8 -15
- package/dist/esm/index.js +4 -1
- package/dist/esm/ui/create-form/async-select/main.js +2 -5
- package/dist/esm/ui/create-form/main.js +3 -4
- package/dist/esm/ui/index.js +2 -1
- package/dist/esm/ui/inline-create/index.js +30 -0
- package/dist/esm/ui/inline-create/main.js +119 -0
- package/dist/esm/ui/modal-create/index.js +30 -0
- package/dist/esm/ui/{link-create → modal-create}/main.js +48 -84
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/types.d.ts +2 -2
- package/dist/types/common/ui/Button/index.d.ts +2 -2
- package/dist/types/common/ui/ModalDialog/index.d.ts +1 -1
- package/dist/types/common/ui/confirm-dismiss-dialog/main.d.ts +7 -0
- package/dist/types/common/ui/edit-modal/index.d.ts +11 -0
- package/dist/types/{ui/link-create → common/ui}/error-boundary/error-boundary-base/index.d.ts +1 -1
- package/dist/types/{ui/link-create → common/ui}/error-boundary/index.d.ts +1 -1
- package/dist/types/common/ui/link-create-content/index.d.ts +8 -0
- package/dist/types/common/utils/analytics/components.d.ts +1 -1
- package/dist/types/common/utils/analytics/context.d.ts +2 -2
- package/dist/types/common/utils/form/index.d.ts +1 -1
- package/dist/types/common/utils/locale/fetch-messages-for-locale.d.ts +1 -1
- package/dist/types/controllers/callback-context/main.d.ts +2 -2
- package/dist/types/controllers/create-field/main.d.ts +1 -1
- package/dist/types/controllers/create-field/types.d.ts +2 -2
- package/dist/types/controllers/edit-post-create-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 -2
- package/dist/types/ui/create-form/async-select/types.d.ts +2 -2
- package/dist/types/ui/create-form/form-loader/main.d.ts +1 -1
- package/dist/types/ui/create-form/main.d.ts +1 -1
- package/dist/types/ui/create-form/select/main.d.ts +2 -2
- package/dist/types/ui/create-form/select/types.d.ts +2 -2
- package/dist/types/ui/create-form/textfield/main.d.ts +1 -1
- package/dist/types/ui/create-form/textfield/types.d.ts +2 -2
- package/dist/types/ui/create-form/utils/index.d.ts +1 -1
- package/dist/types/ui/index.d.ts +2 -1
- package/dist/types/ui/inline-create/index.d.ts +5 -0
- package/dist/types/ui/inline-create/main.d.ts +5 -0
- package/dist/types/ui/modal-create/index.d.ts +5 -0
- package/dist/{types-ts4.5/ui/link-create → types/ui/modal-create}/main.d.ts +1 -1
- package/dist/types-ts4.5/common/constants.d.ts +2 -0
- package/dist/types-ts4.5/common/types.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/Button/index.d.ts +2 -2
- 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 +7 -0
- package/dist/types-ts4.5/common/ui/edit-modal/index.d.ts +11 -0
- package/dist/types-ts4.5/{ui/link-create → common/ui}/error-boundary/error-boundary-base/index.d.ts +1 -1
- package/dist/types-ts4.5/{ui/link-create → common/ui}/error-boundary/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/link-create-content/index.d.ts +8 -0
- package/dist/types-ts4.5/common/utils/analytics/components.d.ts +1 -1
- package/dist/types-ts4.5/common/utils/analytics/context.d.ts +2 -2
- package/dist/types-ts4.5/common/utils/form/index.d.ts +1 -1
- package/dist/types-ts4.5/common/utils/locale/fetch-messages-for-locale.d.ts +1 -1
- package/dist/types-ts4.5/controllers/callback-context/main.d.ts +2 -2
- package/dist/types-ts4.5/controllers/create-field/main.d.ts +1 -1
- package/dist/types-ts4.5/controllers/create-field/types.d.ts +2 -2
- package/dist/types-ts4.5/controllers/edit-post-create-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 -2
- package/dist/types-ts4.5/ui/create-form/async-select/types.d.ts +2 -2
- package/dist/types-ts4.5/ui/create-form/form-loader/main.d.ts +1 -1
- package/dist/types-ts4.5/ui/create-form/main.d.ts +1 -1
- package/dist/types-ts4.5/ui/create-form/select/main.d.ts +2 -2
- package/dist/types-ts4.5/ui/create-form/select/types.d.ts +2 -2
- package/dist/types-ts4.5/ui/create-form/textfield/main.d.ts +1 -1
- package/dist/types-ts4.5/ui/create-form/textfield/types.d.ts +2 -2
- package/dist/types-ts4.5/ui/create-form/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/{main.d.ts → inline-create/index.d.ts} +1 -3
- package/dist/types-ts4.5/ui/inline-create/main.d.ts +5 -0
- package/dist/{types/ui/main.d.ts → types-ts4.5/ui/modal-create/index.d.ts} +1 -3
- package/dist/{types/ui/link-create → types-ts4.5/ui/modal-create}/main.d.ts +1 -1
- package/example-helpers/mock-plugin-form.tsx +2 -2
- package/package.json +9 -19
- package/dist/cjs/ui/link-create/index.js +0 -13
- package/dist/cjs/ui/main.js +0 -46
- package/dist/es2019/ui/link-create/index.js +0 -1
- package/dist/es2019/ui/main.js +0 -38
- package/dist/esm/ui/link-create/index.js +0 -1
- package/dist/esm/ui/main.js +0 -38
- package/dist/types/ui/link-create/confirm-dismiss-dialog/main.d.ts +0 -6
- package/dist/types/ui/link-create/edit-modal/index.d.ts +0 -8
- package/dist/types/ui/link-create/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/link-create/confirm-dismiss-dialog/main.d.ts +0 -6
- package/dist/types-ts4.5/ui/link-create/edit-modal/index.d.ts +0 -8
- package/dist/types-ts4.5/ui/link-create/index.d.ts +0 -1
- /package/dist/cjs/{ui/link-create → common/ui}/confirm-dismiss-dialog/index.js +0 -0
- /package/dist/cjs/{ui/link-create → common/ui}/confirm-dismiss-dialog/messages.js +0 -0
- /package/dist/cjs/{ui/link-create → common/ui}/error-boundary/error-boundary-base/index.js +0 -0
- /package/dist/cjs/ui/{link-create → modal-create}/messages.js +0 -0
- /package/dist/es2019/{ui/link-create → common/ui}/confirm-dismiss-dialog/index.js +0 -0
- /package/dist/es2019/{ui/link-create → common/ui}/confirm-dismiss-dialog/messages.js +0 -0
- /package/dist/es2019/{ui/link-create → common/ui}/error-boundary/error-boundary-base/index.js +0 -0
- /package/dist/es2019/ui/{link-create → modal-create}/messages.js +0 -0
- /package/dist/esm/{ui/link-create → common/ui}/confirm-dismiss-dialog/index.js +0 -0
- /package/dist/esm/{ui/link-create → common/ui}/confirm-dismiss-dialog/messages.js +0 -0
- /package/dist/esm/{ui/link-create → common/ui}/error-boundary/error-boundary-base/index.js +0 -0
- /package/dist/esm/ui/{link-create → modal-create}/messages.js +0 -0
- /package/dist/types/{ui/link-create → common/ui}/confirm-dismiss-dialog/index.d.ts +0 -0
- /package/dist/types/{ui/link-create → common/ui}/confirm-dismiss-dialog/messages.d.ts +0 -0
- /package/dist/types/{controllers → common/ui}/experience-tracker/index.d.ts +0 -0
- /package/dist/types/{ui/link-create → common/ui}/modal-hero/index.d.ts +0 -0
- /package/dist/types/ui/{link-create → modal-create}/messages.d.ts +0 -0
- /package/dist/types-ts4.5/{ui/link-create → common/ui}/confirm-dismiss-dialog/index.d.ts +0 -0
- /package/dist/types-ts4.5/{ui/link-create → common/ui}/confirm-dismiss-dialog/messages.d.ts +0 -0
- /package/dist/types-ts4.5/{controllers → common/ui}/experience-tracker/index.d.ts +0 -0
- /package/dist/types-ts4.5/{ui/link-create → common/ui}/modal-hero/index.d.ts +0 -0
- /package/dist/types-ts4.5/ui/{link-create → modal-create}/messages.d.ts +0 -0
|
@@ -1,92 +1,53 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
5
|
/** @jsx jsx */
|
|
6
|
-
import {
|
|
6
|
+
import { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import { useIntl } from 'react-intl-next';
|
|
9
9
|
import { ModalBody, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
10
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { Box } from '@atlaskit/primitives';
|
|
12
11
|
import { CREATE_FORM_MAX_WIDTH_IN_PX } from '../../common/constants';
|
|
12
|
+
import { ConfirmDismissDialog } from '../../common/ui/confirm-dismiss-dialog';
|
|
13
|
+
import { EditModal } from '../../common/ui/edit-modal';
|
|
14
|
+
import { ErrorBoundary } from '../../common/ui/error-boundary';
|
|
15
|
+
import { LinkCreateContent } from '../../common/ui/link-create-content';
|
|
16
|
+
import { ModalHero } from '../../common/ui/modal-hero';
|
|
13
17
|
import { Modal } from '../../common/ui/ModalDialog';
|
|
14
18
|
import { LinkCreateCallbackProvider } from '../../controllers/callback-context';
|
|
15
|
-
import { EditPostCreateModalProvider } from '../../controllers/edit-post-create-context';
|
|
19
|
+
import { EditPostCreateModalProvider, useEditPostCreateModal } from '../../controllers/edit-post-create-context';
|
|
16
20
|
import { ExitWarningModalProvider, useExitWarningModal } from '../../controllers/exit-warning-modal-context';
|
|
17
|
-
import { FormContextProvider
|
|
18
|
-
import { LinkCreatePluginsProvider } from '../../controllers/plugin-context';
|
|
19
|
-
import { ConfirmDismissDialog } from './confirm-dismiss-dialog';
|
|
20
|
-
import { EditModal } from './edit-modal';
|
|
21
|
-
import { ErrorBoundary } from './error-boundary';
|
|
21
|
+
import { FormContextProvider } from '../../controllers/form-context';
|
|
22
|
+
import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../controllers/plugin-context';
|
|
22
23
|
import { messages } from './messages';
|
|
23
|
-
import { ModalHero } from './modal-hero';
|
|
24
24
|
export var TEST_ID = 'link-create';
|
|
25
25
|
var SCREEN_ID = 'linkCreateScreen';
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
onCreate = _ref2.onCreate,
|
|
41
|
-
onFailure = _ref2.onFailure,
|
|
42
|
-
onCancel = _ref2.onCancel,
|
|
43
|
-
onComplete = _ref2.onComplete,
|
|
44
|
-
onOpenComplete = _ref2.onOpenComplete,
|
|
45
|
-
onCloseComplete = _ref2.onCloseComplete,
|
|
46
|
-
_ref2$testId = _ref2.testId,
|
|
47
|
-
testId = _ref2$testId === void 0 ? TEST_ID : _ref2$testId,
|
|
48
|
-
plugins = _ref2.plugins,
|
|
49
|
-
entityKey = _ref2.entityKey,
|
|
50
|
-
modalHero = _ref2.modalHero;
|
|
26
|
+
var LinkCreateWithModal = function LinkCreateWithModal(_ref) {
|
|
27
|
+
var active = _ref.active,
|
|
28
|
+
modalTitle = _ref.modalTitle,
|
|
29
|
+
onCreate = _ref.onCreate,
|
|
30
|
+
onFailure = _ref.onFailure,
|
|
31
|
+
onCancel = _ref.onCancel,
|
|
32
|
+
onComplete = _ref.onComplete,
|
|
33
|
+
onOpenComplete = _ref.onOpenComplete,
|
|
34
|
+
onCloseComplete = _ref.onCloseComplete,
|
|
35
|
+
_ref$testId = _ref.testId,
|
|
36
|
+
testId = _ref$testId === void 0 ? TEST_ID : _ref$testId,
|
|
37
|
+
plugins = _ref.plugins,
|
|
38
|
+
entityKey = _ref.entityKey,
|
|
39
|
+
modalHero = _ref.modalHero;
|
|
51
40
|
var intl = useIntl();
|
|
52
|
-
var _useFormContext = useFormContext(),
|
|
53
|
-
setFormErrorMessage = _useFormContext.setFormErrorMessage;
|
|
54
|
-
var handleCreate = useCallback( /*#__PURE__*/function () {
|
|
55
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(result) {
|
|
56
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
57
|
-
while (1) switch (_context.prev = _context.next) {
|
|
58
|
-
case 0:
|
|
59
|
-
// Reset the form error message
|
|
60
|
-
setFormErrorMessage(undefined);
|
|
61
|
-
if (!onCreate) {
|
|
62
|
-
_context.next = 4;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
_context.next = 4;
|
|
66
|
-
return onCreate(result);
|
|
67
|
-
case 4:
|
|
68
|
-
case "end":
|
|
69
|
-
return _context.stop();
|
|
70
|
-
}
|
|
71
|
-
}, _callee);
|
|
72
|
-
}));
|
|
73
|
-
return function (_x) {
|
|
74
|
-
return _ref3.apply(this, arguments);
|
|
75
|
-
};
|
|
76
|
-
}(), [onCreate, setFormErrorMessage]);
|
|
77
|
-
var handleFailure = useCallback(function (error) {
|
|
78
|
-
// Set the form error message
|
|
79
|
-
if (error instanceof Error) {
|
|
80
|
-
setFormErrorMessage(error.message);
|
|
81
|
-
}
|
|
82
|
-
onFailure && onFailure(error);
|
|
83
|
-
}, [onFailure, setFormErrorMessage]);
|
|
84
41
|
var _useExitWarningModal = useExitWarningModal(),
|
|
85
42
|
getShouldShowWarning = _useExitWarningModal.getShouldShowWarning;
|
|
86
43
|
var _useState = useState(false),
|
|
87
44
|
_useState2 = _slicedToArray(_useState, 2),
|
|
88
45
|
showExitWarning = _useState2[0],
|
|
89
46
|
setShowExitWarning = _useState2[1];
|
|
47
|
+
var _useEditPostCreateMod = useEditPostCreateModal(),
|
|
48
|
+
editViewPayload = _useEditPostCreateMod.editViewPayload;
|
|
49
|
+
var _useLinkCreatePlugins = useLinkCreatePlugins(),
|
|
50
|
+
activePlugin = _useLinkCreatePlugins.activePlugin;
|
|
90
51
|
var handleCancel = useCallback(function () {
|
|
91
52
|
if (getShouldShowWarning() && !showExitWarning) {
|
|
92
53
|
setShowExitWarning(true);
|
|
@@ -98,8 +59,8 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref2) {
|
|
|
98
59
|
return setShowExitWarning(false);
|
|
99
60
|
}, []);
|
|
100
61
|
return jsx(LinkCreateCallbackProvider, {
|
|
101
|
-
onCreate:
|
|
102
|
-
onFailure:
|
|
62
|
+
onCreate: onCreate,
|
|
63
|
+
onFailure: onFailure,
|
|
103
64
|
onCancel: handleCancel
|
|
104
65
|
}, jsx(ModalTransition, null, active && jsx(Modal, {
|
|
105
66
|
testId: "link-create-modal",
|
|
@@ -118,10 +79,13 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref2) {
|
|
|
118
79
|
entityKey: entityKey
|
|
119
80
|
})))))), onComplete && jsx(EditModal, {
|
|
120
81
|
onCloseComplete: onCloseComplete,
|
|
121
|
-
onClose: onComplete
|
|
82
|
+
onClose: onComplete,
|
|
83
|
+
editViewPayload: editViewPayload,
|
|
84
|
+
activePlugin: activePlugin
|
|
122
85
|
}), jsx(ConfirmDismissDialog, {
|
|
123
86
|
active: showExitWarning,
|
|
124
|
-
onClose: handleCloseExitWarning
|
|
87
|
+
onClose: handleCloseExitWarning,
|
|
88
|
+
onCancel: onCancel
|
|
125
89
|
}));
|
|
126
90
|
};
|
|
127
91
|
var LinkCreateModal = function LinkCreateModal(props) {
|
|
@@ -140,23 +104,23 @@ var LinkCreateModal = function LinkCreateModal(props) {
|
|
|
140
104
|
}, function (pluginsProvider) {
|
|
141
105
|
return jsx(EditPostCreateModalProvider, {
|
|
142
106
|
active: !!props.active
|
|
143
|
-
}, function (
|
|
107
|
+
}, function (_ref2) {
|
|
144
108
|
var _pluginsProvider$acti;
|
|
145
|
-
var setEditViewPayload =
|
|
146
|
-
editViewPayload =
|
|
147
|
-
shouldActivateEditView =
|
|
148
|
-
enableEditView =
|
|
109
|
+
var setEditViewPayload = _ref2.setEditViewPayload,
|
|
110
|
+
editViewPayload = _ref2.editViewPayload,
|
|
111
|
+
shouldActivateEditView = _ref2.shouldActivateEditView,
|
|
112
|
+
enableEditView = _ref2.enableEditView;
|
|
149
113
|
return jsx(FormContextProvider, {
|
|
150
114
|
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
115
|
}, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
|
|
152
116
|
active: props.active && !editViewPayload,
|
|
153
117
|
onCreate: ( /*#__PURE__*/function () {
|
|
154
|
-
var
|
|
118
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(payload) {
|
|
155
119
|
var _props$onCreate;
|
|
156
|
-
return _regeneratorRuntime.wrap(function
|
|
157
|
-
while (1) switch (
|
|
120
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
121
|
+
while (1) switch (_context.prev = _context.next) {
|
|
158
122
|
case 0:
|
|
159
|
-
|
|
123
|
+
_context.next = 2;
|
|
160
124
|
return (_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload);
|
|
161
125
|
case 2:
|
|
162
126
|
// if onComplete exists then there is an edit flow
|
|
@@ -171,12 +135,12 @@ var LinkCreateModal = function LinkCreateModal(props) {
|
|
|
171
135
|
}
|
|
172
136
|
case 3:
|
|
173
137
|
case "end":
|
|
174
|
-
return
|
|
138
|
+
return _context.stop();
|
|
175
139
|
}
|
|
176
|
-
},
|
|
140
|
+
}, _callee);
|
|
177
141
|
}));
|
|
178
|
-
return function (
|
|
179
|
-
return
|
|
142
|
+
return function (_x) {
|
|
143
|
+
return _ref3.apply(this, arguments);
|
|
180
144
|
};
|
|
181
145
|
}()),
|
|
182
146
|
onCloseComplete: function onCloseComplete() {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { PackageMetaDataType } from './utils/analytics/analytics.codegen';
|
|
1
2
|
export declare const ANALYTICS_CHANNEL = "media";
|
|
2
3
|
export declare const COMPONENT_NAME = "linkCreate";
|
|
3
4
|
export declare const CREATE_FORM_MAX_WIDTH_IN_PX = "480";
|
|
4
5
|
export declare const CREATE_FORM_MIN_HEIGHT_IN_PX = "200";
|
|
5
6
|
export declare const LINK_CREATE_FORM_POST_CREATE_FIELD = "__post_create__";
|
|
7
|
+
export declare const PACKAGE_DATA: PackageMetaDataType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { ModalDialogProps } from '@atlaskit/modal-dialog';
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ModalDialogProps } from '@atlaskit/modal-dialog';
|
|
3
3
|
/** Map of field names to a list of validators for that field */
|
|
4
4
|
export type ValidatorMap = Record<string, Validator[]>;
|
|
5
5
|
export type Validator = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AnalyticsEventAttributes } from '../../../common/utils/analytics/analytics.codegen';
|
|
2
|
+
import { type AnalyticsEventAttributes } from '../../../common/utils/analytics/analytics.codegen';
|
|
3
3
|
export declare const Button: React.ForwardRefExoticComponent<Pick<import("@atlaskit/button").ButtonProps & React.RefAttributes<HTMLElement> & {
|
|
4
4
|
actionSubjectId: "create" | "edit" | "cancel" | "confirm";
|
|
5
|
-
}, "key" | keyof import("@atlaskit/button").ButtonProps
|
|
5
|
+
}, "actionSubjectId" | "key" | keyof import("@atlaskit/button").ButtonProps> & React.RefAttributes<HTMLElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ModalDialog from '@atlaskit/modal-dialog';
|
|
3
|
-
import { AnalyticsEventAttributes } from '../../utils/analytics/analytics.codegen';
|
|
3
|
+
import { type AnalyticsEventAttributes } from '../../utils/analytics/analytics.codegen';
|
|
4
4
|
type ModalProps = React.ComponentProps<typeof ModalDialog> & {
|
|
5
5
|
screen: keyof {
|
|
6
6
|
[Key in keyof AnalyticsEventAttributes as Key extends `screen.${infer ScreenName}.viewed` ? ScreenName : never]: any;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type ConfirmDismissDialogProps = {
|
|
3
|
+
active: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onCancel?: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const ConfirmDismissDialog: ({ active, onClose, onCancel, }: ConfirmDismissDialogProps) => JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type CreatePayload, type LinkCreatePlugin } from '../../types';
|
|
3
|
+
import { Modal } from '../ModalDialog';
|
|
4
|
+
type EditModalProps = {
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onCloseComplete?: React.ComponentProps<typeof Modal>['onCloseComplete'];
|
|
7
|
+
editViewPayload?: CreatePayload;
|
|
8
|
+
activePlugin?: LinkCreatePlugin<string> | null;
|
|
9
|
+
};
|
|
10
|
+
export declare const EditModal: ({ onClose, onCloseComplete, editViewPayload, activePlugin, }: EditModalProps) => JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { LinkCreatePlugin } from '../../types';
|
|
3
|
+
type LinkCreateContentProps = {
|
|
4
|
+
plugins: LinkCreatePlugin[];
|
|
5
|
+
entityKey: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const LinkCreateContent: ({ plugins, entityKey, }: LinkCreateContentProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnalyticsEventAttributes } from './analytics.codegen';
|
|
1
|
+
import { type AnalyticsEventAttributes } from './analytics.codegen';
|
|
2
2
|
export type ScreenViewedEventProps = {
|
|
3
3
|
screen: keyof {
|
|
4
4
|
[Key in keyof AnalyticsEventAttributes as Key extends `screen.${infer ScreenName}.viewed` ? ScreenName : never]: any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { LinkCreateProps } from '../../types';
|
|
3
|
-
import { LinkCreateAnalyticsContextType } from './analytics.codegen';
|
|
2
|
+
import { type LinkCreateProps } from '../../types';
|
|
3
|
+
import { type LinkCreateAnalyticsContextType } from './analytics.codegen';
|
|
4
4
|
export type TrackAttribute = <K extends keyof LinkCreateAnalyticsContextType>(attribute: K, value: LinkCreateAnalyticsContextType[K]) => void;
|
|
5
5
|
interface AnalyticsContextType {
|
|
6
6
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { I18NMessages } from '@atlaskit/intl-messages-provider';
|
|
1
|
+
import { type I18NMessages } from '@atlaskit/intl-messages-provider';
|
|
2
2
|
export declare const fetchMessagesForLocale: (locale: string) => Promise<I18NMessages | undefined>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { CreatePayload } from '../../common/types';
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
import { type CreatePayload } from '../../common/types';
|
|
3
3
|
interface LinkCreateCallbackProviderProps {
|
|
4
4
|
/**
|
|
5
5
|
* This callback for when the resource has been successfully created.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
import { CreateFieldProps } from './types';
|
|
3
|
+
import { type CreateFieldProps } from './types';
|
|
4
4
|
export declare function CreateField({ id, name, label, isRequired, validators, validationHelpText, testId, children, }: CreateFieldProps): jsx.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { FieldInputProps } from 'react-final-form';
|
|
3
|
-
import { Validator } from '../../common/types';
|
|
2
|
+
import { type FieldInputProps } from 'react-final-form';
|
|
3
|
+
import { type Validator } from '../../common/types';
|
|
4
4
|
type FieldProps = FieldInputProps<any, HTMLElement> & {
|
|
5
5
|
fieldId: string;
|
|
6
6
|
isInvalid: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import { LinkCreateProps } from '../../common/types';
|
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
|
2
|
+
import { type LinkCreateProps } from '../../common/types';
|
|
3
3
|
interface FormContextType {
|
|
4
4
|
setFormErrorMessage: (errorMessage?: string) => void;
|
|
5
5
|
formErrorMessage?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import { OptionType } from '@atlaskit/select';
|
|
3
|
-
import { AsyncSelectProps } from './types';
|
|
2
|
+
import { type OptionType } from '@atlaskit/select';
|
|
3
|
+
import { type AsyncSelectProps } from './types';
|
|
4
4
|
export declare const TEST_ID = "link-create-async-select";
|
|
5
5
|
/**
|
|
6
6
|
* An async select utilising the Atlaskit AsyncSelect and CreateField.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AsyncSelectProps as AKAsyncSelectProps, GroupType, OptionType } from '@atlaskit/select';
|
|
2
|
-
import { Validator } from '../../../common/types';
|
|
1
|
+
import { type AsyncSelectProps as AKAsyncSelectProps, type GroupType, type OptionType } from '@atlaskit/select';
|
|
2
|
+
import { type Validator } from '../../../common/types';
|
|
3
3
|
export type AsyncSelectProps<T = OptionType> = Omit<AKAsyncSelectProps<T>, 'loadOptions'> & {
|
|
4
4
|
/** Name passed to the <Field> */
|
|
5
5
|
name: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
import { SpinnerProps } from '@atlaskit/spinner';
|
|
3
|
+
import { type SpinnerProps } from '@atlaskit/spinner';
|
|
4
4
|
/**
|
|
5
5
|
* Wrapper component for the Spinner, shows while the form
|
|
6
6
|
* performs async functions on load.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
import { OptionType } from '@atlaskit/select';
|
|
4
|
-
import { SelectProps } from './types';
|
|
3
|
+
import { type OptionType } from '@atlaskit/select';
|
|
4
|
+
import { type SelectProps } from './types';
|
|
5
5
|
export declare const TEST_ID = "link-create-select";
|
|
6
6
|
/**
|
|
7
7
|
* A select component utilising the Atlaskit Select and CreateField.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SelectProps as AKSelectProps, OptionType } from '@atlaskit/select';
|
|
2
|
-
import { Validator } from '../../../common/types';
|
|
1
|
+
import { type SelectProps as AKSelectProps, type OptionType } from '@atlaskit/select';
|
|
2
|
+
import { type Validator } from '../../../common/types';
|
|
3
3
|
export type SelectProps<T = OptionType> = AKSelectProps<T> & {
|
|
4
4
|
/** Name passed to the <Field> */
|
|
5
5
|
name: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
import { TextFieldProps } from './types';
|
|
3
|
+
import { type TextFieldProps } from './types';
|
|
4
4
|
export declare const TEST_ID = "link-create-text-field";
|
|
5
5
|
/**
|
|
6
6
|
* A text field utilising the Atlaskit Textfield and CreateField.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TextFieldProps as AKTextFieldProps } from '@atlaskit/textfield';
|
|
2
|
-
import { Validator } from '../../../common/types';
|
|
1
|
+
import { type TextFieldProps as AKTextFieldProps } from '@atlaskit/textfield';
|
|
2
|
+
import { type Validator } from '../../../common/types';
|
|
3
3
|
export type TextFieldProps = Omit<AKTextFieldProps, 'name'> & {
|
|
4
4
|
/** Name passed to the <Field>.*/
|
|
5
5
|
name: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ValidatorMap } from '../../../common/types';
|
|
1
|
+
import { type ValidatorMap } from '../../../common/types';
|
|
2
2
|
/** Map of field names to errors for that field (or undefined if no error for that field) */
|
|
3
3
|
export type ValidatorResults = {
|
|
4
4
|
[name: string]: string | undefined;
|
package/dist/types/ui/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { default } from './
|
|
1
|
+
export { default } from './modal-create';
|
|
2
|
+
export { default as InlineCreate } from './inline-create';
|
|
2
3
|
export { TextField } from './create-form/textfield';
|
|
3
4
|
export { CreateForm } from './create-form/main';
|
|
4
5
|
export { CreateFormLoader } from './create-form/form-loader';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import type { LinkCreateWithModalProps } from '../../common/types';
|
|
4
|
+
declare const ComposedLinkCreate: import("react").MemoExoticComponent<(props: LinkCreateWithModalProps) => jsx.JSX.Element>;
|
|
5
|
+
export default ComposedLinkCreate;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { type LinkCreateWithModalProps } from '../../common/types';
|
|
4
|
+
declare const ComposedLinkCreate: import("react").MemoExoticComponent<(props: LinkCreateWithModalProps) => jsx.JSX.Element>;
|
|
5
|
+
export default ComposedLinkCreate;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import { LinkCreateWithModalProps } from '../../common/types';
|
|
2
|
+
import type { LinkCreateWithModalProps } from '../../common/types';
|
|
3
3
|
export declare const TEST_ID = "link-create";
|
|
4
4
|
declare const LinkCreateModal: (props: LinkCreateWithModalProps) => jsx.JSX.Element;
|
|
5
5
|
export default LinkCreateModal;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { PackageMetaDataType } from './utils/analytics/analytics.codegen';
|
|
1
2
|
export declare const ANALYTICS_CHANNEL = "media";
|
|
2
3
|
export declare const COMPONENT_NAME = "linkCreate";
|
|
3
4
|
export declare const CREATE_FORM_MAX_WIDTH_IN_PX = "480";
|
|
4
5
|
export declare const CREATE_FORM_MIN_HEIGHT_IN_PX = "200";
|
|
5
6
|
export declare const LINK_CREATE_FORM_POST_CREATE_FIELD = "__post_create__";
|
|
7
|
+
export declare const PACKAGE_DATA: PackageMetaDataType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { ModalDialogProps } from '@atlaskit/modal-dialog';
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ModalDialogProps } from '@atlaskit/modal-dialog';
|
|
3
3
|
/** Map of field names to a list of validators for that field */
|
|
4
4
|
export type ValidatorMap = Record<string, Validator[]>;
|
|
5
5
|
export type Validator = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AnalyticsEventAttributes } from '../../../common/utils/analytics/analytics.codegen';
|
|
2
|
+
import { type AnalyticsEventAttributes } from '../../../common/utils/analytics/analytics.codegen';
|
|
3
3
|
export declare const Button: React.ForwardRefExoticComponent<Pick<import("@atlaskit/button").ButtonProps & React.RefAttributes<HTMLElement> & {
|
|
4
4
|
actionSubjectId: "create" | "edit" | "cancel" | "confirm";
|
|
5
|
-
}, "key" | keyof import("@atlaskit/button").ButtonProps
|
|
5
|
+
}, "actionSubjectId" | "key" | keyof import("@atlaskit/button").ButtonProps> & React.RefAttributes<HTMLElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ModalDialog from '@atlaskit/modal-dialog';
|
|
3
|
-
import { AnalyticsEventAttributes } from '../../utils/analytics/analytics.codegen';
|
|
3
|
+
import { type AnalyticsEventAttributes } from '../../utils/analytics/analytics.codegen';
|
|
4
4
|
type ModalProps = React.ComponentProps<typeof ModalDialog> & {
|
|
5
5
|
screen: keyof {
|
|
6
6
|
[Key in keyof AnalyticsEventAttributes as Key extends `screen.${infer ScreenName}.viewed` ? ScreenName : never]: any;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type ConfirmDismissDialogProps = {
|
|
3
|
+
active: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onCancel?: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const ConfirmDismissDialog: ({ active, onClose, onCancel, }: ConfirmDismissDialogProps) => JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type CreatePayload, type LinkCreatePlugin } from '../../types';
|
|
3
|
+
import { Modal } from '../ModalDialog';
|
|
4
|
+
type EditModalProps = {
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onCloseComplete?: React.ComponentProps<typeof Modal>['onCloseComplete'];
|
|
7
|
+
editViewPayload?: CreatePayload;
|
|
8
|
+
activePlugin?: LinkCreatePlugin<string> | null;
|
|
9
|
+
};
|
|
10
|
+
export declare const EditModal: ({ onClose, onCloseComplete, editViewPayload, activePlugin, }: EditModalProps) => JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { LinkCreatePlugin } from '../../types';
|
|
3
|
+
type LinkCreateContentProps = {
|
|
4
|
+
plugins: LinkCreatePlugin[];
|
|
5
|
+
entityKey: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const LinkCreateContent: ({ plugins, entityKey, }: LinkCreateContentProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnalyticsEventAttributes } from './analytics.codegen';
|
|
1
|
+
import { type AnalyticsEventAttributes } from './analytics.codegen';
|
|
2
2
|
export type ScreenViewedEventProps = {
|
|
3
3
|
screen: keyof {
|
|
4
4
|
[Key in keyof AnalyticsEventAttributes as Key extends `screen.${infer ScreenName}.viewed` ? ScreenName : never]: any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { LinkCreateProps } from '../../types';
|
|
3
|
-
import { LinkCreateAnalyticsContextType } from './analytics.codegen';
|
|
2
|
+
import { type LinkCreateProps } from '../../types';
|
|
3
|
+
import { type LinkCreateAnalyticsContextType } from './analytics.codegen';
|
|
4
4
|
export type TrackAttribute = <K extends keyof LinkCreateAnalyticsContextType>(attribute: K, value: LinkCreateAnalyticsContextType[K]) => void;
|
|
5
5
|
interface AnalyticsContextType {
|
|
6
6
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { I18NMessages } from '@atlaskit/intl-messages-provider';
|
|
1
|
+
import { type I18NMessages } from '@atlaskit/intl-messages-provider';
|
|
2
2
|
export declare const fetchMessagesForLocale: (locale: string) => Promise<I18NMessages | undefined>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { CreatePayload } from '../../common/types';
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
import { type CreatePayload } from '../../common/types';
|
|
3
3
|
interface LinkCreateCallbackProviderProps {
|
|
4
4
|
/**
|
|
5
5
|
* This callback for when the resource has been successfully created.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
import { CreateFieldProps } from './types';
|
|
3
|
+
import { type CreateFieldProps } from './types';
|
|
4
4
|
export declare function CreateField({ id, name, label, isRequired, validators, validationHelpText, testId, children, }: CreateFieldProps): jsx.JSX.Element;
|