@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,145 +0,0 @@
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,106 +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
-
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,45 +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
- // 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,59 +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 { 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,30 +0,0 @@
1
- /* eslint-disable @atlassian/tangerine/import/no-parent-imports */
2
- /**
3
- * @jsxRuntime classic
4
- * @jsx jsx
5
- */
6
- import { memo } from 'react';
7
-
8
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
- import { jsx } from '@emotion/react';
10
- import { AnalyticsContext } from '@atlaskit/analytics-next';
11
- import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
12
- import { PACKAGE_DATA } from '../../../common/constants';
13
- import { ErrorBoundary } from '../../../common/ui/error-boundary';
14
- import { Experience } from '../../../common/ui/experience-tracker';
15
- import { withLinkCreateAnalyticsContext } from '../../../common/utils/analytics';
16
- import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
17
- import i18nEN from '../../../i18n/en';
18
- import InlineCreate from '../main';
19
- const LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(props => {
20
- return jsx(Experience, null, jsx(ErrorBoundary, null, jsx(InlineCreate, props)));
21
- }));
22
- const ComposedLinkCreateOld = /*#__PURE__*/memo(props => {
23
- return jsx(AnalyticsContext, {
24
- data: PACKAGE_DATA
25
- }, jsx(IntlMessagesProvider, {
26
- defaultMessages: i18nEN,
27
- loaderFn: fetchMessagesForLocale
28
- }, jsx(LinkCreateWithAnalyticsContext, props)));
29
- });
30
- export default ComposedLinkCreateOld;
@@ -1,96 +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
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
- import { jsx } from '@emotion/react';
9
- import { Box } from '@atlaskit/primitives';
10
- import { DEFAULT_TEST_ID, SCREEN_ID } from '../../../common/constants';
11
- import { ConfirmDismissDialog } from '../../../common/ui/confirm-dismiss-dialog';
12
- import { EditModal } from '../../../common/ui/edit-modal';
13
- import { ErrorBoundary } from '../../../common/ui/error-boundary';
14
- import { LinkCreateContent } from '../../../common/ui/link-create-content';
15
- import { LinkCreateCallbackProvider } from '../../../controllers/callback-context';
16
- import { EditPostCreateModalProvider, useEditPostCreateModal } from '../../../controllers/edit-post-create-context';
17
- import { useExitWarningModal } from '../../../controllers/exit-warning-modal-context';
18
- import { FormContextProvider } from '../../../controllers/form-context';
19
- import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../../controllers/plugin-context';
20
- import { InlineAnalytics } from '../inline-analytics';
21
- const InlineCreateContent = ({
22
- onCreate,
23
- onFailure,
24
- onCancel,
25
- onComplete,
26
- plugins,
27
- entityKey,
28
- testId = DEFAULT_TEST_ID
29
- }) => {
30
- const {
31
- withExitWarning,
32
- showExitWarning,
33
- setShowExitWarning
34
- } = useExitWarningModal();
35
- const {
36
- editViewPayload
37
- } = useEditPostCreateModal();
38
- const {
39
- activePlugin
40
- } = useLinkCreatePlugins();
41
- const handleCloseExitWarning = () => setShowExitWarning(false);
42
- return jsx(LinkCreateCallbackProvider, {
43
- onCreate: onCreate,
44
- onFailure: onFailure,
45
- onCancel: withExitWarning(onCancel)
46
- }, jsx(ErrorBoundary, null, jsx(InlineAnalytics, {
47
- screen: SCREEN_ID
48
- }, jsx(Box, {
49
- testId: testId
50
- }, jsx(LinkCreateContent, {
51
- plugins: plugins,
52
- entityKey: entityKey
53
- })))), onComplete && jsx(EditModal, {
54
- onClose: onComplete,
55
- editViewPayload: editViewPayload,
56
- activePlugin: activePlugin
57
- }), jsx(ConfirmDismissDialog, {
58
- active: showExitWarning,
59
- onClose: handleCloseExitWarning,
60
- onCancel: onCancel
61
- }));
62
- };
63
- const InlineCreateOld = props => {
64
- return jsx(LinkCreatePluginsProvider, {
65
- plugins: props.plugins,
66
- entityKey: props.entityKey
67
- }, pluginsProvider => jsx(EditPostCreateModalProvider, {
68
- active: true
69
- }, ({
70
- setEditViewPayload,
71
- shouldActivateEditView,
72
- enableEditView
73
- }) => {
74
- var _pluginsProvider$acti;
75
- return jsx(FormContextProvider, {
76
- 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
77
- }, jsx(InlineCreateContent, _extends({}, props, {
78
- onCreate: async payload => {
79
- var _props$onCreate;
80
- await ((_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload));
81
-
82
- // if onComplete exists then there is an edit flow
83
- if (props.onComplete) {
84
- if (shouldActivateEditView()) {
85
- //edit button is pressed
86
- setEditViewPayload(payload);
87
- } else {
88
- //create button is pressed
89
- props.onComplete();
90
- }
91
- }
92
- }
93
- })));
94
- }));
95
- };
96
- export default InlineCreateOld;
@@ -1,36 +0,0 @@
1
- /* eslint-disable @atlassian/tangerine/import/no-parent-imports */
2
- /**
3
- * @jsxRuntime classic
4
- * @jsx jsx
5
- */
6
- import { memo } from 'react';
7
-
8
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
- import { jsx } from '@emotion/react';
10
- import { AnalyticsContext } from '@atlaskit/analytics-next';
11
- import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
12
- import { PACKAGE_DATA } from '../../../common/constants';
13
- import { ErrorBoundary } from '../../../common/ui/error-boundary';
14
- import { ErrorBoundaryModal } from '../../../common/ui/error-boundary-modal';
15
- import { Experience } from '../../../common/ui/experience-tracker';
16
- import { withLinkCreateAnalyticsContext } from '../../../common/utils/analytics';
17
- import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
18
- import i18nEN from '../../../i18n/en';
19
- import LinkCreate from '../main';
20
- const LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(props => {
21
- return jsx(Experience, null, jsx(ErrorBoundary, {
22
- errorComponent: jsx(ErrorBoundaryModal, {
23
- active: props.active,
24
- onClose: props.onCancel
25
- })
26
- }, jsx(LinkCreate, props)));
27
- }));
28
- const ComposedLinkCreateOld = /*#__PURE__*/memo(props => {
29
- return jsx(AnalyticsContext, {
30
- data: PACKAGE_DATA
31
- }, jsx(IntlMessagesProvider, {
32
- defaultMessages: i18nEN,
33
- loaderFn: fetchMessagesForLocale
34
- }, jsx(LinkCreateWithAnalyticsContext, props)));
35
- });
36
- export default ComposedLinkCreateOld;
@@ -1,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 { useLayoutEffect, useRef } 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 { useIntl } from 'react-intl-next';
12
- import { Layering } from '@atlaskit/layering';
13
- import { ModalBody, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
14
- import { Box } from '@atlaskit/primitives';
15
- import { CREATE_FORM_MAX_WIDTH_IN_PX, DEFAULT_TEST_ID, SCREEN_ID } from '../../../common/constants';
16
- import { ConfirmDismissDialog } from '../../../common/ui/confirm-dismiss-dialog';
17
- import { EditModal } from '../../../common/ui/edit-modal';
18
- import { ErrorBoundary } from '../../../common/ui/error-boundary';
19
- import { LinkCreateContent } from '../../../common/ui/link-create-content';
20
- import { ModalHero } from '../../../common/ui/modal-hero';
21
- import { Modal } from '../../../common/ui/ModalDialog';
22
- import { LinkCreateCallbackProvider } from '../../../controllers/callback-context';
23
- import { EditPostCreateModalProvider, useEditPostCreateModal } from '../../../controllers/edit-post-create-context';
24
- import { ExitWarningModalProvider, useExitWarningModal } from '../../../controllers/exit-warning-modal-context';
25
- import { FormContextProvider } from '../../../controllers/form-context';
26
- import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../../controllers/plugin-context';
27
- import { messages } from '../messages';
28
- const LinkCreateWithModal = ({
29
- active,
30
- modalTitle,
31
- onCreate,
32
- onFailure,
33
- onCancel,
34
- onComplete,
35
- onOpenComplete,
36
- onCloseComplete,
37
- testId = DEFAULT_TEST_ID,
38
- plugins,
39
- entityKey,
40
- modalHero
41
- }) => {
42
- const intl = useIntl();
43
- const {
44
- withExitWarning,
45
- showExitWarning,
46
- setShowExitWarning
47
- } = useExitWarningModal();
48
- const {
49
- editViewPayload
50
- } = useEditPostCreateModal();
51
- const {
52
- activePlugin
53
- } = useLinkCreatePlugins();
54
- const handleCloseExitWarning = () => setShowExitWarning(false);
55
- return jsx(LinkCreateCallbackProvider, {
56
- onCreate: onCreate,
57
- onFailure: onFailure,
58
- onCancel: withExitWarning(onCancel)
59
- }, jsx(ModalTransition, null, active && jsx(Modal, {
60
- testId: "link-create-modal",
61
- screen: SCREEN_ID,
62
- onClose: withExitWarning(onCancel),
63
- shouldScrollInViewport: true,
64
- onOpenComplete: onOpenComplete,
65
- onCloseComplete: onCloseComplete,
66
- width: `${CREATE_FORM_MAX_WIDTH_IN_PX}px`
67
- }, jsx(ModalHero, {
68
- hero: modalHero
69
- }), jsx(ModalHeader, null, jsx(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), jsx(ModalBody, null, jsx(Box, {
70
- testId: testId
71
- }, jsx(ErrorBoundary, null, jsx(LinkCreateContent, {
72
- plugins: plugins,
73
- entityKey: entityKey
74
- })))))), onComplete && jsx(EditModal, {
75
- onCloseComplete: onCloseComplete,
76
- onClose: onComplete,
77
- editViewPayload: editViewPayload,
78
- activePlugin: activePlugin
79
- }), jsx(Layering, {
80
- isDisabled: false
81
- }, jsx(ConfirmDismissDialog, {
82
- active: showExitWarning,
83
- onClose: handleCloseExitWarning,
84
- onCancel: onCancel
85
- })));
86
- };
87
- const LinkCreateModalOld = props => {
88
- const shouldCallCloseComplete = useRef(!props.active);
89
-
90
- // modal calls onCloseComplete in a useEffect(), so we can track whether
91
- // or not we should execute it based on the active prop in a
92
- // useLayoutEffect() which will be run before child useEffect()s
93
- useLayoutEffect(() => {
94
- // onCloseComplete should only be called when it is not active
95
- shouldCallCloseComplete.current = !props.active;
96
- }, [props.active]);
97
- return jsx(LinkCreatePluginsProvider, {
98
- plugins: props.plugins,
99
- entityKey: props.entityKey
100
- }, pluginsProvider => jsx(EditPostCreateModalProvider, {
101
- active: !!props.active
102
- }, ({
103
- setEditViewPayload,
104
- editViewPayload,
105
- shouldActivateEditView,
106
- enableEditView
107
- }) => {
108
- var _pluginsProvider$acti;
109
- return jsx(FormContextProvider, {
110
- 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
111
- }, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
112
- active: props.active && !editViewPayload,
113
- onCreate: async payload => {
114
- var _props$onCreate;
115
- await ((_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload));
116
-
117
- // if onComplete exists then there is an edit flow
118
- if (props.onComplete) {
119
- if (shouldActivateEditView()) {
120
- //edit button is pressed
121
- setEditViewPayload(payload);
122
- } else {
123
- //create button is pressed
124
- props.onComplete();
125
- }
126
- }
127
- },
128
- onCloseComplete: (...args) => {
129
- if (shouldCallCloseComplete.current) {
130
- var _props$onCloseComplet;
131
- (_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 ? void 0 : _props$onCloseComplet.call(props, ...args);
132
- }
133
- }
134
- }))));
135
- }));
136
- };
137
- export default LinkCreateModalOld;
@@ -1,25 +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 var ErrorBoundaryModalOld = function ErrorBoundaryModalOld(_ref) {
17
- var active = _ref.active,
18
- onClose = _ref.onClose;
19
- return jsx(ModalTransition, null, active && jsx(Modal, {
20
- testId: "link-create-error-boundary-modal",
21
- onClose: onClose,
22
- shouldScrollInViewport: true,
23
- width: "".concat(CREATE_FORM_MAX_WIDTH_IN_PX, "px")
24
- }, jsx(ModalBody, null, jsx(ErrorBoundaryUI, null))));
25
- };