@atlaskit/link-create 3.1.1 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/CHANGELOG.md +18 -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.compiled.css +1 -1
  7. package/dist/cjs/common/ui/message/index.js +2 -10
  8. package/dist/cjs/common/ui/modal-hero/index.js +1 -9
  9. package/dist/cjs/controllers/create-field/main.js +1 -9
  10. package/dist/cjs/i18n/en.js +2 -0
  11. package/dist/cjs/i18n/en_GB.js +2 -0
  12. package/dist/cjs/i18n/en_ZZ.js +2 -0
  13. package/dist/cjs/ui/create-form/async-select/main.js +1 -9
  14. package/dist/cjs/ui/create-form/form-footer/main.js +1 -9
  15. package/dist/cjs/ui/create-form/form-loader/main.js +1 -9
  16. package/dist/cjs/ui/create-form/main.js +1 -9
  17. package/dist/cjs/ui/create-form/select/main.js +7 -33
  18. package/dist/cjs/ui/create-form/textfield/main.js +3 -10
  19. package/dist/cjs/ui/create-form/user-picker/main.js +1 -9
  20. package/dist/cjs/ui/inline-create/index.js +1 -9
  21. package/dist/cjs/ui/inline-create/main.js +1 -9
  22. package/dist/cjs/ui/modal-create/index.js +1 -9
  23. package/dist/cjs/ui/modal-create/main.js +1 -9
  24. package/dist/es2019/common/constants.js +1 -1
  25. package/dist/es2019/common/ui/error-boundary-modal/index.js +1 -9
  26. package/dist/es2019/common/ui/error-boundary-ui/error-svg/index.js +1 -9
  27. package/dist/es2019/common/ui/icon/index.js +1 -9
  28. package/dist/es2019/common/ui/message/index.compiled.css +1 -1
  29. package/dist/es2019/common/ui/message/index.js +2 -10
  30. package/dist/es2019/common/ui/modal-hero/index.js +1 -9
  31. package/dist/es2019/controllers/create-field/main.js +1 -9
  32. package/dist/es2019/i18n/en.js +2 -0
  33. package/dist/es2019/i18n/en_GB.js +2 -0
  34. package/dist/es2019/i18n/en_ZZ.js +2 -0
  35. package/dist/es2019/ui/create-form/async-select/main.js +1 -9
  36. package/dist/es2019/ui/create-form/form-footer/main.js +1 -9
  37. package/dist/es2019/ui/create-form/form-loader/main.js +1 -9
  38. package/dist/es2019/ui/create-form/main.js +1 -9
  39. package/dist/es2019/ui/create-form/select/main.js +8 -34
  40. package/dist/es2019/ui/create-form/textfield/main.js +3 -10
  41. package/dist/es2019/ui/create-form/user-picker/main.js +1 -9
  42. package/dist/es2019/ui/inline-create/index.js +1 -9
  43. package/dist/es2019/ui/inline-create/main.js +1 -9
  44. package/dist/es2019/ui/modal-create/index.js +1 -9
  45. package/dist/es2019/ui/modal-create/main.js +1 -9
  46. package/dist/esm/common/constants.js +1 -1
  47. package/dist/esm/common/ui/error-boundary-modal/index.js +1 -9
  48. package/dist/esm/common/ui/error-boundary-ui/error-svg/index.js +1 -9
  49. package/dist/esm/common/ui/icon/index.js +1 -9
  50. package/dist/esm/common/ui/message/index.compiled.css +1 -1
  51. package/dist/esm/common/ui/message/index.js +2 -10
  52. package/dist/esm/common/ui/modal-hero/index.js +1 -9
  53. package/dist/esm/controllers/create-field/main.js +1 -9
  54. package/dist/esm/i18n/en.js +2 -0
  55. package/dist/esm/i18n/en_GB.js +2 -0
  56. package/dist/esm/i18n/en_ZZ.js +2 -0
  57. package/dist/esm/ui/create-form/async-select/main.js +1 -9
  58. package/dist/esm/ui/create-form/form-footer/main.js +1 -9
  59. package/dist/esm/ui/create-form/form-loader/main.js +1 -9
  60. package/dist/esm/ui/create-form/main.js +1 -9
  61. package/dist/esm/ui/create-form/select/main.js +7 -33
  62. package/dist/esm/ui/create-form/textfield/main.js +3 -10
  63. package/dist/esm/ui/create-form/user-picker/main.js +1 -9
  64. package/dist/esm/ui/inline-create/index.js +1 -9
  65. package/dist/esm/ui/inline-create/main.js +1 -9
  66. package/dist/esm/ui/modal-create/index.js +1 -9
  67. package/dist/esm/ui/modal-create/main.js +1 -9
  68. package/dist/types/common/ui/error-boundary-modal/index.d.ts +2 -2
  69. package/dist/types/common/ui/icon/index.d.ts +1 -1
  70. package/dist/types/common/ui/message/index.d.ts +1 -1
  71. package/dist/types/common/ui/modal-hero/index.d.ts +1 -1
  72. package/dist/types/controllers/create-field/main.d.ts +1 -1
  73. package/dist/types/i18n/en.d.ts +2 -0
  74. package/dist/types/i18n/en_GB.d.ts +2 -0
  75. package/dist/types/i18n/en_ZZ.d.ts +2 -0
  76. package/dist/types/ui/create-form/async-select/main.d.ts +8 -2
  77. package/dist/types/ui/create-form/form-footer/main.d.ts +6 -1
  78. package/dist/types/ui/create-form/form-loader/main.d.ts +5 -1
  79. package/dist/types/ui/create-form/main.d.ts +1 -1
  80. package/dist/types/ui/create-form/select/main.d.ts +11 -5
  81. package/dist/types/ui/create-form/textfield/main.d.ts +8 -2
  82. package/dist/types/ui/create-form/user-picker/main.d.ts +5 -2
  83. package/dist/types-ts4.5/common/ui/error-boundary-modal/index.d.ts +2 -2
  84. package/dist/types-ts4.5/common/ui/icon/index.d.ts +1 -1
  85. package/dist/types-ts4.5/common/ui/message/index.d.ts +1 -1
  86. package/dist/types-ts4.5/common/ui/modal-hero/index.d.ts +1 -1
  87. package/dist/types-ts4.5/controllers/create-field/main.d.ts +1 -1
  88. package/dist/types-ts4.5/i18n/en.d.ts +2 -0
  89. package/dist/types-ts4.5/i18n/en_GB.d.ts +2 -0
  90. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +2 -0
  91. package/dist/types-ts4.5/ui/create-form/async-select/main.d.ts +8 -2
  92. package/dist/types-ts4.5/ui/create-form/form-footer/main.d.ts +6 -1
  93. package/dist/types-ts4.5/ui/create-form/form-loader/main.d.ts +5 -1
  94. package/dist/types-ts4.5/ui/create-form/main.d.ts +1 -1
  95. package/dist/types-ts4.5/ui/create-form/select/main.d.ts +11 -5
  96. package/dist/types-ts4.5/ui/create-form/textfield/main.d.ts +8 -2
  97. package/dist/types-ts4.5/ui/create-form/user-picker/main.d.ts +5 -2
  98. package/package.json +3 -11
  99. package/report.api.md +1 -1
  100. package/dist/cjs/common/ui/error-boundary-modal/old/index.js +0 -34
  101. package/dist/cjs/common/ui/error-boundary-ui/error-svg/old/index.js +0 -67
  102. package/dist/cjs/common/ui/icon/old/index.js +0 -26
  103. package/dist/cjs/common/ui/message/old/index.js +0 -81
  104. package/dist/cjs/common/ui/modal-hero/old/index.js +0 -27
  105. package/dist/cjs/controllers/create-field/old/main.js +0 -76
  106. package/dist/cjs/ui/create-form/async-select/old/main.js +0 -195
  107. package/dist/cjs/ui/create-form/form-footer/old/main.js +0 -64
  108. package/dist/cjs/ui/create-form/form-loader/old/main.js +0 -39
  109. package/dist/cjs/ui/create-form/old/main.js +0 -177
  110. package/dist/cjs/ui/create-form/select/old/main.js +0 -127
  111. package/dist/cjs/ui/create-form/textfield/old/main.js +0 -55
  112. package/dist/cjs/ui/create-form/user-picker/old/main.js +0 -72
  113. package/dist/cjs/ui/inline-create/old/index.js +0 -38
  114. package/dist/cjs/ui/inline-create/old/main.js +0 -120
  115. package/dist/cjs/ui/modal-create/old/index.js +0 -44
  116. package/dist/cjs/ui/modal-create/old/main.js +0 -164
  117. package/dist/es2019/common/ui/error-boundary-modal/old/index.js +0 -26
  118. package/dist/es2019/common/ui/error-boundary-ui/error-svg/old/index.js +0 -58
  119. package/dist/es2019/common/ui/icon/old/index.js +0 -18
  120. package/dist/es2019/common/ui/message/old/index.js +0 -74
  121. package/dist/es2019/common/ui/modal-hero/old/index.js +0 -19
  122. package/dist/es2019/controllers/create-field/old/main.js +0 -74
  123. package/dist/es2019/ui/create-form/async-select/old/main.js +0 -137
  124. package/dist/es2019/ui/create-form/form-footer/old/main.js +0 -57
  125. package/dist/es2019/ui/create-form/form-loader/old/main.js +0 -31
  126. package/dist/es2019/ui/create-form/old/main.js +0 -145
  127. package/dist/es2019/ui/create-form/select/old/main.js +0 -106
  128. package/dist/es2019/ui/create-form/textfield/old/main.js +0 -45
  129. package/dist/es2019/ui/create-form/user-picker/old/main.js +0 -59
  130. package/dist/es2019/ui/inline-create/old/index.js +0 -30
  131. package/dist/es2019/ui/inline-create/old/main.js +0 -96
  132. package/dist/es2019/ui/modal-create/old/index.js +0 -36
  133. package/dist/es2019/ui/modal-create/old/main.js +0 -137
  134. package/dist/esm/common/ui/error-boundary-modal/old/index.js +0 -25
  135. package/dist/esm/common/ui/error-boundary-ui/error-svg/old/index.js +0 -60
  136. package/dist/esm/common/ui/icon/old/index.js +0 -18
  137. package/dist/esm/common/ui/message/old/index.js +0 -73
  138. package/dist/esm/common/ui/modal-hero/old/index.js +0 -18
  139. package/dist/esm/controllers/create-field/old/main.js +0 -72
  140. package/dist/esm/ui/create-form/async-select/old/main.js +0 -188
  141. package/dist/esm/ui/create-form/form-footer/old/main.js +0 -56
  142. package/dist/esm/ui/create-form/form-loader/old/main.js +0 -31
  143. package/dist/esm/ui/create-form/old/main.js +0 -174
  144. package/dist/esm/ui/create-form/select/old/main.js +0 -117
  145. package/dist/esm/ui/create-form/textfield/old/main.js +0 -47
  146. package/dist/esm/ui/create-form/user-picker/old/main.js +0 -64
  147. package/dist/esm/ui/inline-create/old/index.js +0 -30
  148. package/dist/esm/ui/inline-create/old/main.js +0 -112
  149. package/dist/esm/ui/modal-create/old/index.js +0 -36
  150. package/dist/esm/ui/modal-create/old/main.js +0 -156
  151. package/dist/types/common/ui/error-boundary-modal/old/index.d.ts +0 -11
  152. package/dist/types/common/ui/error-boundary-ui/error-svg/old/index.d.ts +0 -7
  153. package/dist/types/common/ui/icon/old/index.d.ts +0 -7
  154. package/dist/types/common/ui/message/old/index.d.ts +0 -15
  155. package/dist/types/common/ui/modal-hero/old/index.d.ts +0 -4
  156. package/dist/types/controllers/create-field/old/main.d.ts +0 -7
  157. package/dist/types/ui/create-form/async-select/old/main.d.ts +0 -11
  158. package/dist/types/ui/create-form/form-footer/old/main.d.ts +0 -16
  159. package/dist/types/ui/create-form/form-loader/old/main.d.ts +0 -11
  160. package/dist/types/ui/create-form/old/main.d.ts +0 -54
  161. package/dist/types/ui/create-form/select/old/main.d.ts +0 -24
  162. package/dist/types/ui/create-form/textfield/old/main.d.ts +0 -14
  163. package/dist/types/ui/create-form/user-picker/old/main.d.ts +0 -11
  164. package/dist/types/ui/inline-create/old/index.d.ts +0 -5
  165. package/dist/types/ui/inline-create/old/main.d.ts +0 -8
  166. package/dist/types/ui/modal-create/old/index.d.ts +0 -5
  167. package/dist/types/ui/modal-create/old/main.d.ts +0 -4
  168. package/dist/types-ts4.5/common/ui/error-boundary-modal/old/index.d.ts +0 -11
  169. package/dist/types-ts4.5/common/ui/error-boundary-ui/error-svg/old/index.d.ts +0 -7
  170. package/dist/types-ts4.5/common/ui/icon/old/index.d.ts +0 -7
  171. package/dist/types-ts4.5/common/ui/message/old/index.d.ts +0 -15
  172. package/dist/types-ts4.5/common/ui/modal-hero/old/index.d.ts +0 -4
  173. package/dist/types-ts4.5/controllers/create-field/old/main.d.ts +0 -7
  174. package/dist/types-ts4.5/ui/create-form/async-select/old/main.d.ts +0 -11
  175. package/dist/types-ts4.5/ui/create-form/form-footer/old/main.d.ts +0 -16
  176. package/dist/types-ts4.5/ui/create-form/form-loader/old/main.d.ts +0 -11
  177. package/dist/types-ts4.5/ui/create-form/old/main.d.ts +0 -56
  178. package/dist/types-ts4.5/ui/create-form/select/old/main.d.ts +0 -24
  179. package/dist/types-ts4.5/ui/create-form/textfield/old/main.d.ts +0 -14
  180. package/dist/types-ts4.5/ui/create-form/user-picker/old/main.d.ts +0 -11
  181. package/dist/types-ts4.5/ui/inline-create/old/index.d.ts +0 -5
  182. package/dist/types-ts4.5/ui/inline-create/old/main.d.ts +0 -8
  183. package/dist/types-ts4.5/ui/modal-create/old/index.d.ts +0 -5
  184. package/dist/types-ts4.5/ui/modal-create/old/main.d.ts +0 -4
@@ -1,164 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- var _react = require("react");
12
- var _react2 = require("@emotion/react");
13
- var _reactIntlNext = require("react-intl-next");
14
- var _layering = require("@atlaskit/layering");
15
- var _modalDialog = require("@atlaskit/modal-dialog");
16
- var _primitives = require("@atlaskit/primitives");
17
- var _constants = require("../../../common/constants");
18
- var _confirmDismissDialog = require("../../../common/ui/confirm-dismiss-dialog");
19
- var _editModal = require("../../../common/ui/edit-modal");
20
- var _errorBoundary = require("../../../common/ui/error-boundary");
21
- var _linkCreateContent = require("../../../common/ui/link-create-content");
22
- var _modalHero = require("../../../common/ui/modal-hero");
23
- var _ModalDialog = require("../../../common/ui/ModalDialog");
24
- var _callbackContext = require("../../../controllers/callback-context");
25
- var _editPostCreateContext = require("../../../controllers/edit-post-create-context");
26
- var _exitWarningModalContext = require("../../../controllers/exit-warning-modal-context");
27
- var _formContext = require("../../../controllers/form-context");
28
- var _pluginContext = require("../../../controllers/plugin-context");
29
- var _messages = require("../messages");
30
- /* eslint-disable @atlassian/tangerine/import/no-parent-imports */
31
- /**
32
- * @jsxRuntime classic
33
- * @jsx jsx
34
- */
35
-
36
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
37
-
38
- var LinkCreateWithModal = function LinkCreateWithModal(_ref) {
39
- var active = _ref.active,
40
- modalTitle = _ref.modalTitle,
41
- onCreate = _ref.onCreate,
42
- onFailure = _ref.onFailure,
43
- onCancel = _ref.onCancel,
44
- onComplete = _ref.onComplete,
45
- onOpenComplete = _ref.onOpenComplete,
46
- onCloseComplete = _ref.onCloseComplete,
47
- _ref$testId = _ref.testId,
48
- testId = _ref$testId === void 0 ? _constants.DEFAULT_TEST_ID : _ref$testId,
49
- plugins = _ref.plugins,
50
- entityKey = _ref.entityKey,
51
- modalHero = _ref.modalHero;
52
- var intl = (0, _reactIntlNext.useIntl)();
53
- var _useExitWarningModal = (0, _exitWarningModalContext.useExitWarningModal)(),
54
- withExitWarning = _useExitWarningModal.withExitWarning,
55
- showExitWarning = _useExitWarningModal.showExitWarning,
56
- setShowExitWarning = _useExitWarningModal.setShowExitWarning;
57
- var _useEditPostCreateMod = (0, _editPostCreateContext.useEditPostCreateModal)(),
58
- editViewPayload = _useEditPostCreateMod.editViewPayload;
59
- var _useLinkCreatePlugins = (0, _pluginContext.useLinkCreatePlugins)(),
60
- activePlugin = _useLinkCreatePlugins.activePlugin;
61
- var handleCloseExitWarning = function handleCloseExitWarning() {
62
- return setShowExitWarning(false);
63
- };
64
- return (0, _react2.jsx)(_callbackContext.LinkCreateCallbackProvider, {
65
- onCreate: onCreate,
66
- onFailure: onFailure,
67
- onCancel: withExitWarning(onCancel)
68
- }, (0, _react2.jsx)(_modalDialog.ModalTransition, null, active && (0, _react2.jsx)(_ModalDialog.Modal, {
69
- testId: "link-create-modal",
70
- screen: _constants.SCREEN_ID,
71
- onClose: withExitWarning(onCancel),
72
- shouldScrollInViewport: true,
73
- onOpenComplete: onOpenComplete,
74
- onCloseComplete: onCloseComplete,
75
- width: "".concat(_constants.CREATE_FORM_MAX_WIDTH_IN_PX, "px")
76
- }, (0, _react2.jsx)(_modalHero.ModalHero, {
77
- hero: modalHero
78
- }), (0, _react2.jsx)(_modalDialog.ModalHeader, null, (0, _react2.jsx)(_modalDialog.ModalTitle, null, modalTitle || intl.formatMessage(_messages.messages.heading))), (0, _react2.jsx)(_modalDialog.ModalBody, null, (0, _react2.jsx)(_primitives.Box, {
79
- testId: testId
80
- }, (0, _react2.jsx)(_errorBoundary.ErrorBoundary, null, (0, _react2.jsx)(_linkCreateContent.LinkCreateContent, {
81
- plugins: plugins,
82
- entityKey: entityKey
83
- })))))), onComplete && (0, _react2.jsx)(_editModal.EditModal, {
84
- onCloseComplete: onCloseComplete,
85
- onClose: onComplete,
86
- editViewPayload: editViewPayload,
87
- activePlugin: activePlugin
88
- }), (0, _react2.jsx)(_layering.Layering, {
89
- isDisabled: false
90
- }, (0, _react2.jsx)(_confirmDismissDialog.ConfirmDismissDialog, {
91
- active: showExitWarning,
92
- onClose: handleCloseExitWarning,
93
- onCancel: onCancel
94
- })));
95
- };
96
- var LinkCreateModalOld = function LinkCreateModalOld(props) {
97
- var shouldCallCloseComplete = (0, _react.useRef)(!props.active);
98
-
99
- // modal calls onCloseComplete in a useEffect(), so we can track whether
100
- // or not we should execute it based on the active prop in a
101
- // useLayoutEffect() which will be run before child useEffect()s
102
- (0, _react.useLayoutEffect)(function () {
103
- // onCloseComplete should only be called when it is not active
104
- shouldCallCloseComplete.current = !props.active;
105
- }, [props.active]);
106
- return (0, _react2.jsx)(_pluginContext.LinkCreatePluginsProvider, {
107
- plugins: props.plugins,
108
- entityKey: props.entityKey
109
- }, function (pluginsProvider) {
110
- return (0, _react2.jsx)(_editPostCreateContext.EditPostCreateModalProvider, {
111
- active: !!props.active
112
- }, function (_ref2) {
113
- var _pluginsProvider$acti;
114
- var setEditViewPayload = _ref2.setEditViewPayload,
115
- editViewPayload = _ref2.editViewPayload,
116
- shouldActivateEditView = _ref2.shouldActivateEditView,
117
- enableEditView = _ref2.enableEditView;
118
- return (0, _react2.jsx)(_formContext.FormContextProvider, {
119
- 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
120
- }, (0, _react2.jsx)(_exitWarningModalContext.ExitWarningModalProvider, null, (0, _react2.jsx)(LinkCreateWithModal, (0, _extends2.default)({}, props, {
121
- active: props.active && !editViewPayload,
122
- onCreate: ( /*#__PURE__*/function () {
123
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(payload) {
124
- var _props$onCreate;
125
- return _regenerator.default.wrap(function _callee$(_context) {
126
- while (1) switch (_context.prev = _context.next) {
127
- case 0:
128
- _context.next = 2;
129
- return (_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload);
130
- case 2:
131
- // if onComplete exists then there is an edit flow
132
- if (props.onComplete) {
133
- if (shouldActivateEditView()) {
134
- //edit button is pressed
135
- setEditViewPayload(payload);
136
- } else {
137
- //create button is pressed
138
- props.onComplete();
139
- }
140
- }
141
- case 3:
142
- case "end":
143
- return _context.stop();
144
- }
145
- }, _callee);
146
- }));
147
- return function (_x) {
148
- return _ref3.apply(this, arguments);
149
- };
150
- }()),
151
- onCloseComplete: function onCloseComplete() {
152
- if (shouldCallCloseComplete.current) {
153
- var _props$onCloseComplet;
154
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
155
- args[_key] = arguments[_key];
156
- }
157
- (_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 || _props$onCloseComplet.call.apply(_props$onCloseComplet, [props].concat(args));
158
- }
159
- }
160
- }))));
161
- });
162
- });
163
- };
164
- var _default = exports.default = LinkCreateModalOld;
@@ -1,26 +0,0 @@
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 const ErrorBoundaryModalOld = ({
17
- active,
18
- onClose
19
- }) => {
20
- return jsx(ModalTransition, null, active && jsx(Modal, {
21
- testId: "link-create-error-boundary-modal",
22
- onClose: onClose,
23
- shouldScrollInViewport: true,
24
- width: `${CREATE_FORM_MAX_WIDTH_IN_PX}px`
25
- }, jsx(ModalBody, null, jsx(ErrorBoundaryUI, null))));
26
- };
@@ -1,58 +0,0 @@
1
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
2
- /**
3
- * @jsxRuntime classic
4
- * @jsx jsx
5
- */
6
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
- import { css, jsx } from '@emotion/react';
8
- const WIDTH = 82;
9
- const errorStyles = css({
10
- width: `${WIDTH}px`,
11
- margin: `0 auto ${"var(--ds-space-300, 24px)"}`,
12
- display: `block`
13
- });
14
- const id = 'link-create-error-svg';
15
- const ErrorSVGOld = () => jsx("svg", {
16
- height: "90",
17
- viewBox: "0 0 164 212",
18
- fill: "none",
19
- xmlns: "http://www.w3.org/2000/svg",
20
- css: errorStyles
21
- }, jsx("path", {
22
- d: "m95.43 74.16 66.44 115.08c5.84 10.12-1.46 22.76-13.14 22.76H15.85c-11.68 0-18.98-12.65-13.14-22.76L69.15 74.16c5.84-10.12 20.44-10.12 26.28 0Zm-7.56 83.55 2.88-44.35c.34-5.29-3.86-9.78-9.16-9.78-5.31 0-9.51 4.48-9.16 9.78l2.88 44.35a6.3 6.3 0 0 0 6.28 5.89c3.31 0 6.06-2.58 6.28-5.89Zm-15.84 23.54c0 5.66 4.76 10.1 10.39 9.58 4.85-.45 8.73-4.5 8.83-9.37.11-5.45-4.31-9.94-9.73-9.94-5.23-.01-9.49 4.37-9.49 9.73Z",
23
- fill: `url(#${id})`
24
- }), jsx("path", {
25
- opacity: ".6",
26
- d: "M93.35 27.17 85.94.45c-.17-.62-1.07-.58-1.19.05l-4.66 25.1-5.8-1.08a.612.612 0 0 0-.7.76L81 52c.17.62 1.07.58 1.19-.05l4.66-25.1 5.8 1.08c.45.08.82-.33.7-.76ZM66.77 41.81 55.9 33.26c-.22-.18-.53.07-.41.33l5.53 11.43-2.66 1.29c-.18.09-.2.33-.05.45l10.87 8.55c.22.18.53-.07.41-.33l-5.53-11.43 2.66-1.29c.17-.08.2-.33.05-.45Z",
27
- fill: "#C1C7D0"
28
- }), jsx("path", {
29
- opacity: ".6",
30
- d: "M102.78 56.75a.993.993 0 0 1-.92-1.38c-.24-.77-2.29-2.85-3.54-4.11-2.97-3.01-4.93-5-3.84-6.49 1.09-1.48 3.58-.22 7.35 1.7 1.32.67 3.35 1.7 4.45 2.03-.64-.95-2.24-2.58-3.28-3.63-2.97-3.01-4.93-5-3.84-6.49 1.08-1.48 3.58-.22 7.34 1.7 1.32.67 3.34 1.7 4.45 2.03-.64-.95-2.24-2.57-3.28-3.62-2.97-3.01-4.93-5-3.84-6.49 1.08-1.48 3.57-.22 7.34 1.7 1.58.8 4.18 2.13 4.98 2.13a1.005 1.005 0 0 1 1.46 1.36c-1.09 1.48-3.57.22-7.34-1.7-1.32-.67-3.34-1.7-4.44-2.03.64.95 2.24 2.57 3.28 3.62 2.97 3.01 4.93 5 3.84 6.49-1.08 1.48-3.57.22-7.34-1.7-1.32-.67-3.35-1.7-4.45-2.03.64.95 2.24 2.57 3.28 3.63 2.97 3.01 4.93 5 3.84 6.49-1.09 1.48-3.58.22-7.35-1.7-1.32-.67-3.35-1.71-4.45-2.03.64.95 2.24 2.58 3.28 3.63 2.97 3.01 4.93 5 3.84 6.49-.21.26-.51.4-.82.4Zm5.56 14.32c-.35 0-.69-.19-.88-.52-1.04-1.88-2.22-4.02-.91-5.21 1.31-1.2 3.34.18 5.49 1.63.87.59 2.26 1.53 2.93 1.71-.12-.68-.93-2.15-1.45-3.07-1.26-2.27-2.45-4.41-1.14-5.61 1.31-1.2 3.34.18 5.49 1.63.96.65 2.54 1.72 3.1 1.74a1 1 0 0 1 1.27 1.54c-1.31 1.2-3.34-.17-5.49-1.63-.87-.59-2.26-1.53-2.93-1.71.12.68.93 2.15 1.45 3.07 1.26 2.27 2.45 4.41 1.14 5.61-1.31 1.2-3.34-.18-5.49-1.63-.87-.59-2.26-1.53-2.93-1.71.12.68.93 2.14 1.22 2.67.27.48.09 1.09-.39 1.36-.15.09-.32.13-.48.13Zm-54.32-2.89c-.22 0-.44-.04-.67-.14-1.64-.69-1.24-3.11-.81-5.67.17-1.04.45-2.7.33-3.38-.57.39-1.56 1.75-2.18 2.6-1.53 2.09-2.99 4.07-4.62 3.38a.991.991 0 0 1-.53-1.31c.2-.48.73-.72 1.21-.57.52-.21 1.65-1.75 2.34-2.68 1.53-2.09 2.98-4.08 4.62-3.38 1.64.69 1.24 3.11.81 5.67-.17 1.04-.45 2.7-.33 3.38.57-.39 1.56-1.75 2.18-2.6 1.53-2.09 2.98-4.08 4.62-3.38 1.63.69 1.24 3.09.89 5.21-.09.54-.6.91-1.15.83-.54-.09-.92-.6-.83-1.15.1-.59.37-2.24.26-2.92-.57.39-1.56 1.75-2.18 2.6-1.33 1.79-2.59 3.51-3.96 3.51Z",
31
- fill: "#B3BAC5"
32
- }), jsx("defs", null, jsx("linearGradient", {
33
- id: id,
34
- x1: "26.169",
35
- y1: "228.621",
36
- x2: "138.408",
37
- y2: "116.382",
38
- gradientUnits: "userSpaceOnUse"
39
- }, jsx("stop", {
40
- stopColor: "#C1C7D0"
41
- }), jsx("stop", {
42
- offset: ".297",
43
- stopColor: "#C6CBD4",
44
- stopOpacity: ".881"
45
- }), jsx("stop", {
46
- offset: ".63",
47
- stopColor: "#D3D7DE",
48
- stopOpacity: ".748"
49
- }), jsx("stop", {
50
- offset: ".98",
51
- stopColor: "#E9EBEF",
52
- stopOpacity: ".608"
53
- }), jsx("stop", {
54
- offset: "1",
55
- stopColor: "#EBECF0",
56
- stopOpacity: ".6"
57
- }))));
58
- export default ErrorSVGOld;
@@ -1,18 +0,0 @@
1
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
2
- import styled from '@emotion/styled';
3
- import { N20A } from '@atlaskit/theme/colors';
4
- // eslint-disable-next-line @atlaskit/design-system/prefer-primitives, @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-dynamic-styles -- Ignored via go/DSP-18766
5
- export const UrlIconOld = styled.div(props => {
6
- var _props$url;
7
- return {
8
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
9
- backgroundImage: `url(${(_props$url = props.url) !== null && _props$url !== void 0 ? _props$url : ''})`,
10
- backgroundColor: `var(--ds-skeleton, ${N20A})`,
11
- backgroundSize: 'contain',
12
- backgroundRepeat: 'no-repeat',
13
- height: "var(--ds-space-200, 16px)",
14
- width: "var(--ds-space-200, 16px)",
15
- borderRadius: "var(--ds-border-radius, 3px)",
16
- flexShrink: 0
17
- };
18
- });
@@ -1,74 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
-
6
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
- import { css, jsx } from '@emotion/react';
8
- import SuccessIcon from '@atlaskit/icon/utility/check-circle';
9
- import ErrorIcon from '@atlaskit/icon/utility/error';
10
- import { Box, xcss } from '@atlaskit/primitives';
11
- const messageStyles = xcss({
12
- display: 'flex',
13
- justifyContent: 'baseline',
14
- gap: 'space.050',
15
- font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
16
- marginBlockStart: 'space.050'
17
- });
18
- const messageAppearanceStyles = {
19
- default: xcss({
20
- color: 'color.text.subtlest'
21
- }),
22
- error: xcss({
23
- color: 'color.text.danger'
24
- }),
25
- valid: xcss({
26
- color: 'color.text.success'
27
- })
28
- };
29
- const iconWrapperStyles = css({
30
- display: 'flex',
31
- alignItems: 'center',
32
- marginInlineStart: "var(--ds-space-025, 2px)",
33
- marginInlineEnd: "var(--ds-space-025, 2px)"
34
- });
35
- const IconWrapper = ({
36
- children
37
- }) => {
38
- return jsx("span", {
39
- css: iconWrapperStyles
40
- }, children);
41
- };
42
- const messageIcons = {
43
- error: jsx(ErrorIcon, {
44
- color: "var(--ds-text-danger, #AE2A19)",
45
- label: "error"
46
- }),
47
- valid: jsx(SuccessIcon, {
48
- color: "var(--ds-text-success, #216E4E)",
49
- label: "success"
50
- })
51
- };
52
- export const MessageOld = ({
53
- children,
54
- appearance = 'default',
55
- id,
56
- testId
57
- }) => {
58
- const icon = messageIcons[appearance];
59
-
60
- /**
61
- * The wrapping span is necessary to preserve spaces between children.
62
- * Otherwise the flex layout of the message will remove any whitespace
63
- * between children.
64
- *
65
- * If the child is just a string, this is not required and we can use one
66
- * less DOM element.
67
- */
68
- const content = typeof children === 'string' ? children : jsx("span", null, children);
69
- return jsx(Box, {
70
- xcss: [messageStyles, messageAppearanceStyles[appearance]],
71
- testId: testId,
72
- id: id
73
- }, icon && jsx(IconWrapper, null, icon), content);
74
- };
@@ -1,19 +0,0 @@
1
- import React, { Fragment } from 'react';
2
- import { Stack } from '@atlaskit/primitives';
3
- import { ErrorBoundary } from '../../../../common/ui/error-boundary';
4
- const ErrorComponent = () => {
5
- // when there's an error, render nothing but report the issue
6
- return /*#__PURE__*/React.createElement(Fragment, null, null);
7
- };
8
- export const ModalHeroOld = ({
9
- hero
10
- }) => {
11
- if (!hero) {
12
- return null;
13
- }
14
- return /*#__PURE__*/React.createElement(Stack, {
15
- testId: "link-create-modal-hero"
16
- }, /*#__PURE__*/React.createElement(ErrorBoundary, {
17
- errorComponent: /*#__PURE__*/React.createElement(ErrorComponent, null)
18
- }, hero));
19
- };
@@ -1,74 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
-
6
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
7
- import { css, jsx } from '@emotion/react';
8
- import { Field } from 'react-final-form';
9
- import { Label, RequiredAsterisk } from '@atlaskit/form';
10
- import { Message } from '../../../common/ui/message';
11
- import { shouldShowValidationErrors } from '../../../common/utils/form';
12
- const fieldWrapperStyles = css({
13
- marginTop: "var(--ds-space-100, 8px)"
14
- });
15
- export function CreateFieldOld({
16
- id,
17
- name,
18
- label,
19
- isRequired,
20
- validators,
21
- validationHelpText,
22
- testId,
23
- children
24
- }) {
25
- const fieldId = id ? id : `link-create-field-${name}`;
26
- return jsx(Field, {
27
- name: name,
28
- validate: value => {
29
- var _find;
30
- return (_find = (validators !== null && validators !== void 0 ? validators : []).find(validator => {
31
- return !validator.isValid(value);
32
- })) === null || _find === void 0 ? void 0 : _find.errorMessage;
33
- }
34
- }, ({
35
- input,
36
- meta
37
- }) => {
38
- const isInvalid = shouldShowValidationErrors(meta);
39
- const {
40
- submitError,
41
- error
42
- } = meta;
43
- const hasError = !!submitError || !!error;
44
- const showErrorMessage = hasError && isInvalid;
45
- const describedById = `${fieldId}-description`;
46
- const errorMessageId = `${fieldId}-error`;
47
- const ariaErrorMessage = showErrorMessage ? errorMessageId : undefined;
48
- return jsx("div", {
49
- css: fieldWrapperStyles,
50
- "data-testid": testId
51
- }, label && jsx(Label, {
52
- htmlFor: fieldId,
53
- id: `${fieldId}-label`,
54
- testId: `${testId}-label`
55
- }, label, isRequired && jsx(RequiredAsterisk, null)), children({
56
- ...input,
57
- fieldId,
58
- isInvalid,
59
- isRequired,
60
- 'aria-errormessage': ariaErrorMessage,
61
- 'aria-describedby': describedById
62
- }), jsx("div", {
63
- id: describedById
64
- }, !hasError && validationHelpText && jsx(Message, {
65
- testId: `${testId}-helper-message`
66
- }, validationHelpText), jsx("div", {
67
- "aria-live": "polite"
68
- }, showErrorMessage && jsx(Message, {
69
- id: errorMessageId,
70
- appearance: "error",
71
- testId: `${testId}-error-message`
72
- }, submitError || error))));
73
- });
74
- }
@@ -1,137 +0,0 @@
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 { useEffect, useMemo, useState } 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 debounce from 'debounce-promise';
12
- import { useForm } from 'react-final-form';
13
- import { useIntl } from 'react-intl-next';
14
- import { AsyncSelect as AkAsyncSelect } from '@atlaskit/select';
15
- import messages from '../../../../common/messages';
16
- import { useLinkCreateCallback } from '../../../../controllers/callback-context';
17
- import { CreateField } from '../../../../controllers/create-field';
18
- import { useFormContext } from '../../../../controllers/form-context';
19
- export const TEST_ID = 'link-create-async-select';
20
-
21
- /**
22
- * An async select utilising the Atlaskit AsyncSelect and CreateField.
23
- * Validation is handled by the form on form submission. Any
24
- * errors returned by the handleSubmit function passed to the form <Form> that
25
- * have a key matching the `name` of this field are shown below the field.
26
- */
27
- export function AsyncSelectOld({
28
- id,
29
- name,
30
- label,
31
- isRequired,
32
- validators,
33
- validationHelpText,
34
- testId = TEST_ID,
35
- //@ts-ignore react-select unsupported props
36
- defaultOption: propsDefaultValue,
37
- loadOptions: loadOptionsFn,
38
- ...restProps
39
- }) {
40
- const {
41
- mutators
42
- } = useForm();
43
- const {
44
- onFailure
45
- } = useLinkCreateCallback();
46
- const {
47
- setFormErrorMessage
48
- } = useFormContext();
49
- const intl = useIntl();
50
- const [defaultValue, setDefaultValue] = useState(propsDefaultValue);
51
- const [isLoadingDefaultOptions, setIsLoadingDefaultOptions] = useState(false);
52
- const [defaultOptions, setDefaultOptions] = useState([]);
53
-
54
- /**
55
- * This binds experience to fail if async fetch ever fails to load
56
- */
57
- const loadOptions = useMemo(() => {
58
- if (loadOptionsFn) {
59
- return async function (...args) {
60
- try {
61
- return await loadOptionsFn(...args);
62
- } catch (err) {
63
- onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
64
- setFormErrorMessage(intl.formatMessage(messages.genericErrorMessage));
65
- return [];
66
- }
67
- };
68
- }
69
- }, [intl, onFailure, loadOptionsFn, setFormErrorMessage]);
70
- useEffect(() => {
71
- let current = true;
72
- const fetch = async (query = '') => {
73
- if (!loadOptions) {
74
- return;
75
- }
76
- try {
77
- /**
78
- * If we are fetching default options, clear the
79
- * value the user has set
80
- */
81
- if (mutators.setField) {
82
- mutators.setField(name, null);
83
- }
84
- setIsLoadingDefaultOptions(true);
85
- setDefaultOptions([]);
86
- const options = await loadOptions(query);
87
- if (current) {
88
- setDefaultOptions(options);
89
- setIsLoadingDefaultOptions(false);
90
- }
91
- } catch (err) {
92
- if (current) {
93
- setIsLoadingDefaultOptions(false);
94
- }
95
- }
96
- };
97
- fetch();
98
- return () => {
99
- current = false;
100
- };
101
- }, [loadOptions, setIsLoadingDefaultOptions, setDefaultOptions, mutators, name]);
102
- useEffect(() => {
103
- /**
104
- * Mutate the form state to set a default value for this field
105
- * if `defaultOption` is a prop and we have not set a value for it yet
106
- */
107
- if (!defaultValue && propsDefaultValue) {
108
- setDefaultValue(propsDefaultValue);
109
- if (mutators.setField) {
110
- mutators.setField(name, propsDefaultValue);
111
- }
112
- }
113
- }, [defaultValue, propsDefaultValue, name, mutators]);
114
- const debouncedLoadOptions = useMemo(() => loadOptions ? debounce(loadOptions, 300) : undefined, [loadOptions]);
115
- return jsx(CreateField, {
116
- id: id,
117
- name: name,
118
- label: label,
119
- isRequired: isRequired,
120
- validators: validators,
121
- validationHelpText: validationHelpText,
122
- testId: testId
123
- }, ({
124
- fieldId,
125
- isRequired,
126
- ...fieldProps
127
- }) => {
128
- return jsx(AkAsyncSelect, _extends({
129
- inputId: fieldId
130
- }, fieldProps, restProps, {
131
- required: isRequired,
132
- loadOptions: debouncedLoadOptions,
133
- defaultOptions: defaultOptions,
134
- isLoading: isLoadingDefaultOptions
135
- }));
136
- });
137
- }
@@ -1,57 +0,0 @@
1
- /* eslint-disable @atlassian/tangerine/import/no-parent-imports */
2
- /**
3
- * @jsxRuntime classic
4
- * @jsx jsx
5
- */
6
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
- import { css, jsx } from '@emotion/react';
8
- import { useIntl } from 'react-intl-next';
9
- import { ButtonGroup } from '@atlaskit/button';
10
- import ErrorIcon from '@atlaskit/icon/core/migration/error';
11
- import { Button } from '../../../../common/ui/Button';
12
- import { EditButton } from '../edit-button';
13
- import { messages } from '../messages';
14
- import { SubmitButton } from '../submit-button';
15
- const formFooterWrapperStyles = css({
16
- display: 'flex',
17
- marginTop: "var(--ds-space-300, 24px)",
18
- justifyContent: 'flex-end'
19
- });
20
- const errorStyles = css({
21
- display: 'flex',
22
- alignItems: 'center',
23
- marginRight: 'auto'
24
- });
25
- /**
26
- * Footer for the Create Form, used as a wrapper for action buttons
27
- * and form error messages. This component is unmounted if
28
- * hideFooter is true in the Create Form.
29
- */
30
- export function CreateFormFooterOld({
31
- formErrorMessage,
32
- handleCancel,
33
- testId
34
- }) {
35
- const intl = useIntl();
36
- return jsx("footer", {
37
- "data-testid": `${testId}-footer`,
38
- css: formFooterWrapperStyles
39
- }, formErrorMessage && jsx("div", {
40
- role: "alert",
41
- css: errorStyles,
42
- "data-testid": `${testId}-error`
43
- }, jsx(ErrorIcon, {
44
- label: formErrorMessage,
45
- color: "var(--ds-icon-danger, #E34935)",
46
- spacing: "spacious"
47
- }), formErrorMessage), jsx(ButtonGroup, null, jsx(Button, {
48
- type: "button",
49
- actionSubjectId: "cancel",
50
- appearance: "subtle",
51
- onClick: e => {
52
- e.stopPropagation();
53
- handleCancel();
54
- },
55
- testId: `${testId}-button-cancel`
56
- }, intl.formatMessage(messages.close)), jsx(EditButton, null), jsx(SubmitButton, null)));
57
- }
@@ -1,31 +0,0 @@
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 { css, jsx } from '@emotion/react';
7
- import Spinner from '@atlaskit/spinner';
8
- import { CREATE_FORM_MIN_HEIGHT_IN_PX } from '../../../../common/constants';
9
- const formLoaderStyles = css({
10
- display: `flex`,
11
- alignItems: `center`,
12
- justifyContent: `center`,
13
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
14
- minHeight: `${CREATE_FORM_MIN_HEIGHT_IN_PX}px`
15
- });
16
-
17
- /**
18
- * Wrapper component for the Spinner, shows while the form
19
- * performs async functions on load.
20
- */
21
- export function CreateFormLoaderOld({
22
- size = 'large'
23
- }) {
24
- return jsx("div", {
25
- css: formLoaderStyles
26
- }, jsx(Spinner, {
27
- size: size,
28
- interactionName: "load",
29
- testId: "link-create-form-loader"
30
- }));
31
- }