@atlaskit/link-create 2.13.20 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/common/constants.js +4 -1
- package/dist/cjs/common/ui/error-boundary-modal/index.js +13 -10
- package/dist/cjs/common/ui/error-boundary-modal/old/index.js +34 -0
- package/dist/cjs/common/ui/error-boundary-ui/error-svg/index.compiled.css +6 -0
- package/dist/cjs/common/ui/error-boundary-ui/error-svg/index.js +32 -25
- package/dist/cjs/common/ui/error-boundary-ui/error-svg/old/index.js +67 -0
- package/dist/cjs/common/ui/icon/index.compiled.css +7 -0
- package/dist/cjs/common/ui/icon/index.js +25 -20
- package/dist/cjs/common/ui/icon/old/index.js +26 -0
- package/dist/cjs/common/ui/message/index.compiled.css +11 -0
- package/dist/cjs/common/ui/message/index.js +33 -40
- package/dist/cjs/common/ui/message/old/index.js +81 -0
- package/dist/cjs/common/ui/modal-hero/index.js +11 -3
- package/dist/cjs/common/ui/modal-hero/old/index.js +27 -0
- package/dist/cjs/controllers/create-field/main.compiled.css +1 -0
- package/dist/cjs/controllers/create-field/main.js +30 -21
- package/dist/cjs/controllers/create-field/old/main.js +76 -0
- package/dist/cjs/ui/create-form/async-select/main.js +15 -10
- package/dist/cjs/ui/create-form/async-select/old/main.js +195 -0
- package/dist/cjs/ui/create-form/form-footer/main.compiled.css +5 -0
- package/dist/cjs/ui/create-form/form-footer/main.js +28 -28
- package/dist/cjs/ui/create-form/form-footer/old/main.js +64 -0
- package/dist/cjs/ui/create-form/form-loader/main.compiled.css +4 -0
- package/dist/cjs/ui/create-form/form-loader/main.js +22 -21
- package/dist/cjs/ui/create-form/form-loader/old/main.js +39 -0
- package/dist/cjs/ui/create-form/main.compiled.css +9 -0
- package/dist/cjs/ui/create-form/main.js +26 -21
- package/dist/cjs/ui/create-form/old/main.js +177 -0
- package/dist/cjs/ui/create-form/select/main.js +41 -20
- package/dist/cjs/ui/create-form/select/old/main.js +127 -0
- package/dist/cjs/ui/create-form/textfield/main.js +14 -13
- package/dist/cjs/ui/create-form/textfield/old/main.js +55 -0
- package/dist/cjs/ui/create-form/user-picker/main.js +14 -13
- package/dist/cjs/ui/create-form/user-picker/old/main.js +72 -0
- package/dist/cjs/ui/inline-create/index.js +17 -14
- package/dist/cjs/ui/inline-create/main.js +21 -19
- package/dist/cjs/ui/inline-create/old/index.js +38 -0
- package/dist/cjs/ui/inline-create/old/main.js +120 -0
- package/dist/cjs/ui/modal-create/index.js +19 -16
- package/dist/cjs/ui/modal-create/main.js +26 -23
- package/dist/cjs/ui/modal-create/old/index.js +44 -0
- package/dist/cjs/ui/modal-create/old/main.js +164 -0
- package/dist/es2019/common/constants.js +4 -1
- package/dist/es2019/common/ui/error-boundary-modal/index.js +12 -9
- package/dist/es2019/common/ui/error-boundary-modal/old/index.js +26 -0
- package/dist/es2019/common/ui/error-boundary-ui/error-svg/index.compiled.css +6 -0
- package/dist/es2019/common/ui/error-boundary-ui/error-svg/index.js +24 -23
- package/dist/es2019/common/ui/error-boundary-ui/error-svg/old/index.js +58 -0
- package/dist/es2019/common/ui/icon/index.compiled.css +7 -0
- package/dist/es2019/common/ui/icon/index.js +23 -18
- package/dist/es2019/common/ui/icon/old/index.js +18 -0
- package/dist/es2019/common/ui/message/index.compiled.css +11 -0
- package/dist/es2019/common/ui/message/index.js +30 -39
- package/dist/es2019/common/ui/message/old/index.js +74 -0
- package/dist/es2019/common/ui/modal-hero/index.js +10 -2
- package/dist/es2019/common/ui/modal-hero/old/index.js +19 -0
- package/dist/es2019/controllers/create-field/main.compiled.css +1 -0
- package/dist/es2019/controllers/create-field/main.js +26 -23
- package/dist/es2019/controllers/create-field/old/main.js +74 -0
- package/dist/es2019/ui/create-form/async-select/main.js +12 -11
- package/dist/es2019/ui/create-form/async-select/old/main.js +137 -0
- package/dist/es2019/ui/create-form/form-footer/main.compiled.css +5 -0
- package/dist/es2019/ui/create-form/form-footer/main.js +25 -27
- package/dist/es2019/ui/create-form/form-footer/old/main.js +57 -0
- package/dist/es2019/ui/create-form/form-loader/main.compiled.css +4 -0
- package/dist/es2019/ui/create-form/form-loader/main.js +19 -20
- package/dist/es2019/ui/create-form/form-loader/old/main.js +31 -0
- package/dist/es2019/ui/create-form/main.compiled.css +9 -0
- package/dist/es2019/ui/create-form/main.js +23 -23
- package/dist/es2019/ui/create-form/old/main.js +145 -0
- package/dist/es2019/ui/create-form/select/main.js +42 -22
- package/dist/es2019/ui/create-form/select/old/main.js +106 -0
- package/dist/es2019/ui/create-form/textfield/main.js +14 -12
- package/dist/es2019/ui/create-form/textfield/old/main.js +45 -0
- package/dist/es2019/ui/create-form/user-picker/main.js +14 -12
- package/dist/es2019/ui/create-form/user-picker/old/main.js +59 -0
- package/dist/es2019/ui/inline-create/index.js +14 -13
- package/dist/es2019/ui/inline-create/main.js +21 -18
- package/dist/es2019/ui/inline-create/old/index.js +30 -0
- package/dist/es2019/ui/inline-create/old/main.js +96 -0
- package/dist/es2019/ui/modal-create/index.js +16 -15
- package/dist/es2019/ui/modal-create/main.js +23 -22
- package/dist/es2019/ui/modal-create/old/index.js +36 -0
- package/dist/es2019/ui/modal-create/old/main.js +137 -0
- package/dist/esm/common/constants.js +4 -1
- package/dist/esm/common/ui/error-boundary-modal/index.js +12 -9
- package/dist/esm/common/ui/error-boundary-modal/old/index.js +25 -0
- package/dist/esm/common/ui/error-boundary-ui/error-svg/index.compiled.css +6 -0
- package/dist/esm/common/ui/error-boundary-ui/error-svg/index.js +28 -24
- package/dist/esm/common/ui/error-boundary-ui/error-svg/old/index.js +60 -0
- package/dist/esm/common/ui/icon/index.compiled.css +7 -0
- package/dist/esm/common/ui/icon/index.js +23 -18
- package/dist/esm/common/ui/icon/old/index.js +18 -0
- package/dist/esm/common/ui/message/index.compiled.css +11 -0
- package/dist/esm/common/ui/message/index.js +30 -39
- package/dist/esm/common/ui/message/old/index.js +73 -0
- package/dist/esm/common/ui/modal-hero/index.js +10 -2
- package/dist/esm/common/ui/modal-hero/old/index.js +18 -0
- package/dist/esm/controllers/create-field/main.compiled.css +1 -0
- package/dist/esm/controllers/create-field/main.js +25 -22
- package/dist/esm/controllers/create-field/old/main.js +72 -0
- package/dist/esm/ui/create-form/async-select/main.js +12 -11
- package/dist/esm/ui/create-form/async-select/old/main.js +188 -0
- package/dist/esm/ui/create-form/form-footer/main.compiled.css +5 -0
- package/dist/esm/ui/create-form/form-footer/main.js +24 -26
- package/dist/esm/ui/create-form/form-footer/old/main.js +56 -0
- package/dist/esm/ui/create-form/form-loader/main.compiled.css +4 -0
- package/dist/esm/ui/create-form/form-loader/main.js +18 -19
- package/dist/esm/ui/create-form/form-loader/old/main.js +31 -0
- package/dist/esm/ui/create-form/main.compiled.css +9 -0
- package/dist/esm/ui/create-form/main.js +23 -23
- package/dist/esm/ui/create-form/old/main.js +174 -0
- package/dist/esm/ui/create-form/select/main.js +41 -21
- package/dist/esm/ui/create-form/select/old/main.js +117 -0
- package/dist/esm/ui/create-form/textfield/main.js +13 -11
- package/dist/esm/ui/create-form/textfield/old/main.js +47 -0
- package/dist/esm/ui/create-form/user-picker/main.js +13 -11
- package/dist/esm/ui/create-form/user-picker/old/main.js +64 -0
- package/dist/esm/ui/inline-create/index.js +14 -13
- package/dist/esm/ui/inline-create/main.js +21 -18
- package/dist/esm/ui/inline-create/old/index.js +30 -0
- package/dist/esm/ui/inline-create/old/main.js +112 -0
- package/dist/esm/ui/modal-create/index.js +16 -15
- package/dist/esm/ui/modal-create/main.js +23 -22
- package/dist/esm/ui/modal-create/old/index.js +36 -0
- package/dist/esm/ui/modal-create/old/main.js +156 -0
- package/dist/types/common/constants.d.ts +3 -0
- package/dist/types/common/ui/Button/index.d.ts +8 -3
- package/dist/types/common/ui/ModalDialog/index.d.ts +1 -1
- package/dist/types/common/ui/confirm-dismiss-dialog/main.d.ts +2 -2
- package/dist/types/common/ui/edit-modal/index.d.ts +1 -1
- package/dist/types/common/ui/error-boundary/error-boundary-base/index.d.ts +1 -1
- package/dist/types/common/ui/error-boundary/index.d.ts +2 -2
- package/dist/types/common/ui/error-boundary-modal/index.d.ts +2 -2
- package/dist/types/common/ui/error-boundary-modal/old/index.d.ts +11 -0
- package/dist/types/common/ui/error-boundary-ui/error-svg/index.d.ts +2 -6
- package/dist/types/common/ui/error-boundary-ui/error-svg/old/index.d.ts +7 -0
- package/dist/types/common/ui/error-boundary-ui/index.d.ts +2 -2
- package/dist/types/common/ui/experience-tracker/index.d.ts +1 -1
- package/dist/types/common/ui/icon/index.d.ts +10 -6
- package/dist/types/common/ui/icon/old/index.d.ts +7 -0
- package/dist/types/common/ui/link-create-content/index.d.ts +2 -2
- package/dist/types/common/ui/message/index.d.ts +1 -2
- package/dist/types/common/ui/message/old/index.d.ts +15 -0
- package/dist/types/common/ui/modal-hero/index.d.ts +4 -2
- package/dist/types/common/ui/modal-hero/old/index.d.ts +4 -0
- package/dist/types/controllers/callback-context/main.d.ts +2 -2
- package/dist/types/controllers/create-field/main.d.ts +2 -2
- package/dist/types/controllers/create-field/old/main.d.ts +7 -0
- package/dist/types/controllers/edit-post-create-context/index.d.ts +1 -1
- package/dist/types/controllers/exit-warning-modal-context/index.d.ts +1 -1
- package/dist/types/controllers/form-context/main.d.ts +2 -2
- package/dist/types/controllers/plugin-context/index.d.ts +1 -1
- package/dist/types/ui/create-form/async-select/main.d.ts +2 -8
- package/dist/types/ui/create-form/async-select/old/main.d.ts +11 -0
- package/dist/types/ui/create-form/form-footer/edit-button/index.d.ts +2 -2
- package/dist/types/ui/create-form/form-footer/main.d.ts +2 -11
- package/dist/types/ui/create-form/form-footer/old/main.d.ts +16 -0
- package/dist/types/ui/create-form/form-footer/submit-button/index.d.ts +2 -2
- package/dist/types/ui/create-form/form-loader/main.d.ts +2 -10
- package/dist/types/ui/create-form/form-loader/old/main.d.ts +11 -0
- package/dist/types/ui/create-form/form-spy/index.d.ts +1 -1
- package/dist/types/ui/create-form/main.d.ts +1 -2
- package/dist/types/ui/create-form/old/main.d.ts +54 -0
- package/dist/types/ui/create-form/select/main.d.ts +5 -16
- package/dist/types/ui/create-form/select/old/main.d.ts +24 -0
- package/dist/types/ui/create-form/textfield/main.d.ts +2 -12
- package/dist/types/ui/create-form/textfield/old/main.d.ts +14 -0
- package/dist/types/ui/create-form/user-picker/main.d.ts +2 -9
- package/dist/types/ui/create-form/user-picker/old/main.d.ts +11 -0
- package/dist/types/ui/inline-create/index.d.ts +2 -3
- package/dist/types/ui/inline-create/inline-analytics/index.d.ts +2 -2
- package/dist/types/ui/inline-create/main.d.ts +2 -6
- package/dist/types/ui/inline-create/old/index.d.ts +5 -0
- package/dist/types/ui/inline-create/old/main.d.ts +8 -0
- package/dist/types/ui/modal-create/index.d.ts +2 -3
- package/dist/types/ui/modal-create/main.d.ts +2 -2
- package/dist/types/ui/modal-create/old/index.d.ts +5 -0
- package/dist/types/ui/modal-create/old/main.d.ts +4 -0
- package/dist/types-ts4.5/common/constants.d.ts +3 -0
- package/dist/types-ts4.5/common/ui/Button/index.d.ts +8 -3
- package/dist/types-ts4.5/common/ui/ModalDialog/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/confirm-dismiss-dialog/main.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/edit-modal/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/error-boundary/error-boundary-base/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/error-boundary/index.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/error-boundary-modal/index.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/error-boundary-modal/old/index.d.ts +11 -0
- package/dist/types-ts4.5/common/ui/error-boundary-ui/error-svg/index.d.ts +2 -6
- package/dist/types-ts4.5/common/ui/error-boundary-ui/error-svg/old/index.d.ts +7 -0
- package/dist/types-ts4.5/common/ui/error-boundary-ui/index.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/experience-tracker/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/icon/index.d.ts +10 -6
- package/dist/types-ts4.5/common/ui/icon/old/index.d.ts +7 -0
- package/dist/types-ts4.5/common/ui/link-create-content/index.d.ts +2 -2
- package/dist/types-ts4.5/common/ui/message/index.d.ts +1 -2
- package/dist/types-ts4.5/common/ui/message/old/index.d.ts +15 -0
- package/dist/types-ts4.5/common/ui/modal-hero/index.d.ts +4 -2
- package/dist/types-ts4.5/common/ui/modal-hero/old/index.d.ts +4 -0
- package/dist/types-ts4.5/controllers/callback-context/main.d.ts +2 -2
- package/dist/types-ts4.5/controllers/create-field/main.d.ts +2 -2
- package/dist/types-ts4.5/controllers/create-field/old/main.d.ts +7 -0
- package/dist/types-ts4.5/controllers/edit-post-create-context/index.d.ts +1 -1
- package/dist/types-ts4.5/controllers/exit-warning-modal-context/index.d.ts +1 -1
- package/dist/types-ts4.5/controllers/form-context/main.d.ts +2 -2
- package/dist/types-ts4.5/controllers/plugin-context/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/create-form/async-select/main.d.ts +2 -8
- package/dist/types-ts4.5/ui/create-form/async-select/old/main.d.ts +11 -0
- package/dist/types-ts4.5/ui/create-form/form-footer/edit-button/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/create-form/form-footer/main.d.ts +2 -11
- package/dist/types-ts4.5/ui/create-form/form-footer/old/main.d.ts +16 -0
- package/dist/types-ts4.5/ui/create-form/form-footer/submit-button/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/create-form/form-loader/main.d.ts +2 -10
- package/dist/types-ts4.5/ui/create-form/form-loader/old/main.d.ts +11 -0
- package/dist/types-ts4.5/ui/create-form/form-spy/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/create-form/main.d.ts +1 -2
- package/dist/types-ts4.5/ui/create-form/old/main.d.ts +56 -0
- package/dist/types-ts4.5/ui/create-form/select/main.d.ts +5 -16
- package/dist/types-ts4.5/ui/create-form/select/old/main.d.ts +24 -0
- package/dist/types-ts4.5/ui/create-form/textfield/main.d.ts +2 -12
- package/dist/types-ts4.5/ui/create-form/textfield/old/main.d.ts +14 -0
- package/dist/types-ts4.5/ui/create-form/user-picker/main.d.ts +2 -9
- package/dist/types-ts4.5/ui/create-form/user-picker/old/main.d.ts +11 -0
- package/dist/types-ts4.5/ui/inline-create/index.d.ts +2 -3
- package/dist/types-ts4.5/ui/inline-create/inline-analytics/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/inline-create/main.d.ts +2 -6
- package/dist/types-ts4.5/ui/inline-create/old/index.d.ts +5 -0
- package/dist/types-ts4.5/ui/inline-create/old/main.d.ts +8 -0
- package/dist/types-ts4.5/ui/modal-create/index.d.ts +2 -3
- package/dist/types-ts4.5/ui/modal-create/main.d.ts +2 -2
- package/dist/types-ts4.5/ui/modal-create/old/index.d.ts +5 -0
- package/dist/types-ts4.5/ui/modal-create/old/main.d.ts +4 -0
- package/example-helpers/mock-disclaimer.tsx +1 -1
- package/package.json +37 -26
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/* eslint-disable @atlassian/tangerine/import/no-parent-imports */
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
import { useCallback } from 'react';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
+
import { css, jsx } from '@emotion/react';
|
|
10
|
+
import { FORM_ERROR } from 'final-form';
|
|
11
|
+
import { Form, FormSpy } from 'react-final-form';
|
|
12
|
+
import { useIntl } from 'react-intl-next';
|
|
13
|
+
import { RequiredAsterisk } from '@atlaskit/form';
|
|
14
|
+
import { Box, Text } from '@atlaskit/primitives';
|
|
15
|
+
import { CREATE_FORM_MAX_WIDTH_IN_PX, LINK_CREATE_FORM_POST_CREATE_FIELD } from '../../../common/constants';
|
|
16
|
+
import messages from '../../../common/messages';
|
|
17
|
+
import { useLinkCreateCallback } from '../../../controllers/callback-context';
|
|
18
|
+
import { useExitWarningModal } from '../../../controllers/exit-warning-modal-context';
|
|
19
|
+
import { useFormContext } from '../../../controllers/form-context';
|
|
20
|
+
import { CreateFormFooter } from '../form-footer';
|
|
21
|
+
import { CreateFormLoader } from '../form-loader';
|
|
22
|
+
const formStyles = css({
|
|
23
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
24
|
+
maxWidth: `${CREATE_FORM_MAX_WIDTH_IN_PX}px`,
|
|
25
|
+
padding: `0 0 ${"var(--ds-space-300, 24px)"} 0`,
|
|
26
|
+
margin: `${"var(--ds-space-0, 0px)"} auto`
|
|
27
|
+
});
|
|
28
|
+
const RESERVED_FIELDS = [LINK_CREATE_FORM_POST_CREATE_FIELD];
|
|
29
|
+
export const TEST_ID = 'link-create-form';
|
|
30
|
+
export const CreateFormOld = ({
|
|
31
|
+
children,
|
|
32
|
+
testId = TEST_ID,
|
|
33
|
+
onSubmit,
|
|
34
|
+
onCancel,
|
|
35
|
+
isLoading,
|
|
36
|
+
hideFooter,
|
|
37
|
+
hideRequiredFieldMessage,
|
|
38
|
+
initialValues
|
|
39
|
+
}) => {
|
|
40
|
+
const {
|
|
41
|
+
setFormErrorMessage,
|
|
42
|
+
formErrorMessage,
|
|
43
|
+
enableEditView
|
|
44
|
+
} = useFormContext();
|
|
45
|
+
const intl = useIntl();
|
|
46
|
+
const {
|
|
47
|
+
setShouldShowWarning
|
|
48
|
+
} = useExitWarningModal();
|
|
49
|
+
const {
|
|
50
|
+
onFailure
|
|
51
|
+
} = useLinkCreateCallback();
|
|
52
|
+
const handleSubmit = useCallback(async data => {
|
|
53
|
+
const {
|
|
54
|
+
[LINK_CREATE_FORM_POST_CREATE_FIELD]: shouldEnableEditView,
|
|
55
|
+
...formData
|
|
56
|
+
} = data;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* If form has post-create field set to trigger post-create edit
|
|
60
|
+
* send this to the form context so we know what to do next
|
|
61
|
+
* if submission is successful
|
|
62
|
+
*/
|
|
63
|
+
enableEditView === null || enableEditView === void 0 ? void 0 : enableEditView(!!shouldEnableEditView);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* This is the onSubmit handler provided by the plugin
|
|
67
|
+
* It will be async, and it will likely involve awaiting `onCreate` (the adopters handler)
|
|
68
|
+
*/
|
|
69
|
+
return onSubmit(formData);
|
|
70
|
+
}, [onSubmit, enableEditView]);
|
|
71
|
+
const handleSubmitWithErrorHandling = useCallback(async (...args) => {
|
|
72
|
+
try {
|
|
73
|
+
/**
|
|
74
|
+
* Clear any error message that may have been set by async select fields
|
|
75
|
+
* This will immediately remove any indication of an error, but the form likely will fail to submit,
|
|
76
|
+
* it will be likely a 400 because the user probably could not set all fields anyway
|
|
77
|
+
*/
|
|
78
|
+
setFormErrorMessage();
|
|
79
|
+
return await handleSubmit(...args);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
/**
|
|
82
|
+
* Notify link create of failed experience
|
|
83
|
+
*/
|
|
84
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure(error);
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Return a generic message for react final form to render
|
|
88
|
+
*/
|
|
89
|
+
return {
|
|
90
|
+
[FORM_ERROR]: intl.formatMessage(messages.genericErrorMessage)
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}, [handleSubmit, setFormErrorMessage, intl, onFailure]);
|
|
94
|
+
const handleCancel = useCallback(() => {
|
|
95
|
+
onCancel && onCancel();
|
|
96
|
+
}, [onCancel]);
|
|
97
|
+
if (isLoading) {
|
|
98
|
+
return jsx(CreateFormLoader, null);
|
|
99
|
+
}
|
|
100
|
+
return jsx(Form, {
|
|
101
|
+
onSubmit: handleSubmitWithErrorHandling,
|
|
102
|
+
initialValues: initialValues,
|
|
103
|
+
mutators: {
|
|
104
|
+
setField: (args, state, tools) => {
|
|
105
|
+
tools.changeValue(state, args[0].toString(), () => args[1]);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, ({
|
|
109
|
+
submitError,
|
|
110
|
+
...formProps
|
|
111
|
+
}) => {
|
|
112
|
+
return jsx("form", {
|
|
113
|
+
onSubmit: formProps.handleSubmit,
|
|
114
|
+
name: "link-create-form",
|
|
115
|
+
noValidate: true,
|
|
116
|
+
"data-testid": testId,
|
|
117
|
+
css: formStyles
|
|
118
|
+
}, jsx(FormSpy, {
|
|
119
|
+
subscription: {
|
|
120
|
+
modified: true
|
|
121
|
+
},
|
|
122
|
+
onChange: state => {
|
|
123
|
+
// determine if any of the fields have been modified
|
|
124
|
+
if (!state.modified) {
|
|
125
|
+
setShouldShowWarning(false);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const isModified = Object.values(state.modified).some(value => value);
|
|
129
|
+
setShouldShowWarning(isModified);
|
|
130
|
+
}
|
|
131
|
+
}), !hideRequiredFieldMessage && jsx(Text, {
|
|
132
|
+
as: "p"
|
|
133
|
+
}, intl.formatMessage(messages.requiredFieldInstruction), " ", jsx(RequiredAsterisk, null)), jsx(Box, null, children), !hideFooter && jsx(CreateFormFooter
|
|
134
|
+
/**
|
|
135
|
+
* We will prefer to render the error message connected to
|
|
136
|
+
* react final form state (submitError) otherwise we can
|
|
137
|
+
* default to the `formErrorMessage` that we sometimes use with our own
|
|
138
|
+
* "form context" (only currently used for AsyncSelect field reporting failed loading)
|
|
139
|
+
*/, {
|
|
140
|
+
formErrorMessage: submitError || formErrorMessage,
|
|
141
|
+
handleCancel: handleCancel,
|
|
142
|
+
testId: testId
|
|
143
|
+
}));
|
|
144
|
+
});
|
|
145
|
+
};
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
* @jsxRuntime classic
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
-
import { jsx } from '@emotion/react';
|
|
2
|
+
import React from 'react';
|
|
9
3
|
import { useIntl } from 'react-intl-next';
|
|
10
|
-
import {
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { Inline } from '@atlaskit/primitives/compiled';
|
|
11
6
|
import AkSelect, { components } from '@atlaskit/select';
|
|
12
7
|
import { layers } from '@atlaskit/theme/constants';
|
|
13
8
|
import { UrlIcon } from '../../../common/ui/icon';
|
|
14
9
|
import { CreateField } from '../../../controllers/create-field';
|
|
15
10
|
import { messages } from './messages';
|
|
11
|
+
import { SelectOld, SitePickerOptionOld, SitePickerSingleValueOld, SiteSelectOld } from './old/main';
|
|
16
12
|
export const TEST_ID = 'link-create-select';
|
|
17
13
|
|
|
18
14
|
/**
|
|
@@ -21,7 +17,7 @@ export const TEST_ID = 'link-create-select';
|
|
|
21
17
|
* errors returned by the handleSubmit function passed to the form <Form> that
|
|
22
18
|
* have a key matching the `name` of this field are shown below the field.
|
|
23
19
|
*/
|
|
24
|
-
|
|
20
|
+
function SelectNew({
|
|
25
21
|
id,
|
|
26
22
|
name,
|
|
27
23
|
label,
|
|
@@ -31,7 +27,7 @@ export function Select({
|
|
|
31
27
|
testId = TEST_ID,
|
|
32
28
|
...restProps
|
|
33
29
|
}) {
|
|
34
|
-
return
|
|
30
|
+
return /*#__PURE__*/React.createElement(CreateField, {
|
|
35
31
|
id: id,
|
|
36
32
|
name: name,
|
|
37
33
|
label: label,
|
|
@@ -44,28 +40,34 @@ export function Select({
|
|
|
44
40
|
isRequired,
|
|
45
41
|
...fieldProps
|
|
46
42
|
}) => {
|
|
47
|
-
return
|
|
43
|
+
return /*#__PURE__*/React.createElement(AkSelect, _extends({
|
|
48
44
|
required: isRequired,
|
|
49
45
|
inputId: fieldId
|
|
50
46
|
}, fieldProps, restProps));
|
|
51
47
|
});
|
|
52
48
|
}
|
|
53
|
-
export
|
|
49
|
+
export function Select(props) {
|
|
50
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
51
|
+
return /*#__PURE__*/React.createElement(SelectNew, props);
|
|
52
|
+
}
|
|
53
|
+
return /*#__PURE__*/React.createElement(SelectOld, props);
|
|
54
|
+
}
|
|
55
|
+
const SiteSelectNew = ({
|
|
54
56
|
options,
|
|
55
57
|
name,
|
|
56
58
|
testId
|
|
57
59
|
}) => {
|
|
58
60
|
const intl = useIntl();
|
|
59
61
|
const siteTestId = testId ? testId : 'link-create-site-picker';
|
|
60
|
-
return
|
|
62
|
+
return /*#__PURE__*/React.createElement(SelectOld, {
|
|
61
63
|
isRequired: true,
|
|
62
64
|
isSearchable: true,
|
|
63
65
|
name: name !== null && name !== void 0 ? name : 'site',
|
|
64
66
|
options: options,
|
|
65
67
|
label: intl.formatMessage(messages.siteLabel),
|
|
66
68
|
components: {
|
|
67
|
-
Option:
|
|
68
|
-
SingleValue:
|
|
69
|
+
Option: SitePickerOptionNew,
|
|
70
|
+
SingleValue: SitePickerSingleValueNew
|
|
69
71
|
},
|
|
70
72
|
testId: siteTestId,
|
|
71
73
|
styles: {
|
|
@@ -82,24 +84,42 @@ export const SiteSelect = ({
|
|
|
82
84
|
}
|
|
83
85
|
});
|
|
84
86
|
};
|
|
87
|
+
export const SiteSelect = props => {
|
|
88
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
89
|
+
return /*#__PURE__*/React.createElement(SiteSelectNew, props);
|
|
90
|
+
}
|
|
91
|
+
return /*#__PURE__*/React.createElement(SiteSelectOld, props);
|
|
92
|
+
};
|
|
85
93
|
const SiteRow = ({
|
|
86
94
|
avatarUrl,
|
|
87
95
|
children
|
|
88
|
-
}) =>
|
|
96
|
+
}) => /*#__PURE__*/React.createElement(Inline, {
|
|
89
97
|
space: "space.100",
|
|
90
98
|
alignBlock: "center"
|
|
91
|
-
}, avatarUrl ?
|
|
99
|
+
}, avatarUrl ? /*#__PURE__*/React.createElement(UrlIcon, {
|
|
92
100
|
url: avatarUrl
|
|
93
101
|
}) : null, children);
|
|
94
|
-
|
|
102
|
+
const SitePickerOptionNew = ({
|
|
95
103
|
children,
|
|
96
104
|
...props
|
|
97
|
-
}) =>
|
|
105
|
+
}) => /*#__PURE__*/React.createElement(components.Option, props, /*#__PURE__*/React.createElement(SiteRow, {
|
|
98
106
|
avatarUrl: props.data.value.avatarUrl
|
|
99
107
|
}, children));
|
|
100
|
-
export const
|
|
108
|
+
export const SitePickerOption = props => {
|
|
109
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
110
|
+
return /*#__PURE__*/React.createElement(SitePickerOptionNew, props);
|
|
111
|
+
}
|
|
112
|
+
return /*#__PURE__*/React.createElement(SitePickerOptionOld, props);
|
|
113
|
+
};
|
|
114
|
+
const SitePickerSingleValueNew = ({
|
|
101
115
|
children,
|
|
102
116
|
...props
|
|
103
|
-
}) =>
|
|
117
|
+
}) => /*#__PURE__*/React.createElement(components.SingleValue, props, /*#__PURE__*/React.createElement(SiteRow, {
|
|
104
118
|
avatarUrl: props.data.value.avatarUrl
|
|
105
|
-
}, children));
|
|
119
|
+
}, children));
|
|
120
|
+
export const SitePickerSingleValue = props => {
|
|
121
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
122
|
+
return /*#__PURE__*/React.createElement(SitePickerSingleValueNew, props);
|
|
123
|
+
}
|
|
124
|
+
return /*#__PURE__*/React.createElement(SitePickerSingleValueOld, props);
|
|
125
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
+
import { jsx } from '@emotion/react';
|
|
10
|
+
import { useIntl } from 'react-intl-next';
|
|
11
|
+
import { Inline } from '@atlaskit/primitives';
|
|
12
|
+
import AkSelect, { components } from '@atlaskit/select';
|
|
13
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
14
|
+
import { UrlIcon } from '../../../../common/ui/icon';
|
|
15
|
+
import { CreateField } from '../../../../controllers/create-field';
|
|
16
|
+
import { messages } from '../messages';
|
|
17
|
+
export const TEST_ID = 'link-create-select';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A select component utilising the Atlaskit Select and CreateField.
|
|
21
|
+
* Validation is handled by the form on form submission. Any
|
|
22
|
+
* errors returned by the handleSubmit function passed to the form <Form> that
|
|
23
|
+
* have a key matching the `name` of this field are shown below the field.
|
|
24
|
+
*/
|
|
25
|
+
export function SelectOld({
|
|
26
|
+
id,
|
|
27
|
+
name,
|
|
28
|
+
label,
|
|
29
|
+
isRequired,
|
|
30
|
+
validators,
|
|
31
|
+
validationHelpText,
|
|
32
|
+
testId = TEST_ID,
|
|
33
|
+
...restProps
|
|
34
|
+
}) {
|
|
35
|
+
return jsx(CreateField, {
|
|
36
|
+
id: id,
|
|
37
|
+
name: name,
|
|
38
|
+
label: label,
|
|
39
|
+
isRequired: isRequired,
|
|
40
|
+
validators: validators,
|
|
41
|
+
validationHelpText: validationHelpText,
|
|
42
|
+
testId: testId
|
|
43
|
+
}, ({
|
|
44
|
+
fieldId,
|
|
45
|
+
isRequired,
|
|
46
|
+
...fieldProps
|
|
47
|
+
}) => {
|
|
48
|
+
return jsx(AkSelect, _extends({
|
|
49
|
+
required: isRequired,
|
|
50
|
+
inputId: fieldId
|
|
51
|
+
}, fieldProps, restProps));
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export const SiteSelectOld = ({
|
|
55
|
+
options,
|
|
56
|
+
name,
|
|
57
|
+
testId
|
|
58
|
+
}) => {
|
|
59
|
+
const intl = useIntl();
|
|
60
|
+
const siteTestId = testId ? testId : 'link-create-site-picker';
|
|
61
|
+
return jsx(SelectOld, {
|
|
62
|
+
isRequired: true,
|
|
63
|
+
isSearchable: true,
|
|
64
|
+
name: name !== null && name !== void 0 ? name : 'site',
|
|
65
|
+
options: options,
|
|
66
|
+
label: intl.formatMessage(messages.siteLabel),
|
|
67
|
+
components: {
|
|
68
|
+
Option: SitePickerOptionOld,
|
|
69
|
+
SingleValue: SitePickerSingleValueOld
|
|
70
|
+
},
|
|
71
|
+
testId: siteTestId,
|
|
72
|
+
styles: {
|
|
73
|
+
menuPortal: base => ({
|
|
74
|
+
...base,
|
|
75
|
+
zIndex: layers.modal()
|
|
76
|
+
}),
|
|
77
|
+
option: base => ({
|
|
78
|
+
...base,
|
|
79
|
+
display: 'flex',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
cursor: 'pointer'
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const SiteRow = ({
|
|
87
|
+
avatarUrl,
|
|
88
|
+
children
|
|
89
|
+
}) => jsx(Inline, {
|
|
90
|
+
space: "space.100",
|
|
91
|
+
alignBlock: "center"
|
|
92
|
+
}, avatarUrl ? jsx(UrlIcon, {
|
|
93
|
+
url: avatarUrl
|
|
94
|
+
}) : null, children);
|
|
95
|
+
export const SitePickerOptionOld = ({
|
|
96
|
+
children,
|
|
97
|
+
...props
|
|
98
|
+
}) => jsx(components.Option, props, jsx(SiteRow, {
|
|
99
|
+
avatarUrl: props.data.value.avatarUrl
|
|
100
|
+
}, children));
|
|
101
|
+
export const SitePickerSingleValueOld = ({
|
|
102
|
+
children,
|
|
103
|
+
...props
|
|
104
|
+
}) => jsx(components.SingleValue, props, jsx(SiteRow, {
|
|
105
|
+
avatarUrl: props.data.value.avatarUrl
|
|
106
|
+
}, children));
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
4
|
import AkTextfield from '@atlaskit/textfield';
|
|
9
5
|
import { CreateField } from '../../../controllers/create-field';
|
|
6
|
+
import { TextFieldOld } from './old/main';
|
|
10
7
|
export const TEST_ID = 'link-create-text-field';
|
|
11
8
|
|
|
12
9
|
/**
|
|
@@ -15,8 +12,7 @@ export const TEST_ID = 'link-create-text-field';
|
|
|
15
12
|
* the handleSubmit function passed to the form <Form> that have a key matching the `name`
|
|
16
13
|
* of this text field are shown above the field.
|
|
17
14
|
*/
|
|
18
|
-
|
|
19
|
-
export function TextField({
|
|
15
|
+
const TextFieldNew = ({
|
|
20
16
|
id,
|
|
21
17
|
name,
|
|
22
18
|
label,
|
|
@@ -25,8 +21,8 @@ export function TextField({
|
|
|
25
21
|
validationHelpText,
|
|
26
22
|
testId = TEST_ID,
|
|
27
23
|
...restProps
|
|
28
|
-
}) {
|
|
29
|
-
return
|
|
24
|
+
}) => {
|
|
25
|
+
return /*#__PURE__*/React.createElement(CreateField, {
|
|
30
26
|
id: id,
|
|
31
27
|
name: name,
|
|
32
28
|
label: label,
|
|
@@ -38,8 +34,14 @@ export function TextField({
|
|
|
38
34
|
fieldId,
|
|
39
35
|
...fieldProps
|
|
40
36
|
}) => {
|
|
41
|
-
return
|
|
37
|
+
return /*#__PURE__*/React.createElement(AkTextfield, _extends({
|
|
42
38
|
id: fieldId
|
|
43
39
|
}, fieldProps, restProps));
|
|
44
40
|
});
|
|
45
|
-
}
|
|
41
|
+
};
|
|
42
|
+
export const TextField = props => {
|
|
43
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
44
|
+
return /*#__PURE__*/React.createElement(TextFieldNew, props);
|
|
45
|
+
}
|
|
46
|
+
return /*#__PURE__*/React.createElement(TextFieldOld, props);
|
|
47
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/* eslint-disable @atlassian/tangerine/import/no-parent-imports */
|
|
3
|
+
/**
|
|
4
|
+
* @jsxRuntime classic
|
|
5
|
+
* @jsx jsx
|
|
6
|
+
*/
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
+
import { jsx } from '@emotion/react';
|
|
9
|
+
import AkTextfield from '@atlaskit/textfield';
|
|
10
|
+
import { CreateField } from '../../../../controllers/create-field';
|
|
11
|
+
export const TEST_ID = 'link-create-text-field';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A text field utilising the Atlaskit Textfield and CreateField.
|
|
15
|
+
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
16
|
+
* the handleSubmit function passed to the form <Form> that have a key matching the `name`
|
|
17
|
+
* of this text field are shown above the field.
|
|
18
|
+
*/
|
|
19
|
+
export function TextFieldOld({
|
|
20
|
+
id,
|
|
21
|
+
name,
|
|
22
|
+
label,
|
|
23
|
+
isRequired,
|
|
24
|
+
validators,
|
|
25
|
+
validationHelpText,
|
|
26
|
+
testId = TEST_ID,
|
|
27
|
+
...restProps
|
|
28
|
+
}) {
|
|
29
|
+
return jsx(CreateField, {
|
|
30
|
+
id: id,
|
|
31
|
+
name: name,
|
|
32
|
+
label: label,
|
|
33
|
+
isRequired: isRequired,
|
|
34
|
+
validators: validators,
|
|
35
|
+
validationHelpText: validationHelpText,
|
|
36
|
+
testId: testId
|
|
37
|
+
}, ({
|
|
38
|
+
fieldId,
|
|
39
|
+
...fieldProps
|
|
40
|
+
}) => {
|
|
41
|
+
return jsx(AkTextfield, _extends({
|
|
42
|
+
id: fieldId
|
|
43
|
+
}, fieldProps, restProps));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
3
|
import SmartUserPicker from '@atlaskit/smart-user-picker';
|
|
8
4
|
import { CreateField } from '../../../controllers/create-field';
|
|
5
|
+
import { UserPickerOld } from './old/main';
|
|
9
6
|
export const TEST_ID = 'link-create-user-picker';
|
|
10
7
|
const DEFAULT_DEBOUNCE_TIME = 400;
|
|
11
8
|
const UserPickerWidth = '100%';
|
|
@@ -13,8 +10,7 @@ const UserPickerWidth = '100%';
|
|
|
13
10
|
/**
|
|
14
11
|
* A user picker utilising the SmartUserPicker.
|
|
15
12
|
*/
|
|
16
|
-
|
|
17
|
-
export function UserPicker({
|
|
13
|
+
const UserPickerNew = ({
|
|
18
14
|
productKey,
|
|
19
15
|
siteId,
|
|
20
16
|
name,
|
|
@@ -23,8 +19,8 @@ export function UserPicker({
|
|
|
23
19
|
validators,
|
|
24
20
|
testId = TEST_ID,
|
|
25
21
|
defaultValue
|
|
26
|
-
}) {
|
|
27
|
-
return
|
|
22
|
+
}) => {
|
|
23
|
+
return /*#__PURE__*/React.createElement(CreateField, {
|
|
28
24
|
name: name,
|
|
29
25
|
label: label,
|
|
30
26
|
isRequired: true,
|
|
@@ -35,7 +31,7 @@ export function UserPicker({
|
|
|
35
31
|
isRequired,
|
|
36
32
|
...fieldProps
|
|
37
33
|
}) => {
|
|
38
|
-
return
|
|
34
|
+
return /*#__PURE__*/React.createElement(SmartUserPicker, {
|
|
39
35
|
defaultValue: defaultValue ? {
|
|
40
36
|
...defaultValue,
|
|
41
37
|
type: 'user'
|
|
@@ -55,4 +51,10 @@ export function UserPicker({
|
|
|
55
51
|
required: isRequired
|
|
56
52
|
});
|
|
57
53
|
});
|
|
58
|
-
}
|
|
54
|
+
};
|
|
55
|
+
export const UserPicker = props => {
|
|
56
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
57
|
+
return /*#__PURE__*/React.createElement(UserPickerNew, props);
|
|
58
|
+
}
|
|
59
|
+
return /*#__PURE__*/React.createElement(UserPickerOld, props);
|
|
60
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { jsx } from '@emotion/react';
|
|
8
|
+
import SmartUserPicker from '@atlaskit/smart-user-picker';
|
|
9
|
+
import { CreateField } from '../../../../controllers/create-field';
|
|
10
|
+
export const TEST_ID = 'link-create-user-picker';
|
|
11
|
+
const DEFAULT_DEBOUNCE_TIME = 400;
|
|
12
|
+
const UserPickerWidth = '100%';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A user picker utilising the SmartUserPicker.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export function UserPickerOld({
|
|
19
|
+
productKey,
|
|
20
|
+
siteId,
|
|
21
|
+
name,
|
|
22
|
+
label,
|
|
23
|
+
placeholder,
|
|
24
|
+
validators,
|
|
25
|
+
testId = TEST_ID,
|
|
26
|
+
defaultValue
|
|
27
|
+
}) {
|
|
28
|
+
return jsx(CreateField, {
|
|
29
|
+
name: name,
|
|
30
|
+
label: label,
|
|
31
|
+
isRequired: true,
|
|
32
|
+
testId: testId,
|
|
33
|
+
validators: validators
|
|
34
|
+
}, ({
|
|
35
|
+
fieldId,
|
|
36
|
+
isRequired,
|
|
37
|
+
...fieldProps
|
|
38
|
+
}) => {
|
|
39
|
+
return jsx(SmartUserPicker, {
|
|
40
|
+
defaultValue: defaultValue ? {
|
|
41
|
+
...defaultValue,
|
|
42
|
+
type: 'user'
|
|
43
|
+
} : undefined,
|
|
44
|
+
placeholder: placeholder,
|
|
45
|
+
onChange: value => fieldProps.onChange(value),
|
|
46
|
+
subtle: true,
|
|
47
|
+
isMulti: false,
|
|
48
|
+
productKey: productKey,
|
|
49
|
+
siteId: siteId,
|
|
50
|
+
fieldId: fieldId,
|
|
51
|
+
inputId: fieldId,
|
|
52
|
+
debounceTime: DEFAULT_DEBOUNCE_TIME,
|
|
53
|
+
prefetch: true,
|
|
54
|
+
isClearable: false,
|
|
55
|
+
width: UserPickerWidth,
|
|
56
|
+
required: isRequired
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { memo } from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
-
import { jsx } from '@emotion/react';
|
|
1
|
+
import React, { memo } from 'react';
|
|
9
2
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
10
3
|
import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
5
|
import { PACKAGE_DATA } from '../../common/constants';
|
|
12
6
|
import { ErrorBoundary } from '../../common/ui/error-boundary';
|
|
13
7
|
import { Experience } from '../../common/ui/experience-tracker';
|
|
@@ -15,15 +9,22 @@ import { withLinkCreateAnalyticsContext } from '../../common/utils/analytics';
|
|
|
15
9
|
import { fetchMessagesForLocale } from '../../common/utils/locale/fetch-messages-for-locale';
|
|
16
10
|
import i18nEN from '../../i18n/en';
|
|
17
11
|
import InlineCreate from './main';
|
|
12
|
+
import ComposedLinkCreateOld from './old';
|
|
18
13
|
const LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(props => {
|
|
19
|
-
return
|
|
14
|
+
return /*#__PURE__*/React.createElement(Experience, null, /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(InlineCreate, props)));
|
|
20
15
|
}));
|
|
21
|
-
const
|
|
22
|
-
return
|
|
16
|
+
const ComposedLinkCreateNew = /*#__PURE__*/memo(props => {
|
|
17
|
+
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
23
18
|
data: PACKAGE_DATA
|
|
24
|
-
},
|
|
19
|
+
}, /*#__PURE__*/React.createElement(IntlMessagesProvider, {
|
|
25
20
|
defaultMessages: i18nEN,
|
|
26
21
|
loaderFn: fetchMessagesForLocale
|
|
27
|
-
},
|
|
22
|
+
}, /*#__PURE__*/React.createElement(LinkCreateWithAnalyticsContext, props)));
|
|
23
|
+
});
|
|
24
|
+
const ComposedLinkCreate = /*#__PURE__*/memo(props => {
|
|
25
|
+
if (fg('platform_bandicoots-link-create-css')) {
|
|
26
|
+
return /*#__PURE__*/React.createElement(ComposedLinkCreateNew, props);
|
|
27
|
+
}
|
|
28
|
+
return /*#__PURE__*/React.createElement(ComposedLinkCreateOld, props);
|
|
28
29
|
});
|
|
29
30
|
export default ComposedLinkCreate;
|