@atlaskit/link-create 2.14.0 → 2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/common/constants.js +4 -1
- package/dist/cjs/common/ui/error-boundary-modal/index.js +13 -10
- package/dist/cjs/common/ui/error-boundary-modal/old/index.js +34 -0
- package/dist/cjs/common/ui/error-boundary-ui/error-svg/index.compiled.css +6 -0
- package/dist/cjs/common/ui/error-boundary-ui/error-svg/index.js +32 -25
- package/dist/cjs/common/ui/error-boundary-ui/error-svg/old/index.js +67 -0
- package/dist/cjs/common/ui/icon/index.compiled.css +7 -0
- package/dist/cjs/common/ui/icon/index.js +25 -20
- package/dist/cjs/common/ui/icon/old/index.js +26 -0
- package/dist/cjs/common/ui/message/index.compiled.css +11 -0
- package/dist/cjs/common/ui/message/index.js +33 -40
- package/dist/cjs/common/ui/message/old/index.js +81 -0
- package/dist/cjs/common/ui/modal-hero/index.js +11 -3
- package/dist/cjs/common/ui/modal-hero/old/index.js +27 -0
- package/dist/cjs/controllers/create-field/main.compiled.css +1 -0
- package/dist/cjs/controllers/create-field/main.js +30 -21
- package/dist/cjs/controllers/create-field/old/main.js +76 -0
- package/dist/cjs/ui/create-form/async-select/main.js +15 -10
- package/dist/cjs/ui/create-form/async-select/old/main.js +195 -0
- package/dist/cjs/ui/create-form/form-footer/main.compiled.css +5 -0
- package/dist/cjs/ui/create-form/form-footer/main.js +28 -28
- package/dist/cjs/ui/create-form/form-footer/old/main.js +64 -0
- package/dist/cjs/ui/create-form/form-loader/main.compiled.css +4 -0
- package/dist/cjs/ui/create-form/form-loader/main.js +22 -21
- package/dist/cjs/ui/create-form/form-loader/old/main.js +39 -0
- package/dist/cjs/ui/create-form/main.compiled.css +9 -0
- package/dist/cjs/ui/create-form/main.js +26 -21
- package/dist/cjs/ui/create-form/old/main.js +177 -0
- package/dist/cjs/ui/create-form/select/main.js +41 -20
- package/dist/cjs/ui/create-form/select/old/main.js +127 -0
- package/dist/cjs/ui/create-form/textfield/main.js +14 -13
- package/dist/cjs/ui/create-form/textfield/old/main.js +55 -0
- package/dist/cjs/ui/create-form/user-picker/main.js +14 -13
- package/dist/cjs/ui/create-form/user-picker/old/main.js +72 -0
- package/dist/cjs/ui/inline-create/index.js +17 -14
- package/dist/cjs/ui/inline-create/main.js +21 -19
- package/dist/cjs/ui/inline-create/old/index.js +38 -0
- package/dist/cjs/ui/inline-create/old/main.js +120 -0
- package/dist/cjs/ui/modal-create/index.js +19 -16
- package/dist/cjs/ui/modal-create/main.js +26 -23
- package/dist/cjs/ui/modal-create/old/index.js +44 -0
- package/dist/cjs/ui/modal-create/old/main.js +164 -0
- package/dist/es2019/common/constants.js +4 -1
- package/dist/es2019/common/ui/error-boundary-modal/index.js +12 -9
- package/dist/es2019/common/ui/error-boundary-modal/old/index.js +26 -0
- package/dist/es2019/common/ui/error-boundary-ui/error-svg/index.compiled.css +6 -0
- package/dist/es2019/common/ui/error-boundary-ui/error-svg/index.js +24 -23
- package/dist/es2019/common/ui/error-boundary-ui/error-svg/old/index.js +58 -0
- package/dist/es2019/common/ui/icon/index.compiled.css +7 -0
- package/dist/es2019/common/ui/icon/index.js +23 -18
- package/dist/es2019/common/ui/icon/old/index.js +18 -0
- package/dist/es2019/common/ui/message/index.compiled.css +11 -0
- package/dist/es2019/common/ui/message/index.js +30 -39
- package/dist/es2019/common/ui/message/old/index.js +74 -0
- package/dist/es2019/common/ui/modal-hero/index.js +10 -2
- package/dist/es2019/common/ui/modal-hero/old/index.js +19 -0
- package/dist/es2019/controllers/create-field/main.compiled.css +1 -0
- package/dist/es2019/controllers/create-field/main.js +26 -23
- package/dist/es2019/controllers/create-field/old/main.js +74 -0
- package/dist/es2019/ui/create-form/async-select/main.js +12 -11
- package/dist/es2019/ui/create-form/async-select/old/main.js +137 -0
- package/dist/es2019/ui/create-form/form-footer/main.compiled.css +5 -0
- package/dist/es2019/ui/create-form/form-footer/main.js +25 -27
- package/dist/es2019/ui/create-form/form-footer/old/main.js +57 -0
- package/dist/es2019/ui/create-form/form-loader/main.compiled.css +4 -0
- package/dist/es2019/ui/create-form/form-loader/main.js +19 -20
- package/dist/es2019/ui/create-form/form-loader/old/main.js +31 -0
- package/dist/es2019/ui/create-form/main.compiled.css +9 -0
- package/dist/es2019/ui/create-form/main.js +23 -23
- package/dist/es2019/ui/create-form/old/main.js +145 -0
- package/dist/es2019/ui/create-form/select/main.js +42 -22
- package/dist/es2019/ui/create-form/select/old/main.js +106 -0
- package/dist/es2019/ui/create-form/textfield/main.js +14 -12
- package/dist/es2019/ui/create-form/textfield/old/main.js +45 -0
- package/dist/es2019/ui/create-form/user-picker/main.js +14 -12
- package/dist/es2019/ui/create-form/user-picker/old/main.js +59 -0
- package/dist/es2019/ui/inline-create/index.js +14 -13
- package/dist/es2019/ui/inline-create/main.js +21 -18
- package/dist/es2019/ui/inline-create/old/index.js +30 -0
- package/dist/es2019/ui/inline-create/old/main.js +96 -0
- package/dist/es2019/ui/modal-create/index.js +16 -15
- package/dist/es2019/ui/modal-create/main.js +23 -22
- package/dist/es2019/ui/modal-create/old/index.js +36 -0
- package/dist/es2019/ui/modal-create/old/main.js +137 -0
- package/dist/esm/common/constants.js +4 -1
- package/dist/esm/common/ui/error-boundary-modal/index.js +12 -9
- package/dist/esm/common/ui/error-boundary-modal/old/index.js +25 -0
- package/dist/esm/common/ui/error-boundary-ui/error-svg/index.compiled.css +6 -0
- package/dist/esm/common/ui/error-boundary-ui/error-svg/index.js +28 -24
- package/dist/esm/common/ui/error-boundary-ui/error-svg/old/index.js +60 -0
- package/dist/esm/common/ui/icon/index.compiled.css +7 -0
- package/dist/esm/common/ui/icon/index.js +23 -18
- package/dist/esm/common/ui/icon/old/index.js +18 -0
- package/dist/esm/common/ui/message/index.compiled.css +11 -0
- package/dist/esm/common/ui/message/index.js +30 -39
- package/dist/esm/common/ui/message/old/index.js +73 -0
- package/dist/esm/common/ui/modal-hero/index.js +10 -2
- package/dist/esm/common/ui/modal-hero/old/index.js +18 -0
- package/dist/esm/controllers/create-field/main.compiled.css +1 -0
- package/dist/esm/controllers/create-field/main.js +25 -22
- package/dist/esm/controllers/create-field/old/main.js +72 -0
- package/dist/esm/ui/create-form/async-select/main.js +12 -11
- package/dist/esm/ui/create-form/async-select/old/main.js +188 -0
- package/dist/esm/ui/create-form/form-footer/main.compiled.css +5 -0
- package/dist/esm/ui/create-form/form-footer/main.js +24 -26
- package/dist/esm/ui/create-form/form-footer/old/main.js +56 -0
- package/dist/esm/ui/create-form/form-loader/main.compiled.css +4 -0
- package/dist/esm/ui/create-form/form-loader/main.js +18 -19
- package/dist/esm/ui/create-form/form-loader/old/main.js +31 -0
- package/dist/esm/ui/create-form/main.compiled.css +9 -0
- package/dist/esm/ui/create-form/main.js +23 -23
- package/dist/esm/ui/create-form/old/main.js +174 -0
- package/dist/esm/ui/create-form/select/main.js +41 -21
- package/dist/esm/ui/create-form/select/old/main.js +117 -0
- package/dist/esm/ui/create-form/textfield/main.js +13 -11
- package/dist/esm/ui/create-form/textfield/old/main.js +47 -0
- package/dist/esm/ui/create-form/user-picker/main.js +13 -11
- package/dist/esm/ui/create-form/user-picker/old/main.js +64 -0
- package/dist/esm/ui/inline-create/index.js +14 -13
- package/dist/esm/ui/inline-create/main.js +21 -18
- package/dist/esm/ui/inline-create/old/index.js +30 -0
- package/dist/esm/ui/inline-create/old/main.js +112 -0
- package/dist/esm/ui/modal-create/index.js +16 -15
- package/dist/esm/ui/modal-create/main.js +23 -22
- package/dist/esm/ui/modal-create/old/index.js +36 -0
- package/dist/esm/ui/modal-create/old/main.js +156 -0
- package/dist/types/common/constants.d.ts +3 -0
- package/dist/types/common/ui/ModalDialog/index.d.ts +1 -1
- package/dist/types/common/ui/confirm-dismiss-dialog/main.d.ts +2 -2
- package/dist/types/common/ui/edit-modal/index.d.ts +1 -1
- package/dist/types/common/ui/error-boundary/error-boundary-base/index.d.ts +1 -1
- package/dist/types/common/ui/error-boundary/index.d.ts +2 -2
- package/dist/types/common/ui/error-boundary-modal/index.d.ts +2 -2
- package/dist/types/common/ui/error-boundary-modal/old/index.d.ts +11 -0
- package/dist/types/common/ui/error-boundary-ui/error-svg/index.d.ts +2 -6
- package/dist/types/common/ui/error-boundary-ui/error-svg/old/index.d.ts +7 -0
- package/dist/types/common/ui/error-boundary-ui/index.d.ts +2 -2
- package/dist/types/common/ui/experience-tracker/index.d.ts +1 -1
- package/dist/types/common/ui/icon/index.d.ts +10 -6
- package/dist/types/common/ui/icon/old/index.d.ts +7 -0
- package/dist/types/common/ui/link-create-content/index.d.ts +2 -2
- package/dist/types/common/ui/message/index.d.ts +1 -2
- package/dist/types/common/ui/message/old/index.d.ts +15 -0
- package/dist/types/common/ui/modal-hero/index.d.ts +4 -2
- package/dist/types/common/ui/modal-hero/old/index.d.ts +4 -0
- package/dist/types/controllers/callback-context/main.d.ts +2 -2
- package/dist/types/controllers/create-field/main.d.ts +2 -2
- package/dist/types/controllers/create-field/old/main.d.ts +7 -0
- package/dist/types/controllers/edit-post-create-context/index.d.ts +1 -1
- package/dist/types/controllers/exit-warning-modal-context/index.d.ts +1 -1
- package/dist/types/controllers/form-context/main.d.ts +2 -2
- package/dist/types/controllers/plugin-context/index.d.ts +1 -1
- package/dist/types/ui/create-form/async-select/main.d.ts +2 -8
- package/dist/types/ui/create-form/async-select/old/main.d.ts +11 -0
- package/dist/types/ui/create-form/form-footer/edit-button/index.d.ts +2 -2
- package/dist/types/ui/create-form/form-footer/main.d.ts +2 -11
- package/dist/types/ui/create-form/form-footer/old/main.d.ts +16 -0
- package/dist/types/ui/create-form/form-footer/submit-button/index.d.ts +2 -2
- package/dist/types/ui/create-form/form-loader/main.d.ts +2 -10
- package/dist/types/ui/create-form/form-loader/old/main.d.ts +11 -0
- package/dist/types/ui/create-form/form-spy/index.d.ts +1 -1
- package/dist/types/ui/create-form/main.d.ts +1 -2
- package/dist/types/ui/create-form/old/main.d.ts +54 -0
- package/dist/types/ui/create-form/select/main.d.ts +5 -16
- package/dist/types/ui/create-form/select/old/main.d.ts +24 -0
- package/dist/types/ui/create-form/textfield/main.d.ts +2 -12
- package/dist/types/ui/create-form/textfield/old/main.d.ts +14 -0
- package/dist/types/ui/create-form/user-picker/main.d.ts +2 -9
- package/dist/types/ui/create-form/user-picker/old/main.d.ts +11 -0
- package/dist/types/ui/inline-create/index.d.ts +2 -3
- package/dist/types/ui/inline-create/inline-analytics/index.d.ts +2 -2
- package/dist/types/ui/inline-create/main.d.ts +2 -6
- package/dist/types/ui/inline-create/old/index.d.ts +5 -0
- package/dist/types/ui/inline-create/old/main.d.ts +8 -0
- package/dist/types/ui/modal-create/index.d.ts +2 -3
- package/dist/types/ui/modal-create/main.d.ts +2 -2
- package/dist/types/ui/modal-create/old/index.d.ts +5 -0
- package/dist/types/ui/modal-create/old/main.d.ts +4 -0
- package/dist/types-ts4.5/common/constants.d.ts +3 -0
- package/dist/types-ts4.5/common/ui/ModalDialog/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/confirm-dismiss-dialog/main.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/edit-modal/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/error-boundary/error-boundary-base/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/error-boundary/index.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/error-boundary-modal/index.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/error-boundary-modal/old/index.d.ts +11 -0
- package/dist/types-ts4.5/common/ui/error-boundary-ui/error-svg/index.d.ts +2 -6
- package/dist/types-ts4.5/common/ui/error-boundary-ui/error-svg/old/index.d.ts +7 -0
- package/dist/types-ts4.5/common/ui/error-boundary-ui/index.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/experience-tracker/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/icon/index.d.ts +10 -6
- package/dist/types-ts4.5/common/ui/icon/old/index.d.ts +7 -0
- package/dist/types-ts4.5/common/ui/link-create-content/index.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/message/index.d.ts +1 -2
- package/dist/types-ts4.5/common/ui/message/old/index.d.ts +15 -0
- package/dist/types-ts4.5/common/ui/modal-hero/index.d.ts +4 -2
- package/dist/types-ts4.5/common/ui/modal-hero/old/index.d.ts +4 -0
- package/dist/types-ts4.5/controllers/callback-context/main.d.ts +2 -2
- package/dist/types-ts4.5/controllers/create-field/main.d.ts +2 -2
- package/dist/types-ts4.5/controllers/create-field/old/main.d.ts +7 -0
- package/dist/types-ts4.5/controllers/edit-post-create-context/index.d.ts +1 -1
- package/dist/types-ts4.5/controllers/exit-warning-modal-context/index.d.ts +1 -1
- package/dist/types-ts4.5/controllers/form-context/main.d.ts +2 -2
- package/dist/types-ts4.5/controllers/plugin-context/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/create-form/async-select/main.d.ts +2 -8
- package/dist/types-ts4.5/ui/create-form/async-select/old/main.d.ts +11 -0
- package/dist/types-ts4.5/ui/create-form/form-footer/edit-button/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/create-form/form-footer/main.d.ts +2 -11
- package/dist/types-ts4.5/ui/create-form/form-footer/old/main.d.ts +16 -0
- package/dist/types-ts4.5/ui/create-form/form-footer/submit-button/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/create-form/form-loader/main.d.ts +2 -10
- package/dist/types-ts4.5/ui/create-form/form-loader/old/main.d.ts +11 -0
- package/dist/types-ts4.5/ui/create-form/form-spy/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/create-form/main.d.ts +1 -2
- package/dist/types-ts4.5/ui/create-form/old/main.d.ts +56 -0
- package/dist/types-ts4.5/ui/create-form/select/main.d.ts +5 -16
- package/dist/types-ts4.5/ui/create-form/select/old/main.d.ts +24 -0
- package/dist/types-ts4.5/ui/create-form/textfield/main.d.ts +2 -12
- package/dist/types-ts4.5/ui/create-form/textfield/old/main.d.ts +14 -0
- package/dist/types-ts4.5/ui/create-form/user-picker/main.d.ts +2 -9
- package/dist/types-ts4.5/ui/create-form/user-picker/old/main.d.ts +11 -0
- package/dist/types-ts4.5/ui/inline-create/index.d.ts +2 -3
- package/dist/types-ts4.5/ui/inline-create/inline-analytics/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/inline-create/main.d.ts +2 -6
- package/dist/types-ts4.5/ui/inline-create/old/index.d.ts +5 -0
- package/dist/types-ts4.5/ui/inline-create/old/main.d.ts +8 -0
- package/dist/types-ts4.5/ui/modal-create/index.d.ts +2 -3
- package/dist/types-ts4.5/ui/modal-create/main.d.ts +2 -2
- package/dist/types-ts4.5/ui/modal-create/old/index.d.ts +5 -0
- package/dist/types-ts4.5/ui/modal-create/old/main.d.ts +4 -0
- package/example-helpers/mock-disclaimer.tsx +1 -1
- package/package.json +18 -7
|
@@ -5,22 +5,17 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
5
5
|
var _excluded = ["id", "name", "label", "isRequired", "validators", "validationHelpText", "testId", "defaultOption", "loadOptions"],
|
|
6
6
|
_excluded2 = ["fieldId", "isRequired"];
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
-
|
|
9
|
-
* @jsxRuntime classic
|
|
10
|
-
* @jsx jsx
|
|
11
|
-
*/
|
|
12
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
13
|
-
|
|
14
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
|
-
import { jsx } from '@emotion/react';
|
|
8
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
16
9
|
import debounce from 'debounce-promise';
|
|
17
10
|
import { useForm } from 'react-final-form';
|
|
18
11
|
import { useIntl } from 'react-intl-next';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
19
13
|
import { AsyncSelect as AkAsyncSelect } from '@atlaskit/select';
|
|
20
14
|
import messages from '../../../common/messages';
|
|
21
15
|
import { useLinkCreateCallback } from '../../../controllers/callback-context';
|
|
22
16
|
import { CreateField } from '../../../controllers/create-field';
|
|
23
17
|
import { useFormContext } from '../../../controllers/form-context';
|
|
18
|
+
import { AsyncSelectOld } from './old/main';
|
|
24
19
|
export var TEST_ID = 'link-create-async-select';
|
|
25
20
|
|
|
26
21
|
/**
|
|
@@ -29,7 +24,7 @@ export var TEST_ID = 'link-create-async-select';
|
|
|
29
24
|
* errors returned by the handleSubmit function passed to the form <Form> that
|
|
30
25
|
* have a key matching the `name` of this field are shown below the field.
|
|
31
26
|
*/
|
|
32
|
-
|
|
27
|
+
function AsyncSelectNew(_ref) {
|
|
33
28
|
var id = _ref.id,
|
|
34
29
|
name = _ref.name,
|
|
35
30
|
label = _ref.label,
|
|
@@ -163,7 +158,7 @@ export function AsyncSelect(_ref) {
|
|
|
163
158
|
var debouncedLoadOptions = useMemo(function () {
|
|
164
159
|
return loadOptions ? debounce(loadOptions, 300) : undefined;
|
|
165
160
|
}, [loadOptions]);
|
|
166
|
-
return
|
|
161
|
+
return /*#__PURE__*/React.createElement(CreateField, {
|
|
167
162
|
id: id,
|
|
168
163
|
name: name,
|
|
169
164
|
label: label,
|
|
@@ -175,7 +170,7 @@ export function AsyncSelect(_ref) {
|
|
|
175
170
|
var fieldId = _ref4.fieldId,
|
|
176
171
|
isRequired = _ref4.isRequired,
|
|
177
172
|
fieldProps = _objectWithoutProperties(_ref4, _excluded2);
|
|
178
|
-
return
|
|
173
|
+
return /*#__PURE__*/React.createElement(AkAsyncSelect, _extends({
|
|
179
174
|
inputId: fieldId
|
|
180
175
|
}, fieldProps, restProps, {
|
|
181
176
|
required: isRequired,
|
|
@@ -184,4 +179,10 @@ export function AsyncSelect(_ref) {
|
|
|
184
179
|
isLoading: isLoadingDefaultOptions
|
|
185
180
|
}));
|
|
186
181
|
});
|
|
182
|
+
}
|
|
183
|
+
export function AsyncSelect(props) {
|
|
184
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
185
|
+
return /*#__PURE__*/React.createElement(AsyncSelectNew, props);
|
|
186
|
+
}
|
|
187
|
+
return /*#__PURE__*/React.createElement(AsyncSelectOld, props);
|
|
187
188
|
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["id", "name", "label", "isRequired", "validators", "validationHelpText", "testId", "defaultOption", "loadOptions"],
|
|
6
|
+
_excluded2 = ["fieldId", "isRequired"];
|
|
7
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
+
/* eslint-disable @atlassian/tangerine/import/no-parent-imports */
|
|
9
|
+
/**
|
|
10
|
+
* @jsxRuntime classic
|
|
11
|
+
* @jsx jsx
|
|
12
|
+
*/
|
|
13
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
|
+
import { jsx } from '@emotion/react';
|
|
17
|
+
import debounce from 'debounce-promise';
|
|
18
|
+
import { useForm } from 'react-final-form';
|
|
19
|
+
import { useIntl } from 'react-intl-next';
|
|
20
|
+
import { AsyncSelect as AkAsyncSelect } from '@atlaskit/select';
|
|
21
|
+
import messages from '../../../../common/messages';
|
|
22
|
+
import { useLinkCreateCallback } from '../../../../controllers/callback-context';
|
|
23
|
+
import { CreateField } from '../../../../controllers/create-field';
|
|
24
|
+
import { useFormContext } from '../../../../controllers/form-context';
|
|
25
|
+
export var TEST_ID = 'link-create-async-select';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* An async select utilising the Atlaskit AsyncSelect and CreateField.
|
|
29
|
+
* Validation is handled by the form on form submission. Any
|
|
30
|
+
* errors returned by the handleSubmit function passed to the form <Form> that
|
|
31
|
+
* have a key matching the `name` of this field are shown below the field.
|
|
32
|
+
*/
|
|
33
|
+
export function AsyncSelectOld(_ref) {
|
|
34
|
+
var id = _ref.id,
|
|
35
|
+
name = _ref.name,
|
|
36
|
+
label = _ref.label,
|
|
37
|
+
isRequired = _ref.isRequired,
|
|
38
|
+
validators = _ref.validators,
|
|
39
|
+
validationHelpText = _ref.validationHelpText,
|
|
40
|
+
_ref$testId = _ref.testId,
|
|
41
|
+
testId = _ref$testId === void 0 ? TEST_ID : _ref$testId,
|
|
42
|
+
propsDefaultValue = _ref.defaultOption,
|
|
43
|
+
loadOptionsFn = _ref.loadOptions,
|
|
44
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
45
|
+
var _useForm = useForm(),
|
|
46
|
+
mutators = _useForm.mutators;
|
|
47
|
+
var _useLinkCreateCallbac = useLinkCreateCallback(),
|
|
48
|
+
onFailure = _useLinkCreateCallbac.onFailure;
|
|
49
|
+
var _useFormContext = useFormContext(),
|
|
50
|
+
setFormErrorMessage = _useFormContext.setFormErrorMessage;
|
|
51
|
+
var intl = useIntl();
|
|
52
|
+
var _useState = useState(propsDefaultValue),
|
|
53
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
54
|
+
defaultValue = _useState2[0],
|
|
55
|
+
setDefaultValue = _useState2[1];
|
|
56
|
+
var _useState3 = useState(false),
|
|
57
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
58
|
+
isLoadingDefaultOptions = _useState4[0],
|
|
59
|
+
setIsLoadingDefaultOptions = _useState4[1];
|
|
60
|
+
var _useState5 = useState([]),
|
|
61
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
62
|
+
defaultOptions = _useState6[0],
|
|
63
|
+
setDefaultOptions = _useState6[1];
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* This binds experience to fail if async fetch ever fails to load
|
|
67
|
+
*/
|
|
68
|
+
var loadOptions = useMemo(function () {
|
|
69
|
+
if (loadOptionsFn) {
|
|
70
|
+
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
71
|
+
var _args = arguments;
|
|
72
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
73
|
+
while (1) switch (_context.prev = _context.next) {
|
|
74
|
+
case 0:
|
|
75
|
+
_context.prev = 0;
|
|
76
|
+
_context.next = 3;
|
|
77
|
+
return loadOptionsFn.apply(void 0, _args);
|
|
78
|
+
case 3:
|
|
79
|
+
return _context.abrupt("return", _context.sent);
|
|
80
|
+
case 6:
|
|
81
|
+
_context.prev = 6;
|
|
82
|
+
_context.t0 = _context["catch"](0);
|
|
83
|
+
onFailure === null || onFailure === void 0 || onFailure(_context.t0);
|
|
84
|
+
setFormErrorMessage(intl.formatMessage(messages.genericErrorMessage));
|
|
85
|
+
return _context.abrupt("return", []);
|
|
86
|
+
case 11:
|
|
87
|
+
case "end":
|
|
88
|
+
return _context.stop();
|
|
89
|
+
}
|
|
90
|
+
}, _callee, null, [[0, 6]]);
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
}, [intl, onFailure, loadOptionsFn, setFormErrorMessage]);
|
|
94
|
+
useEffect(function () {
|
|
95
|
+
var current = true;
|
|
96
|
+
var fetch = /*#__PURE__*/function () {
|
|
97
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
98
|
+
var query,
|
|
99
|
+
options,
|
|
100
|
+
_args2 = arguments;
|
|
101
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
102
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
103
|
+
case 0:
|
|
104
|
+
query = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : '';
|
|
105
|
+
if (loadOptions) {
|
|
106
|
+
_context2.next = 3;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
return _context2.abrupt("return");
|
|
110
|
+
case 3:
|
|
111
|
+
_context2.prev = 3;
|
|
112
|
+
/**
|
|
113
|
+
* If we are fetching default options, clear the
|
|
114
|
+
* value the user has set
|
|
115
|
+
*/
|
|
116
|
+
if (mutators.setField) {
|
|
117
|
+
mutators.setField(name, null);
|
|
118
|
+
}
|
|
119
|
+
setIsLoadingDefaultOptions(true);
|
|
120
|
+
setDefaultOptions([]);
|
|
121
|
+
_context2.next = 9;
|
|
122
|
+
return loadOptions(query);
|
|
123
|
+
case 9:
|
|
124
|
+
options = _context2.sent;
|
|
125
|
+
if (current) {
|
|
126
|
+
setDefaultOptions(options);
|
|
127
|
+
setIsLoadingDefaultOptions(false);
|
|
128
|
+
}
|
|
129
|
+
_context2.next = 16;
|
|
130
|
+
break;
|
|
131
|
+
case 13:
|
|
132
|
+
_context2.prev = 13;
|
|
133
|
+
_context2.t0 = _context2["catch"](3);
|
|
134
|
+
if (current) {
|
|
135
|
+
setIsLoadingDefaultOptions(false);
|
|
136
|
+
}
|
|
137
|
+
case 16:
|
|
138
|
+
case "end":
|
|
139
|
+
return _context2.stop();
|
|
140
|
+
}
|
|
141
|
+
}, _callee2, null, [[3, 13]]);
|
|
142
|
+
}));
|
|
143
|
+
return function fetch() {
|
|
144
|
+
return _ref3.apply(this, arguments);
|
|
145
|
+
};
|
|
146
|
+
}();
|
|
147
|
+
fetch();
|
|
148
|
+
return function () {
|
|
149
|
+
current = false;
|
|
150
|
+
};
|
|
151
|
+
}, [loadOptions, setIsLoadingDefaultOptions, setDefaultOptions, mutators, name]);
|
|
152
|
+
useEffect(function () {
|
|
153
|
+
/**
|
|
154
|
+
* Mutate the form state to set a default value for this field
|
|
155
|
+
* if `defaultOption` is a prop and we have not set a value for it yet
|
|
156
|
+
*/
|
|
157
|
+
if (!defaultValue && propsDefaultValue) {
|
|
158
|
+
setDefaultValue(propsDefaultValue);
|
|
159
|
+
if (mutators.setField) {
|
|
160
|
+
mutators.setField(name, propsDefaultValue);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}, [defaultValue, propsDefaultValue, name, mutators]);
|
|
164
|
+
var debouncedLoadOptions = useMemo(function () {
|
|
165
|
+
return loadOptions ? debounce(loadOptions, 300) : undefined;
|
|
166
|
+
}, [loadOptions]);
|
|
167
|
+
return jsx(CreateField, {
|
|
168
|
+
id: id,
|
|
169
|
+
name: name,
|
|
170
|
+
label: label,
|
|
171
|
+
isRequired: isRequired,
|
|
172
|
+
validators: validators,
|
|
173
|
+
validationHelpText: validationHelpText,
|
|
174
|
+
testId: testId
|
|
175
|
+
}, function (_ref4) {
|
|
176
|
+
var fieldId = _ref4.fieldId,
|
|
177
|
+
isRequired = _ref4.isRequired,
|
|
178
|
+
fieldProps = _objectWithoutProperties(_ref4, _excluded2);
|
|
179
|
+
return jsx(AkAsyncSelect, _extends({
|
|
180
|
+
inputId: fieldId
|
|
181
|
+
}, fieldProps, restProps, {
|
|
182
|
+
required: isRequired,
|
|
183
|
+
loadOptions: debouncedLoadOptions,
|
|
184
|
+
defaultOptions: defaultOptions,
|
|
185
|
+
isLoading: isLoadingDefaultOptions
|
|
186
|
+
}));
|
|
187
|
+
});
|
|
188
|
+
}
|
|
@@ -1,48 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
/* main.tsx generated by @compiled/babel-plugin v0.36.0 */
|
|
2
|
+
import "./main.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
7
5
|
import { useIntl } from 'react-intl-next';
|
|
8
6
|
import { ButtonGroup } from '@atlaskit/button';
|
|
9
7
|
import ErrorIcon from '@atlaskit/icon/core/migration/error';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
import { Button } from '../../../common/ui/Button';
|
|
11
10
|
import { EditButton } from './edit-button';
|
|
12
11
|
import { messages } from './messages';
|
|
12
|
+
import { CreateFormFooterOld } from './old/main';
|
|
13
13
|
import { SubmitButton } from './submit-button';
|
|
14
|
-
var formFooterWrapperStyles =
|
|
15
|
-
|
|
16
|
-
marginTop: "var(--ds-space-300, 24px)",
|
|
17
|
-
justifyContent: 'flex-end'
|
|
18
|
-
});
|
|
19
|
-
var errorStyles = css({
|
|
20
|
-
display: 'flex',
|
|
21
|
-
alignItems: 'center',
|
|
22
|
-
marginRight: 'auto'
|
|
23
|
-
});
|
|
14
|
+
var formFooterWrapperStyles = null;
|
|
15
|
+
var errorStyles = null;
|
|
24
16
|
/**
|
|
25
17
|
* Footer for the Create Form, used as a wrapper for action buttons
|
|
26
18
|
* and form error messages. This component is unmounted if
|
|
27
19
|
* hideFooter is true in the Create Form.
|
|
28
20
|
*/
|
|
29
|
-
|
|
21
|
+
var CreateFormFooterNew = function CreateFormFooterNew(_ref) {
|
|
30
22
|
var formErrorMessage = _ref.formErrorMessage,
|
|
31
23
|
handleCancel = _ref.handleCancel,
|
|
32
24
|
testId = _ref.testId;
|
|
33
25
|
var intl = useIntl();
|
|
34
|
-
return
|
|
26
|
+
return /*#__PURE__*/React.createElement("footer", {
|
|
35
27
|
"data-testid": "".concat(testId, "-footer"),
|
|
36
|
-
|
|
37
|
-
}, formErrorMessage &&
|
|
28
|
+
className: ax(["_1e0c1txw _19pk1ejb _1bahesu3"])
|
|
29
|
+
}, formErrorMessage && /*#__PURE__*/React.createElement("div", {
|
|
38
30
|
role: "alert",
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
31
|
+
"data-testid": "".concat(testId, "-error"),
|
|
32
|
+
className: ax(["_1e0c1txw _4cvr1h6o _2hwx1wug"])
|
|
33
|
+
}, /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
42
34
|
label: formErrorMessage,
|
|
43
35
|
color: "var(--ds-icon-danger, #E34935)",
|
|
44
36
|
spacing: "spacious"
|
|
45
|
-
}), formErrorMessage),
|
|
37
|
+
}), formErrorMessage), /*#__PURE__*/React.createElement(ButtonGroup, null, /*#__PURE__*/React.createElement(Button, {
|
|
46
38
|
type: "button",
|
|
47
39
|
actionSubjectId: "cancel",
|
|
48
40
|
appearance: "subtle",
|
|
@@ -51,5 +43,11 @@ export function CreateFormFooter(_ref) {
|
|
|
51
43
|
handleCancel();
|
|
52
44
|
},
|
|
53
45
|
testId: "".concat(testId, "-button-cancel")
|
|
54
|
-
}, intl.formatMessage(messages.close)),
|
|
55
|
-
}
|
|
46
|
+
}, intl.formatMessage(messages.close)), /*#__PURE__*/React.createElement(EditButton, null), /*#__PURE__*/React.createElement(SubmitButton, null)));
|
|
47
|
+
};
|
|
48
|
+
export var CreateFormFooter = function CreateFormFooter(props) {
|
|
49
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
50
|
+
return /*#__PURE__*/React.createElement(CreateFormFooterNew, props);
|
|
51
|
+
}
|
|
52
|
+
return /*#__PURE__*/React.createElement(CreateFormFooterOld, props);
|
|
53
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
var formFooterWrapperStyles = css({
|
|
16
|
+
display: 'flex',
|
|
17
|
+
marginTop: "var(--ds-space-300, 24px)",
|
|
18
|
+
justifyContent: 'flex-end'
|
|
19
|
+
});
|
|
20
|
+
var 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(_ref) {
|
|
31
|
+
var formErrorMessage = _ref.formErrorMessage,
|
|
32
|
+
handleCancel = _ref.handleCancel,
|
|
33
|
+
testId = _ref.testId;
|
|
34
|
+
var intl = useIntl();
|
|
35
|
+
return jsx("footer", {
|
|
36
|
+
"data-testid": "".concat(testId, "-footer"),
|
|
37
|
+
css: formFooterWrapperStyles
|
|
38
|
+
}, formErrorMessage && jsx("div", {
|
|
39
|
+
role: "alert",
|
|
40
|
+
css: errorStyles,
|
|
41
|
+
"data-testid": "".concat(testId, "-error")
|
|
42
|
+
}, jsx(ErrorIcon, {
|
|
43
|
+
label: formErrorMessage,
|
|
44
|
+
color: "var(--ds-icon-danger, #E34935)",
|
|
45
|
+
spacing: "spacious"
|
|
46
|
+
}), formErrorMessage), jsx(ButtonGroup, null, jsx(Button, {
|
|
47
|
+
type: "button",
|
|
48
|
+
actionSubjectId: "cancel",
|
|
49
|
+
appearance: "subtle",
|
|
50
|
+
onClick: function onClick(e) {
|
|
51
|
+
e.stopPropagation();
|
|
52
|
+
handleCancel();
|
|
53
|
+
},
|
|
54
|
+
testId: "".concat(testId, "-button-cancel")
|
|
55
|
+
}, intl.formatMessage(messages.close)), jsx(EditButton, null), jsx(SubmitButton, null)));
|
|
56
|
+
}
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
/* main.tsx generated by @compiled/babel-plugin v0.36.0 */
|
|
2
|
+
import "./main.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import Spinner from '@atlaskit/spinner';
|
|
8
|
-
import {
|
|
9
|
-
var formLoaderStyles =
|
|
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: "".concat(CREATE_FORM_MIN_HEIGHT_IN_PX, "px")
|
|
15
|
-
});
|
|
7
|
+
import { CreateFormLoaderOld } from './old/main';
|
|
8
|
+
var formLoaderStyles = null;
|
|
16
9
|
|
|
17
10
|
/**
|
|
18
11
|
* Wrapper component for the Spinner, shows while the form
|
|
19
12
|
* performs async functions on load.
|
|
20
13
|
*/
|
|
21
|
-
|
|
14
|
+
var CreateFormLoaderNew = function CreateFormLoaderNew(_ref) {
|
|
22
15
|
var _ref$size = _ref.size,
|
|
23
16
|
size = _ref$size === void 0 ? 'large' : _ref$size;
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
},
|
|
17
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
className: ax(["_1e0c1txw _4cvr1h6o _1bah1h6o _1tkeuuw1"])
|
|
19
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
27
20
|
size: size,
|
|
28
21
|
interactionName: "load",
|
|
29
22
|
testId: "link-create-form-loader"
|
|
30
23
|
}));
|
|
31
|
-
}
|
|
24
|
+
};
|
|
25
|
+
export var CreateFormLoader = function CreateFormLoader(props) {
|
|
26
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
27
|
+
return /*#__PURE__*/React.createElement(CreateFormLoaderNew, props);
|
|
28
|
+
}
|
|
29
|
+
return /*#__PURE__*/React.createElement(CreateFormLoaderOld, props);
|
|
30
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
var 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: "".concat(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(_ref) {
|
|
22
|
+
var _ref$size = _ref.size,
|
|
23
|
+
size = _ref$size === void 0 ? 'large' : _ref$size;
|
|
24
|
+
return jsx("div", {
|
|
25
|
+
css: formLoaderStyles
|
|
26
|
+
}, jsx(Spinner, {
|
|
27
|
+
size: size,
|
|
28
|
+
interactionName: "load",
|
|
29
|
+
testId: "link-create-form-loader"
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
._18u01wug{margin-left:auto}
|
|
2
|
+
._19bvidpf{padding-left:0}
|
|
3
|
+
._19pkze3t{margin-top:var(--ds-space-0,0)}
|
|
4
|
+
._2hwx1wug{margin-right:auto}
|
|
5
|
+
._ca0qidpf{padding-top:0}
|
|
6
|
+
._n3td1ejb{padding-bottom:var(--ds-space-300,24px)}
|
|
7
|
+
._otyrze3t{margin-bottom:var(--ds-space-0,0)}
|
|
8
|
+
._p12f1y37{max-width:5in}
|
|
9
|
+
._u5f3idpf{padding-right:0}
|
|
@@ -1,40 +1,34 @@
|
|
|
1
|
+
/* main.tsx generated by @compiled/babel-plugin v0.36.0 */
|
|
1
2
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
5
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
6
|
var _excluded = ["submitError"];
|
|
7
|
+
import "./main.compiled.css";
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
12
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
-
/**
|
|
10
|
-
* @jsxRuntime classic
|
|
11
|
-
* @jsx jsx
|
|
12
|
-
*/
|
|
13
13
|
import { useCallback } from 'react';
|
|
14
|
-
|
|
15
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
|
-
import { css, jsx } from '@emotion/react';
|
|
17
14
|
import { FORM_ERROR } from 'final-form';
|
|
18
15
|
import { Form, FormSpy } from 'react-final-form';
|
|
19
16
|
import { useIntl } from 'react-intl-next';
|
|
20
17
|
import { RequiredAsterisk } from '@atlaskit/form';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
18
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
19
|
+
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
20
|
+
import { LINK_CREATE_FORM_POST_CREATE_FIELD } from '../../common/constants';
|
|
23
21
|
import messages from '../../common/messages';
|
|
24
22
|
import { useLinkCreateCallback } from '../../controllers/callback-context';
|
|
25
23
|
import { useExitWarningModal } from '../../controllers/exit-warning-modal-context';
|
|
26
24
|
import { useFormContext } from '../../controllers/form-context';
|
|
27
25
|
import { CreateFormFooter } from './form-footer';
|
|
28
26
|
import { CreateFormLoader } from './form-loader';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
maxWidth: "".concat(CREATE_FORM_MAX_WIDTH_IN_PX, "px"),
|
|
32
|
-
padding: "0 0 ".concat("var(--ds-space-300, 24px)", " 0"),
|
|
33
|
-
margin: "var(--ds-space-0, 0px)".concat(" auto")
|
|
34
|
-
});
|
|
27
|
+
import { CreateFormOld } from './old/main';
|
|
28
|
+
var formStyles = null;
|
|
35
29
|
var RESERVED_FIELDS = [LINK_CREATE_FORM_POST_CREATE_FIELD];
|
|
36
30
|
export var TEST_ID = 'link-create-form';
|
|
37
|
-
|
|
31
|
+
var CreateFormNew = function CreateFormNew(_ref) {
|
|
38
32
|
var children = _ref.children,
|
|
39
33
|
_ref$testId = _ref.testId,
|
|
40
34
|
testId = _ref$testId === void 0 ? TEST_ID : _ref$testId,
|
|
@@ -120,9 +114,9 @@ export var CreateForm = function CreateForm(_ref) {
|
|
|
120
114
|
onCancel && onCancel();
|
|
121
115
|
}, [onCancel]);
|
|
122
116
|
if (isLoading) {
|
|
123
|
-
return
|
|
117
|
+
return /*#__PURE__*/React.createElement(CreateFormLoader, null);
|
|
124
118
|
}
|
|
125
|
-
return
|
|
119
|
+
return /*#__PURE__*/React.createElement(Form, {
|
|
126
120
|
onSubmit: handleSubmitWithErrorHandling,
|
|
127
121
|
initialValues: initialValues,
|
|
128
122
|
mutators: {
|
|
@@ -135,13 +129,13 @@ export var CreateForm = function CreateForm(_ref) {
|
|
|
135
129
|
}, function (_ref5) {
|
|
136
130
|
var submitError = _ref5.submitError,
|
|
137
131
|
formProps = _objectWithoutProperties(_ref5, _excluded);
|
|
138
|
-
return
|
|
132
|
+
return /*#__PURE__*/React.createElement("form", {
|
|
139
133
|
onSubmit: formProps.handleSubmit,
|
|
140
134
|
name: "link-create-form",
|
|
141
135
|
noValidate: true,
|
|
142
136
|
"data-testid": testId,
|
|
143
|
-
|
|
144
|
-
},
|
|
137
|
+
className: ax(["_p12f1y37 _ca0qidpf _u5f3idpf _n3td1ejb _19bvidpf _19pkze3t _2hwx1wug _otyrze3t _18u01wug"])
|
|
138
|
+
}, /*#__PURE__*/React.createElement(FormSpy, {
|
|
145
139
|
subscription: {
|
|
146
140
|
modified: true
|
|
147
141
|
},
|
|
@@ -156,9 +150,9 @@ export var CreateForm = function CreateForm(_ref) {
|
|
|
156
150
|
});
|
|
157
151
|
setShouldShowWarning(isModified);
|
|
158
152
|
}
|
|
159
|
-
}), !hideRequiredFieldMessage &&
|
|
153
|
+
}), !hideRequiredFieldMessage && /*#__PURE__*/React.createElement(Text, {
|
|
160
154
|
as: "p"
|
|
161
|
-
}, intl.formatMessage(messages.requiredFieldInstruction), " ",
|
|
155
|
+
}, intl.formatMessage(messages.requiredFieldInstruction), " ", /*#__PURE__*/React.createElement(RequiredAsterisk, null)), /*#__PURE__*/React.createElement(Box, null, children), !hideFooter && /*#__PURE__*/React.createElement(CreateFormFooter
|
|
162
156
|
/**
|
|
163
157
|
* We will prefer to render the error message connected to
|
|
164
158
|
* react final form state (submitError) otherwise we can
|
|
@@ -170,4 +164,10 @@ export var CreateForm = function CreateForm(_ref) {
|
|
|
170
164
|
testId: testId
|
|
171
165
|
}));
|
|
172
166
|
});
|
|
167
|
+
};
|
|
168
|
+
export var CreateForm = function CreateForm(props) {
|
|
169
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
170
|
+
return /*#__PURE__*/React.createElement(CreateFormNew, props);
|
|
171
|
+
}
|
|
172
|
+
return /*#__PURE__*/React.createElement(CreateFormOld, props);
|
|
173
173
|
};
|