@atlaskit/link-create 3.1.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/common/constants.js +1 -1
  3. package/dist/cjs/common/ui/error-boundary-modal/index.js +1 -9
  4. package/dist/cjs/common/ui/error-boundary-ui/error-svg/index.js +1 -10
  5. package/dist/cjs/common/ui/icon/index.js +1 -9
  6. package/dist/cjs/common/ui/message/index.js +1 -9
  7. package/dist/cjs/common/ui/modal-hero/index.js +1 -9
  8. package/dist/cjs/controllers/create-field/main.js +1 -9
  9. package/dist/cjs/ui/create-form/async-select/main.js +1 -9
  10. package/dist/cjs/ui/create-form/form-footer/main.js +1 -9
  11. package/dist/cjs/ui/create-form/form-loader/main.js +1 -9
  12. package/dist/cjs/ui/create-form/main.js +1 -9
  13. package/dist/cjs/ui/create-form/select/main.js +7 -33
  14. package/dist/cjs/ui/create-form/textfield/main.js +1 -9
  15. package/dist/cjs/ui/create-form/user-picker/main.js +1 -9
  16. package/dist/cjs/ui/inline-create/index.js +1 -9
  17. package/dist/cjs/ui/inline-create/main.js +1 -9
  18. package/dist/cjs/ui/modal-create/index.js +1 -9
  19. package/dist/cjs/ui/modal-create/main.js +1 -9
  20. package/dist/es2019/common/constants.js +1 -1
  21. package/dist/es2019/common/ui/error-boundary-modal/index.js +1 -9
  22. package/dist/es2019/common/ui/error-boundary-ui/error-svg/index.js +1 -9
  23. package/dist/es2019/common/ui/icon/index.js +1 -9
  24. package/dist/es2019/common/ui/message/index.js +1 -9
  25. package/dist/es2019/common/ui/modal-hero/index.js +1 -9
  26. package/dist/es2019/controllers/create-field/main.js +1 -9
  27. package/dist/es2019/ui/create-form/async-select/main.js +1 -9
  28. package/dist/es2019/ui/create-form/form-footer/main.js +1 -9
  29. package/dist/es2019/ui/create-form/form-loader/main.js +1 -9
  30. package/dist/es2019/ui/create-form/main.js +1 -9
  31. package/dist/es2019/ui/create-form/select/main.js +8 -34
  32. package/dist/es2019/ui/create-form/textfield/main.js +1 -9
  33. package/dist/es2019/ui/create-form/user-picker/main.js +1 -9
  34. package/dist/es2019/ui/inline-create/index.js +1 -9
  35. package/dist/es2019/ui/inline-create/main.js +1 -9
  36. package/dist/es2019/ui/modal-create/index.js +1 -9
  37. package/dist/es2019/ui/modal-create/main.js +1 -9
  38. package/dist/esm/common/constants.js +1 -1
  39. package/dist/esm/common/ui/error-boundary-modal/index.js +1 -9
  40. package/dist/esm/common/ui/error-boundary-ui/error-svg/index.js +1 -9
  41. package/dist/esm/common/ui/icon/index.js +1 -9
  42. package/dist/esm/common/ui/message/index.js +1 -9
  43. package/dist/esm/common/ui/modal-hero/index.js +1 -9
  44. package/dist/esm/controllers/create-field/main.js +1 -9
  45. package/dist/esm/ui/create-form/async-select/main.js +1 -9
  46. package/dist/esm/ui/create-form/form-footer/main.js +1 -9
  47. package/dist/esm/ui/create-form/form-loader/main.js +1 -9
  48. package/dist/esm/ui/create-form/main.js +1 -9
  49. package/dist/esm/ui/create-form/select/main.js +7 -33
  50. package/dist/esm/ui/create-form/textfield/main.js +1 -9
  51. package/dist/esm/ui/create-form/user-picker/main.js +1 -9
  52. package/dist/esm/ui/inline-create/index.js +1 -9
  53. package/dist/esm/ui/inline-create/main.js +1 -9
  54. package/dist/esm/ui/modal-create/index.js +1 -9
  55. package/dist/esm/ui/modal-create/main.js +1 -9
  56. package/dist/types/common/ui/error-boundary-modal/index.d.ts +2 -2
  57. package/dist/types/common/ui/icon/index.d.ts +1 -1
  58. package/dist/types/common/ui/message/index.d.ts +1 -1
  59. package/dist/types/common/ui/modal-hero/index.d.ts +1 -1
  60. package/dist/types/controllers/create-field/main.d.ts +1 -1
  61. package/dist/types/ui/create-form/async-select/main.d.ts +8 -2
  62. package/dist/types/ui/create-form/form-footer/main.d.ts +6 -1
  63. package/dist/types/ui/create-form/form-loader/main.d.ts +5 -1
  64. package/dist/types/ui/create-form/main.d.ts +1 -1
  65. package/dist/types/ui/create-form/select/main.d.ts +11 -5
  66. package/dist/types/ui/create-form/textfield/main.d.ts +8 -2
  67. package/dist/types/ui/create-form/user-picker/main.d.ts +5 -2
  68. package/dist/types-ts4.5/common/ui/error-boundary-modal/index.d.ts +2 -2
  69. package/dist/types-ts4.5/common/ui/icon/index.d.ts +1 -1
  70. package/dist/types-ts4.5/common/ui/message/index.d.ts +1 -1
  71. package/dist/types-ts4.5/common/ui/modal-hero/index.d.ts +1 -1
  72. package/dist/types-ts4.5/controllers/create-field/main.d.ts +1 -1
  73. package/dist/types-ts4.5/ui/create-form/async-select/main.d.ts +8 -2
  74. package/dist/types-ts4.5/ui/create-form/form-footer/main.d.ts +6 -1
  75. package/dist/types-ts4.5/ui/create-form/form-loader/main.d.ts +5 -1
  76. package/dist/types-ts4.5/ui/create-form/main.d.ts +1 -1
  77. package/dist/types-ts4.5/ui/create-form/select/main.d.ts +11 -5
  78. package/dist/types-ts4.5/ui/create-form/textfield/main.d.ts +8 -2
  79. package/dist/types-ts4.5/ui/create-form/user-picker/main.d.ts +5 -2
  80. package/package.json +2 -10
  81. package/report.api.md +1 -1
  82. package/dist/cjs/common/ui/error-boundary-modal/old/index.js +0 -34
  83. package/dist/cjs/common/ui/error-boundary-ui/error-svg/old/index.js +0 -67
  84. package/dist/cjs/common/ui/icon/old/index.js +0 -26
  85. package/dist/cjs/common/ui/message/old/index.js +0 -81
  86. package/dist/cjs/common/ui/modal-hero/old/index.js +0 -27
  87. package/dist/cjs/controllers/create-field/old/main.js +0 -76
  88. package/dist/cjs/ui/create-form/async-select/old/main.js +0 -195
  89. package/dist/cjs/ui/create-form/form-footer/old/main.js +0 -64
  90. package/dist/cjs/ui/create-form/form-loader/old/main.js +0 -39
  91. package/dist/cjs/ui/create-form/old/main.js +0 -177
  92. package/dist/cjs/ui/create-form/select/old/main.js +0 -127
  93. package/dist/cjs/ui/create-form/textfield/old/main.js +0 -55
  94. package/dist/cjs/ui/create-form/user-picker/old/main.js +0 -72
  95. package/dist/cjs/ui/inline-create/old/index.js +0 -38
  96. package/dist/cjs/ui/inline-create/old/main.js +0 -120
  97. package/dist/cjs/ui/modal-create/old/index.js +0 -44
  98. package/dist/cjs/ui/modal-create/old/main.js +0 -164
  99. package/dist/es2019/common/ui/error-boundary-modal/old/index.js +0 -26
  100. package/dist/es2019/common/ui/error-boundary-ui/error-svg/old/index.js +0 -58
  101. package/dist/es2019/common/ui/icon/old/index.js +0 -18
  102. package/dist/es2019/common/ui/message/old/index.js +0 -74
  103. package/dist/es2019/common/ui/modal-hero/old/index.js +0 -19
  104. package/dist/es2019/controllers/create-field/old/main.js +0 -74
  105. package/dist/es2019/ui/create-form/async-select/old/main.js +0 -137
  106. package/dist/es2019/ui/create-form/form-footer/old/main.js +0 -57
  107. package/dist/es2019/ui/create-form/form-loader/old/main.js +0 -31
  108. package/dist/es2019/ui/create-form/old/main.js +0 -145
  109. package/dist/es2019/ui/create-form/select/old/main.js +0 -106
  110. package/dist/es2019/ui/create-form/textfield/old/main.js +0 -45
  111. package/dist/es2019/ui/create-form/user-picker/old/main.js +0 -59
  112. package/dist/es2019/ui/inline-create/old/index.js +0 -30
  113. package/dist/es2019/ui/inline-create/old/main.js +0 -96
  114. package/dist/es2019/ui/modal-create/old/index.js +0 -36
  115. package/dist/es2019/ui/modal-create/old/main.js +0 -137
  116. package/dist/esm/common/ui/error-boundary-modal/old/index.js +0 -25
  117. package/dist/esm/common/ui/error-boundary-ui/error-svg/old/index.js +0 -60
  118. package/dist/esm/common/ui/icon/old/index.js +0 -18
  119. package/dist/esm/common/ui/message/old/index.js +0 -73
  120. package/dist/esm/common/ui/modal-hero/old/index.js +0 -18
  121. package/dist/esm/controllers/create-field/old/main.js +0 -72
  122. package/dist/esm/ui/create-form/async-select/old/main.js +0 -188
  123. package/dist/esm/ui/create-form/form-footer/old/main.js +0 -56
  124. package/dist/esm/ui/create-form/form-loader/old/main.js +0 -31
  125. package/dist/esm/ui/create-form/old/main.js +0 -174
  126. package/dist/esm/ui/create-form/select/old/main.js +0 -117
  127. package/dist/esm/ui/create-form/textfield/old/main.js +0 -47
  128. package/dist/esm/ui/create-form/user-picker/old/main.js +0 -64
  129. package/dist/esm/ui/inline-create/old/index.js +0 -30
  130. package/dist/esm/ui/inline-create/old/main.js +0 -112
  131. package/dist/esm/ui/modal-create/old/index.js +0 -36
  132. package/dist/esm/ui/modal-create/old/main.js +0 -156
  133. package/dist/types/common/ui/error-boundary-modal/old/index.d.ts +0 -11
  134. package/dist/types/common/ui/error-boundary-ui/error-svg/old/index.d.ts +0 -7
  135. package/dist/types/common/ui/icon/old/index.d.ts +0 -7
  136. package/dist/types/common/ui/message/old/index.d.ts +0 -15
  137. package/dist/types/common/ui/modal-hero/old/index.d.ts +0 -4
  138. package/dist/types/controllers/create-field/old/main.d.ts +0 -7
  139. package/dist/types/ui/create-form/async-select/old/main.d.ts +0 -11
  140. package/dist/types/ui/create-form/form-footer/old/main.d.ts +0 -16
  141. package/dist/types/ui/create-form/form-loader/old/main.d.ts +0 -11
  142. package/dist/types/ui/create-form/old/main.d.ts +0 -54
  143. package/dist/types/ui/create-form/select/old/main.d.ts +0 -24
  144. package/dist/types/ui/create-form/textfield/old/main.d.ts +0 -14
  145. package/dist/types/ui/create-form/user-picker/old/main.d.ts +0 -11
  146. package/dist/types/ui/inline-create/old/index.d.ts +0 -5
  147. package/dist/types/ui/inline-create/old/main.d.ts +0 -8
  148. package/dist/types/ui/modal-create/old/index.d.ts +0 -5
  149. package/dist/types/ui/modal-create/old/main.d.ts +0 -4
  150. package/dist/types-ts4.5/common/ui/error-boundary-modal/old/index.d.ts +0 -11
  151. package/dist/types-ts4.5/common/ui/error-boundary-ui/error-svg/old/index.d.ts +0 -7
  152. package/dist/types-ts4.5/common/ui/icon/old/index.d.ts +0 -7
  153. package/dist/types-ts4.5/common/ui/message/old/index.d.ts +0 -15
  154. package/dist/types-ts4.5/common/ui/modal-hero/old/index.d.ts +0 -4
  155. package/dist/types-ts4.5/controllers/create-field/old/main.d.ts +0 -7
  156. package/dist/types-ts4.5/ui/create-form/async-select/old/main.d.ts +0 -11
  157. package/dist/types-ts4.5/ui/create-form/form-footer/old/main.d.ts +0 -16
  158. package/dist/types-ts4.5/ui/create-form/form-loader/old/main.d.ts +0 -11
  159. package/dist/types-ts4.5/ui/create-form/old/main.d.ts +0 -56
  160. package/dist/types-ts4.5/ui/create-form/select/old/main.d.ts +0 -24
  161. package/dist/types-ts4.5/ui/create-form/textfield/old/main.d.ts +0 -14
  162. package/dist/types-ts4.5/ui/create-form/user-picker/old/main.d.ts +0 -11
  163. package/dist/types-ts4.5/ui/inline-create/old/index.d.ts +0 -5
  164. package/dist/types-ts4.5/ui/inline-create/old/main.d.ts +0 -8
  165. package/dist/types-ts4.5/ui/modal-create/old/index.d.ts +0 -5
  166. package/dist/types-ts4.5/ui/modal-create/old/main.d.ts +0 -4
@@ -1,30 +0,0 @@
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
- var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(function (props) {
20
- return jsx(Experience, null, jsx(ErrorBoundary, null, jsx(InlineCreate, props)));
21
- }));
22
- var ComposedLinkCreateOld = /*#__PURE__*/memo(function (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;
@@ -1,112 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- /* eslint-disable @atlassian/tangerine/import/no-parent-imports */
5
- /**
6
- * @jsxRuntime classic
7
- * @jsx jsx
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 { Box } from '@atlaskit/primitives';
12
- import { DEFAULT_TEST_ID, SCREEN_ID } from '../../../common/constants';
13
- import { ConfirmDismissDialog } from '../../../common/ui/confirm-dismiss-dialog';
14
- import { EditModal } from '../../../common/ui/edit-modal';
15
- import { ErrorBoundary } from '../../../common/ui/error-boundary';
16
- import { LinkCreateContent } from '../../../common/ui/link-create-content';
17
- import { LinkCreateCallbackProvider } from '../../../controllers/callback-context';
18
- import { EditPostCreateModalProvider, useEditPostCreateModal } from '../../../controllers/edit-post-create-context';
19
- import { useExitWarningModal } from '../../../controllers/exit-warning-modal-context';
20
- import { FormContextProvider } from '../../../controllers/form-context';
21
- import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../../controllers/plugin-context';
22
- import { InlineAnalytics } from '../inline-analytics';
23
- var InlineCreateContent = function InlineCreateContent(_ref) {
24
- var onCreate = _ref.onCreate,
25
- onFailure = _ref.onFailure,
26
- onCancel = _ref.onCancel,
27
- onComplete = _ref.onComplete,
28
- plugins = _ref.plugins,
29
- entityKey = _ref.entityKey,
30
- _ref$testId = _ref.testId,
31
- testId = _ref$testId === void 0 ? DEFAULT_TEST_ID : _ref$testId;
32
- var _useExitWarningModal = useExitWarningModal(),
33
- withExitWarning = _useExitWarningModal.withExitWarning,
34
- showExitWarning = _useExitWarningModal.showExitWarning,
35
- setShowExitWarning = _useExitWarningModal.setShowExitWarning;
36
- var _useEditPostCreateMod = useEditPostCreateModal(),
37
- editViewPayload = _useEditPostCreateMod.editViewPayload;
38
- var _useLinkCreatePlugins = useLinkCreatePlugins(),
39
- activePlugin = _useLinkCreatePlugins.activePlugin;
40
- var handleCloseExitWarning = function handleCloseExitWarning() {
41
- return setShowExitWarning(false);
42
- };
43
- return jsx(LinkCreateCallbackProvider, {
44
- onCreate: onCreate,
45
- onFailure: onFailure,
46
- onCancel: withExitWarning(onCancel)
47
- }, jsx(ErrorBoundary, null, jsx(InlineAnalytics, {
48
- screen: SCREEN_ID
49
- }, jsx(Box, {
50
- testId: testId
51
- }, jsx(LinkCreateContent, {
52
- plugins: plugins,
53
- entityKey: entityKey
54
- })))), onComplete && jsx(EditModal, {
55
- onClose: onComplete,
56
- editViewPayload: editViewPayload,
57
- activePlugin: activePlugin
58
- }), jsx(ConfirmDismissDialog, {
59
- active: showExitWarning,
60
- onClose: handleCloseExitWarning,
61
- onCancel: onCancel
62
- }));
63
- };
64
- var InlineCreateOld = function InlineCreateOld(props) {
65
- return jsx(LinkCreatePluginsProvider, {
66
- plugins: props.plugins,
67
- entityKey: props.entityKey
68
- }, function (pluginsProvider) {
69
- return jsx(EditPostCreateModalProvider, {
70
- active: true
71
- }, function (_ref2) {
72
- var _pluginsProvider$acti;
73
- var setEditViewPayload = _ref2.setEditViewPayload,
74
- shouldActivateEditView = _ref2.shouldActivateEditView,
75
- enableEditView = _ref2.enableEditView;
76
- return jsx(FormContextProvider, {
77
- 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
78
- }, jsx(InlineCreateContent, _extends({}, props, {
79
- onCreate: ( /*#__PURE__*/function () {
80
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(payload) {
81
- var _props$onCreate;
82
- return _regeneratorRuntime.wrap(function _callee$(_context) {
83
- while (1) switch (_context.prev = _context.next) {
84
- case 0:
85
- _context.next = 2;
86
- return (_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload);
87
- case 2:
88
- // if onComplete exists then there is an edit flow
89
- if (props.onComplete) {
90
- if (shouldActivateEditView()) {
91
- //edit button is pressed
92
- setEditViewPayload(payload);
93
- } else {
94
- //create button is pressed
95
- props.onComplete();
96
- }
97
- }
98
- case 3:
99
- case "end":
100
- return _context.stop();
101
- }
102
- }, _callee);
103
- }));
104
- return function (_x) {
105
- return _ref3.apply(this, arguments);
106
- };
107
- }())
108
- })));
109
- });
110
- });
111
- };
112
- export default InlineCreateOld;
@@ -1,36 +0,0 @@
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
- var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(function (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
- var ComposedLinkCreateOld = /*#__PURE__*/memo(function (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;
@@ -1,156 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- /* eslint-disable @atlassian/tangerine/import/no-parent-imports */
5
- /**
6
- * @jsxRuntime classic
7
- * @jsx jsx
8
- */
9
- import { useLayoutEffect, useRef } from 'react';
10
-
11
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
12
- import { jsx } from '@emotion/react';
13
- import { useIntl } from 'react-intl-next';
14
- import { Layering } from '@atlaskit/layering';
15
- import { ModalBody, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
16
- import { Box } from '@atlaskit/primitives';
17
- import { CREATE_FORM_MAX_WIDTH_IN_PX, DEFAULT_TEST_ID, SCREEN_ID } from '../../../common/constants';
18
- import { ConfirmDismissDialog } from '../../../common/ui/confirm-dismiss-dialog';
19
- import { EditModal } from '../../../common/ui/edit-modal';
20
- import { ErrorBoundary } from '../../../common/ui/error-boundary';
21
- import { LinkCreateContent } from '../../../common/ui/link-create-content';
22
- import { ModalHero } from '../../../common/ui/modal-hero';
23
- import { Modal } from '../../../common/ui/ModalDialog';
24
- import { LinkCreateCallbackProvider } from '../../../controllers/callback-context';
25
- import { EditPostCreateModalProvider, useEditPostCreateModal } from '../../../controllers/edit-post-create-context';
26
- import { ExitWarningModalProvider, useExitWarningModal } from '../../../controllers/exit-warning-modal-context';
27
- import { FormContextProvider } from '../../../controllers/form-context';
28
- import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../../controllers/plugin-context';
29
- import { messages } from '../messages';
30
- var LinkCreateWithModal = function LinkCreateWithModal(_ref) {
31
- var active = _ref.active,
32
- modalTitle = _ref.modalTitle,
33
- onCreate = _ref.onCreate,
34
- onFailure = _ref.onFailure,
35
- onCancel = _ref.onCancel,
36
- onComplete = _ref.onComplete,
37
- onOpenComplete = _ref.onOpenComplete,
38
- onCloseComplete = _ref.onCloseComplete,
39
- _ref$testId = _ref.testId,
40
- testId = _ref$testId === void 0 ? DEFAULT_TEST_ID : _ref$testId,
41
- plugins = _ref.plugins,
42
- entityKey = _ref.entityKey,
43
- modalHero = _ref.modalHero;
44
- var intl = useIntl();
45
- var _useExitWarningModal = useExitWarningModal(),
46
- withExitWarning = _useExitWarningModal.withExitWarning,
47
- showExitWarning = _useExitWarningModal.showExitWarning,
48
- setShowExitWarning = _useExitWarningModal.setShowExitWarning;
49
- var _useEditPostCreateMod = useEditPostCreateModal(),
50
- editViewPayload = _useEditPostCreateMod.editViewPayload;
51
- var _useLinkCreatePlugins = useLinkCreatePlugins(),
52
- activePlugin = _useLinkCreatePlugins.activePlugin;
53
- var handleCloseExitWarning = function handleCloseExitWarning() {
54
- return setShowExitWarning(false);
55
- };
56
- return jsx(LinkCreateCallbackProvider, {
57
- onCreate: onCreate,
58
- onFailure: onFailure,
59
- onCancel: withExitWarning(onCancel)
60
- }, jsx(ModalTransition, null, active && jsx(Modal, {
61
- testId: "link-create-modal",
62
- screen: SCREEN_ID,
63
- onClose: withExitWarning(onCancel),
64
- shouldScrollInViewport: true,
65
- onOpenComplete: onOpenComplete,
66
- onCloseComplete: onCloseComplete,
67
- width: "".concat(CREATE_FORM_MAX_WIDTH_IN_PX, "px")
68
- }, jsx(ModalHero, {
69
- hero: modalHero
70
- }), jsx(ModalHeader, null, jsx(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), jsx(ModalBody, null, jsx(Box, {
71
- testId: testId
72
- }, jsx(ErrorBoundary, null, jsx(LinkCreateContent, {
73
- plugins: plugins,
74
- entityKey: entityKey
75
- })))))), onComplete && jsx(EditModal, {
76
- onCloseComplete: onCloseComplete,
77
- onClose: onComplete,
78
- editViewPayload: editViewPayload,
79
- activePlugin: activePlugin
80
- }), jsx(Layering, {
81
- isDisabled: false
82
- }, jsx(ConfirmDismissDialog, {
83
- active: showExitWarning,
84
- onClose: handleCloseExitWarning,
85
- onCancel: onCancel
86
- })));
87
- };
88
- var LinkCreateModalOld = function LinkCreateModalOld(props) {
89
- var shouldCallCloseComplete = useRef(!props.active);
90
-
91
- // modal calls onCloseComplete in a useEffect(), so we can track whether
92
- // or not we should execute it based on the active prop in a
93
- // useLayoutEffect() which will be run before child useEffect()s
94
- useLayoutEffect(function () {
95
- // onCloseComplete should only be called when it is not active
96
- shouldCallCloseComplete.current = !props.active;
97
- }, [props.active]);
98
- return jsx(LinkCreatePluginsProvider, {
99
- plugins: props.plugins,
100
- entityKey: props.entityKey
101
- }, function (pluginsProvider) {
102
- return jsx(EditPostCreateModalProvider, {
103
- active: !!props.active
104
- }, function (_ref2) {
105
- var _pluginsProvider$acti;
106
- var setEditViewPayload = _ref2.setEditViewPayload,
107
- editViewPayload = _ref2.editViewPayload,
108
- shouldActivateEditView = _ref2.shouldActivateEditView,
109
- enableEditView = _ref2.enableEditView;
110
- return jsx(FormContextProvider, {
111
- 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
112
- }, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
113
- active: props.active && !editViewPayload,
114
- onCreate: ( /*#__PURE__*/function () {
115
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(payload) {
116
- var _props$onCreate;
117
- return _regeneratorRuntime.wrap(function _callee$(_context) {
118
- while (1) switch (_context.prev = _context.next) {
119
- case 0:
120
- _context.next = 2;
121
- return (_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload);
122
- case 2:
123
- // if onComplete exists then there is an edit flow
124
- if (props.onComplete) {
125
- if (shouldActivateEditView()) {
126
- //edit button is pressed
127
- setEditViewPayload(payload);
128
- } else {
129
- //create button is pressed
130
- props.onComplete();
131
- }
132
- }
133
- case 3:
134
- case "end":
135
- return _context.stop();
136
- }
137
- }, _callee);
138
- }));
139
- return function (_x) {
140
- return _ref3.apply(this, arguments);
141
- };
142
- }()),
143
- onCloseComplete: function onCloseComplete() {
144
- if (shouldCallCloseComplete.current) {
145
- var _props$onCloseComplet;
146
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
147
- args[_key] = arguments[_key];
148
- }
149
- (_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 || _props$onCloseComplet.call.apply(_props$onCloseComplet, [props].concat(args));
150
- }
151
- }
152
- }))));
153
- });
154
- });
155
- };
156
- export default LinkCreateModalOld;
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- * ErrorBoundaryModal props are the same as those passed to LinkCreate, which
4
- * are used to control its active state
5
- */
6
- type ErrorBoundaryModalProps = {
7
- active?: boolean;
8
- onClose?: () => void;
9
- };
10
- export declare const ErrorBoundaryModalOld: ({ active, onClose, }: ErrorBoundaryModalProps) => JSX.Element;
11
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { jsx } from '@emotion/react';
6
- declare const ErrorSVGOld: () => jsx.JSX.Element;
7
- export default ErrorSVGOld;
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const UrlIconOld: import("@emotion/styled").StyledComponent<{
3
- theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
- } & {
6
- url?: string | undefined;
7
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,15 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { type ReactNode } from 'react';
6
- import { jsx } from '@emotion/react';
7
- type MessageAppearance = 'default' | 'error' | 'valid';
8
- type MessageProps = {
9
- id?: string;
10
- appearance?: MessageAppearance;
11
- testId?: string;
12
- children: ReactNode;
13
- };
14
- export declare const MessageOld: ({ children, appearance, id, testId }: MessageProps) => jsx.JSX.Element;
15
- export {};
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export declare const ModalHeroOld: ({ hero }: {
3
- hero?: React.ReactNode;
4
- }) => React.JSX.Element | null;
@@ -1,7 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { jsx } from '@emotion/react';
6
- import { type CreateFieldProps } from '../types';
7
- export declare function CreateFieldOld({ id, name, label, isRequired, validators, validationHelpText, testId, children, }: CreateFieldProps): jsx.JSX.Element;
@@ -1,11 +0,0 @@
1
- import { jsx } from '@emotion/react';
2
- import { type OptionType } from '@atlaskit/select';
3
- import { type AsyncSelectProps } from '../types';
4
- export declare const TEST_ID = "link-create-async-select";
5
- /**
6
- * An async select utilising the Atlaskit AsyncSelect and CreateField.
7
- * Validation is handled by the form on form submission. Any
8
- * errors returned by the handleSubmit function passed to the form <Form> that
9
- * have a key matching the `name` of this field are shown below the field.
10
- */
11
- export declare function AsyncSelectOld<T = OptionType>({ id, name, label, isRequired, validators, validationHelpText, testId, defaultOption: propsDefaultValue, loadOptions: loadOptionsFn, ...restProps }: AsyncSelectProps<T>): jsx.JSX.Element;
@@ -1,16 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { jsx } from '@emotion/react';
6
- export interface CreateFormFooterProps {
7
- formErrorMessage: string | undefined;
8
- handleCancel: () => void;
9
- testId?: string;
10
- }
11
- /**
12
- * Footer for the Create Form, used as a wrapper for action buttons
13
- * and form error messages. This component is unmounted if
14
- * hideFooter is true in the Create Form.
15
- */
16
- export declare function CreateFormFooterOld({ formErrorMessage, handleCancel, testId, }: CreateFormFooterProps): jsx.JSX.Element;
@@ -1,11 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { jsx } from '@emotion/react';
6
- import { type SpinnerProps } from '@atlaskit/spinner';
7
- /**
8
- * Wrapper component for the Spinner, shows while the form
9
- * performs async functions on load.
10
- */
11
- export declare function CreateFormLoaderOld({ size }: Partial<SpinnerProps>): jsx.JSX.Element;
@@ -1,54 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { type ReactNode } from 'react';
6
- import { jsx } from '@emotion/react';
7
- type ReservedFields = {
8
- [Field in (typeof RESERVED_FIELDS)[number]]?: unknown;
9
- };
10
- declare const RESERVED_FIELDS: readonly ["__post_create__"];
11
- type DisallowReservedFields<T> = T & {
12
- [Field in (typeof RESERVED_FIELDS)[number]]?: never;
13
- };
14
- type OmitReservedFields<T> = Omit<T, keyof ReservedFields>;
15
- type Errors = Record<string, string>;
16
- export interface CreateFormProps<FormData> {
17
- /**
18
- * Should resolve to void, or resolve to an object of
19
- * keys (field names) with error messages (key values)
20
- */
21
- onSubmit: (data: OmitReservedFields<FormData>) => void | Errors | Promise<void | Errors>;
22
- /**
23
- * Children to render in the form (form fields)
24
- */
25
- children: ReactNode;
26
- /**
27
- * Test id to render on the form element
28
- */
29
- testId?: string;
30
- /**
31
- * Callback when the cancel button is fired
32
- */
33
- onCancel?: () => void;
34
- /**
35
- * Renders a spinner when true
36
- */
37
- isLoading?: boolean;
38
- /**
39
- * Hides the rendering of the footer buttons
40
- */
41
- hideFooter?: boolean;
42
- /**
43
- * Hides the "Required fields are marked with an asterisk" message
44
- */
45
- hideRequiredFieldMessage?: boolean;
46
- /**
47
- * Values to initialise the forms initial state with
48
- * Should not include values for reserved fields
49
- */
50
- initialValues?: DisallowReservedFields<FormData>;
51
- }
52
- export declare const TEST_ID = "link-create-form";
53
- export declare const CreateFormOld: <FormData extends Record<string, any> = {}>({ children, testId, onSubmit, onCancel, isLoading, hideFooter, hideRequiredFieldMessage, initialValues, }: CreateFormProps<FormData>) => jsx.JSX.Element;
54
- export {};
@@ -1,24 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { type PropsWithChildren } from 'react';
6
- import { jsx } from '@emotion/react';
7
- import { type OptionProps, type OptionType, type SingleValueProps } from '@atlaskit/select';
8
- import { type SelectProps, type SitePickerOptionType } from '../types';
9
- export declare const TEST_ID = "link-create-select";
10
- /**
11
- * A select component utilising the Atlaskit Select and CreateField.
12
- * Validation is handled by the form on form submission. Any
13
- * errors returned by the handleSubmit function passed to the form <Form> that
14
- * have a key matching the `name` of this field are shown below the field.
15
- */
16
- export declare function SelectOld<T = OptionType>({ id, name, label, isRequired, validators, validationHelpText, testId, ...restProps }: SelectProps<T>): jsx.JSX.Element;
17
- export type SiteSelectProps = {
18
- testId?: string;
19
- options?: SitePickerOptionType[];
20
- name?: string;
21
- };
22
- export declare const SiteSelectOld: ({ options, name, testId }: SiteSelectProps) => jsx.JSX.Element;
23
- export declare const SitePickerOptionOld: ({ children, ...props }: PropsWithChildren<OptionProps<SitePickerOptionType, false>>) => JSX.Element;
24
- export declare const SitePickerSingleValueOld: ({ children, ...props }: PropsWithChildren<SingleValueProps<SitePickerOptionType, false>>) => JSX.Element;
@@ -1,14 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { jsx } from '@emotion/react';
6
- import { type TextFieldProps } from '../types';
7
- export declare const TEST_ID = "link-create-text-field";
8
- /**
9
- * A text field utilising the Atlaskit Textfield and CreateField.
10
- * Validation is handled by the form as it is on form submission. Any errors returned by
11
- * the handleSubmit function passed to the form <Form> that have a key matching the `name`
12
- * of this text field are shown above the field.
13
- */
14
- export declare function TextFieldOld({ id, name, label, isRequired, validators, validationHelpText, testId, ...restProps }: TextFieldProps): jsx.JSX.Element;
@@ -1,11 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { jsx } from '@emotion/react';
6
- import { type UserPickerProps } from '../types';
7
- export declare const TEST_ID = "link-create-user-picker";
8
- /**
9
- * A user picker utilising the SmartUserPicker.
10
- */
11
- export declare function UserPickerOld({ productKey, siteId, name, label, placeholder, validators, testId, defaultValue, }: UserPickerProps): jsx.JSX.Element;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { jsx } from '@emotion/react';
3
- import type { LinkCreateProps } from '../../../common/types';
4
- declare const ComposedLinkCreateOld: import("react").MemoExoticComponent<(props: LinkCreateProps) => jsx.JSX.Element>;
5
- export default ComposedLinkCreateOld;
@@ -1,8 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { jsx } from '@emotion/react';
6
- import type { LinkCreateProps } from '../../../common/types';
7
- declare const InlineCreateOld: (props: LinkCreateProps) => jsx.JSX.Element;
8
- export default InlineCreateOld;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { jsx } from '@emotion/react';
3
- import { type LinkCreateWithModalProps } from '../../../common/types';
4
- declare const ComposedLinkCreateOld: import("react").MemoExoticComponent<(props: LinkCreateWithModalProps) => jsx.JSX.Element>;
5
- export default ComposedLinkCreateOld;
@@ -1,4 +0,0 @@
1
- import { jsx } from '@emotion/react';
2
- import type { LinkCreateWithModalProps } from '../../../common/types';
3
- declare const LinkCreateModalOld: (props: LinkCreateWithModalProps) => jsx.JSX.Element;
4
- export default LinkCreateModalOld;
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- * ErrorBoundaryModal props are the same as those passed to LinkCreate, which
4
- * are used to control its active state
5
- */
6
- type ErrorBoundaryModalProps = {
7
- active?: boolean;
8
- onClose?: () => void;
9
- };
10
- export declare const ErrorBoundaryModalOld: ({ active, onClose, }: ErrorBoundaryModalProps) => JSX.Element;
11
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { jsx } from '@emotion/react';
6
- declare const ErrorSVGOld: () => jsx.JSX.Element;
7
- export default ErrorSVGOld;
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const UrlIconOld: import("@emotion/styled").StyledComponent<{
3
- theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
- } & {
6
- url?: string | undefined;
7
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,15 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { type ReactNode } from 'react';
6
- import { jsx } from '@emotion/react';
7
- type MessageAppearance = 'default' | 'error' | 'valid';
8
- type MessageProps = {
9
- id?: string;
10
- appearance?: MessageAppearance;
11
- testId?: string;
12
- children: ReactNode;
13
- };
14
- export declare const MessageOld: ({ children, appearance, id, testId }: MessageProps) => jsx.JSX.Element;
15
- export {};
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export declare const ModalHeroOld: ({ hero }: {
3
- hero?: React.ReactNode;
4
- }) => React.JSX.Element | null;
@@ -1,7 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { jsx } from '@emotion/react';
6
- import { type CreateFieldProps } from '../types';
7
- export declare function CreateFieldOld({ id, name, label, isRequired, validators, validationHelpText, testId, children, }: CreateFieldProps): jsx.JSX.Element;
@@ -1,11 +0,0 @@
1
- import { jsx } from '@emotion/react';
2
- import { type OptionType } from '@atlaskit/select';
3
- import { type AsyncSelectProps } from '../types';
4
- export declare const TEST_ID = "link-create-async-select";
5
- /**
6
- * An async select utilising the Atlaskit AsyncSelect and CreateField.
7
- * Validation is handled by the form on form submission. Any
8
- * errors returned by the handleSubmit function passed to the form <Form> that
9
- * have a key matching the `name` of this field are shown below the field.
10
- */
11
- export declare function AsyncSelectOld<T = OptionType>({ id, name, label, isRequired, validators, validationHelpText, testId, defaultOption: propsDefaultValue, loadOptions: loadOptionsFn, ...restProps }: AsyncSelectProps<T>): jsx.JSX.Element;