@atlaskit/link-create 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +52 -40
  2. package/dist/cjs/common/constants.js +6 -9
  3. package/dist/cjs/common/utils/analytics/analytics.codegen.js +1 -2
  4. package/dist/cjs/common/utils/analytics/context.js +1 -2
  5. package/dist/cjs/common/utils/form/index.js +2 -3
  6. package/dist/cjs/common/utils/locale/fetch-messages-for-locale.js +2 -3
  7. package/dist/cjs/controllers/callback-context/main.js +3 -5
  8. package/dist/cjs/controllers/form-context/main.js +11 -12
  9. package/dist/cjs/i18n/cs.js +2 -3
  10. package/dist/cjs/i18n/da.js +2 -3
  11. package/dist/cjs/i18n/de.js +2 -3
  12. package/dist/cjs/i18n/en.js +2 -3
  13. package/dist/cjs/i18n/en_GB.js +2 -3
  14. package/dist/cjs/i18n/en_ZZ.js +2 -3
  15. package/dist/cjs/i18n/es.js +2 -3
  16. package/dist/cjs/i18n/fi.js +2 -3
  17. package/dist/cjs/i18n/fr.js +2 -3
  18. package/dist/cjs/i18n/hu.js +2 -3
  19. package/dist/cjs/i18n/it.js +2 -3
  20. package/dist/cjs/i18n/ja.js +2 -3
  21. package/dist/cjs/i18n/ko.js +2 -3
  22. package/dist/cjs/i18n/nb.js +2 -3
  23. package/dist/cjs/i18n/nl.js +2 -3
  24. package/dist/cjs/i18n/pl.js +2 -3
  25. package/dist/cjs/i18n/pt_BR.js +2 -3
  26. package/dist/cjs/i18n/ru.js +2 -3
  27. package/dist/cjs/i18n/sv.js +2 -3
  28. package/dist/cjs/i18n/th.js +2 -3
  29. package/dist/cjs/i18n/tr.js +2 -3
  30. package/dist/cjs/i18n/uk.js +2 -3
  31. package/dist/cjs/i18n/vi.js +2 -3
  32. package/dist/cjs/i18n/zh.js +2 -3
  33. package/dist/cjs/i18n/zh_TW.js +2 -3
  34. package/dist/cjs/ui/create-form/async-select/main.js +1 -2
  35. package/dist/cjs/ui/create-form/form-footer/edit-button/index.js +52 -0
  36. package/dist/cjs/ui/create-form/form-footer/edit-button/messages.js +14 -0
  37. package/dist/cjs/ui/create-form/form-footer/main.js +12 -8
  38. package/dist/cjs/ui/create-form/form-footer/messages.js +2 -3
  39. package/dist/cjs/ui/create-form/form-footer/submit-button/index.js +43 -0
  40. package/dist/cjs/ui/create-form/form-spy/index.js +2 -3
  41. package/dist/cjs/ui/create-form/main.js +3 -5
  42. package/dist/cjs/ui/create-form/select/main.js +1 -2
  43. package/dist/cjs/ui/create-form/textfield/main.js +2 -2
  44. package/dist/cjs/ui/link-create/error-boundary/error-boundary-base/index.js +2 -3
  45. package/dist/cjs/ui/link-create/error-boundary/error-boundary-ui/error-svg/index.js +1 -2
  46. package/dist/cjs/ui/link-create/error-boundary/error-boundary-ui/index.js +3 -5
  47. package/dist/cjs/ui/link-create/error-boundary/error-boundary-ui/messages.js +2 -3
  48. package/dist/cjs/ui/link-create/error-boundary/index.js +4 -5
  49. package/dist/cjs/ui/link-create/main.js +2 -4
  50. package/dist/cjs/ui/link-create/messages.js +2 -3
  51. package/dist/cjs/ui/link-create/track-mount/index.js +1 -2
  52. package/dist/cjs/ui/main.js +4 -6
  53. package/dist/es2019/common/constants.js +2 -1
  54. package/dist/es2019/controllers/form-context/main.js +5 -2
  55. package/dist/es2019/ui/create-form/form-footer/edit-button/index.js +46 -0
  56. package/dist/es2019/ui/create-form/form-footer/edit-button/messages.js +8 -0
  57. package/dist/es2019/ui/create-form/form-footer/main.js +5 -1
  58. package/dist/es2019/ui/create-form/form-footer/submit-button/index.js +35 -0
  59. package/dist/es2019/ui/main.js +2 -2
  60. package/dist/esm/common/constants.js +2 -1
  61. package/dist/esm/controllers/form-context/main.js +6 -3
  62. package/dist/esm/ui/create-form/form-footer/edit-button/index.js +44 -0
  63. package/dist/esm/ui/create-form/form-footer/edit-button/messages.js +8 -0
  64. package/dist/esm/ui/create-form/form-footer/main.js +5 -1
  65. package/dist/esm/ui/create-form/form-footer/submit-button/index.js +34 -0
  66. package/dist/esm/ui/link-create/error-boundary/index.js +2 -2
  67. package/dist/esm/ui/main.js +2 -2
  68. package/dist/types/common/constants.d.ts +1 -0
  69. package/dist/types/controllers/form-context/main.d.ts +9 -1
  70. package/dist/types/ui/create-form/form-footer/edit-button/index.d.ts +2 -0
  71. package/dist/types/ui/create-form/form-footer/edit-button/messages.d.ts +7 -0
  72. package/dist/types/ui/create-form/form-footer/main.d.ts +0 -1
  73. package/dist/types/ui/create-form/form-footer/submit-button/index.d.ts +2 -0
  74. package/dist/types-ts4.5/common/constants.d.ts +1 -0
  75. package/dist/types-ts4.5/controllers/form-context/main.d.ts +9 -1
  76. package/dist/types-ts4.5/ui/create-form/form-footer/edit-button/index.d.ts +2 -0
  77. package/dist/types-ts4.5/ui/create-form/form-footer/edit-button/messages.d.ts +7 -0
  78. package/dist/types-ts4.5/ui/create-form/form-footer/main.d.ts +0 -1
  79. package/dist/types-ts4.5/ui/create-form/form-footer/submit-button/index.d.ts +2 -0
  80. package/package.json +15 -7
@@ -22,13 +22,12 @@ var LinkCreateWithAnalyticsContext = (0, _analytics.withLinkCreateAnalyticsConte
22
22
  var props = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(_ref), _ref));
23
23
  return (0, _react2.jsx)(_linkCreate.default, props);
24
24
  }));
25
- var PACKAGE_DATA = {
26
- packageName: "@atlaskit/link-create",
27
- packageVersion: "1.1.1",
25
+ var PACKAGE_DATA = exports.PACKAGE_DATA = {
26
+ packageName: "@atlaskit/link-create" || '',
27
+ packageVersion: "1.2.0" || '',
28
28
  componentName: _constants.COMPONENT_NAME,
29
29
  source: _constants.COMPONENT_NAME
30
30
  };
31
- exports.PACKAGE_DATA = PACKAGE_DATA;
32
31
  var ComposedLinkCreate = /*#__PURE__*/(0, _react.memo)(function (props) {
33
32
  return (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
34
33
  data: PACKAGE_DATA
@@ -37,5 +36,4 @@ var ComposedLinkCreate = /*#__PURE__*/(0, _react.memo)(function (props) {
37
36
  loaderFn: _fetchMessagesForLocale.fetchMessagesForLocale
38
37
  }, (0, _react2.jsx)(LinkCreateWithAnalyticsContext, props)));
39
38
  });
40
- var _default = ComposedLinkCreate;
41
- exports.default = _default;
39
+ var _default = exports.default = ComposedLinkCreate;
@@ -1,4 +1,5 @@
1
1
  export const ANALYTICS_CHANNEL = 'media';
2
2
  export const COMPONENT_NAME = 'linkCreate';
3
3
  export const CREATE_FORM_MAX_WIDTH_IN_PX = '480';
4
- export const CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
4
+ export const CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
5
+ export const LINK_CREATE_FORM_POST_CREATE_FIELD = '__post_create__';
@@ -2,9 +2,11 @@ import React, { createContext, useCallback, useContext, useState } from 'react';
2
2
  export const FormContext = /*#__PURE__*/createContext({
3
3
  assignValidator: () => {},
4
4
  getValidators: () => ({}),
5
- setFormErrorMessage: () => {}
5
+ setFormErrorMessage: () => {},
6
+ enableEditView: undefined
6
7
  });
7
8
  const FormContextProvider = ({
9
+ enableEditView,
8
10
  children
9
11
  }) => {
10
12
  const [error, setError] = useState();
@@ -32,7 +34,8 @@ const FormContextProvider = ({
32
34
  assignValidator,
33
35
  getValidators,
34
36
  setFormErrorMessage,
35
- formErrorMessage: error
37
+ formErrorMessage: error,
38
+ enableEditView
36
39
  }
37
40
  }, children);
38
41
  };
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import { useForm, useFormState } from 'react-final-form';
3
+ import { useIntl } from 'react-intl-next';
4
+ import LoadingButton from '@atlaskit/button/loading-button';
5
+ import { LINK_CREATE_FORM_POST_CREATE_FIELD } from '../../../../common/constants';
6
+ import { useFormContext } from '../../../../controllers/form-context';
7
+ // eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
8
+ import { FormSpy } from '../../form-spy';
9
+ import { messages } from './messages';
10
+ export const EditButton = () => {
11
+ const intl = useIntl();
12
+ const {
13
+ submitting
14
+ } = useFormState();
15
+ const {
16
+ submit,
17
+ mutators
18
+ } = useForm();
19
+ const {
20
+ enableEditView
21
+ } = useFormContext();
22
+ if (!enableEditView) {
23
+ return null;
24
+ }
25
+ return /*#__PURE__*/React.createElement(FormSpy, null, ({
26
+ values
27
+ }) => /*#__PURE__*/React.createElement(LoadingButton, {
28
+ type: "button",
29
+ testId: "link-create-form-button-edit",
30
+ isLoading:
31
+ /**
32
+ * Should only be in a loading state if submitting is because we clicked
33
+ * the edit button
34
+ */
35
+ submitting && values[LINK_CREATE_FORM_POST_CREATE_FIELD] === true,
36
+ onClick: () => {
37
+ var _mutators$setField;
38
+ /**
39
+ * Setting this field to true indicates that the edit button was clicked and that
40
+ * we have the intention of triggering the edit/post create flow
41
+ */
42
+ (_mutators$setField = mutators.setField) === null || _mutators$setField === void 0 ? void 0 : _mutators$setField.call(mutators, LINK_CREATE_FORM_POST_CREATE_FIELD, true);
43
+ submit();
44
+ }
45
+ }, intl.formatMessage(messages.edit)));
46
+ };
@@ -0,0 +1,8 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export const messages = defineMessages({
3
+ edit: {
4
+ id: 'linkCreate.createForm.button.edit',
5
+ defaultMessage: 'Edit',
6
+ description: 'Button to edit the Create object'
7
+ }
8
+ });
@@ -1,10 +1,14 @@
1
1
  /** @jsx jsx */
2
+ import { Fragment } from 'react';
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { useIntl } from 'react-intl-next';
4
5
  import Button, { ButtonGroup } from '@atlaskit/button';
5
6
  import LoadingButton from '@atlaskit/button/loading-button';
6
7
  import ErrorIcon from '@atlaskit/icon/glyph/error';
8
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
+ import { EditButton } from './edit-button';
7
10
  import { messages } from './messages';
11
+ import { SubmitButton } from './submit-button';
8
12
  const formFooterWrapperStyles = css({
9
13
  display: 'flex',
10
14
  marginTop: "var(--ds-space-300, 24px)",
@@ -41,7 +45,7 @@ export function CreateFormFooter({
41
45
  appearance: "subtle",
42
46
  onClick: handleCancel,
43
47
  testId: `${testId}-button-cancel`
44
- }, intl.formatMessage(messages.close)), jsx(LoadingButton, {
48
+ }, intl.formatMessage(messages.close)), getBooleanFF('platform.linking-platform.link-create.enable-edit') ? jsx(Fragment, null, jsx(EditButton, null), jsx(SubmitButton, null)) : jsx(LoadingButton, {
45
49
  type: "submit",
46
50
  appearance: "primary",
47
51
  isLoading: submitting,
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { useForm, useFormState } from 'react-final-form';
3
+ import { useIntl } from 'react-intl-next';
4
+ import LoadingButton from '@atlaskit/button/loading-button';
5
+ import { LINK_CREATE_FORM_POST_CREATE_FIELD } from '../../../../common/constants';
6
+ // eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
7
+ import { FormSpy } from '../../form-spy';
8
+ // eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
9
+ import { messages } from '../messages';
10
+ export const SubmitButton = () => {
11
+ const intl = useIntl();
12
+ const {
13
+ submitting
14
+ } = useFormState();
15
+ const {
16
+ mutators
17
+ } = useForm();
18
+ return /*#__PURE__*/React.createElement(FormSpy, null, ({
19
+ values
20
+ }) => /*#__PURE__*/React.createElement(LoadingButton, {
21
+ type: "submit",
22
+ appearance: "primary",
23
+ isLoading:
24
+ /**
25
+ * Should only be in a loading state if submitting is because we clicked
26
+ * the edit button
27
+ */
28
+ submitting && values[LINK_CREATE_FORM_POST_CREATE_FIELD] === false,
29
+ testId: "link-create-form-button-submit",
30
+ onClick: () => {
31
+ var _mutators$setField;
32
+ (_mutators$setField = mutators.setField) === null || _mutators$setField === void 0 ? void 0 : _mutators$setField.call(mutators, LINK_CREATE_FORM_POST_CREATE_FIELD, false);
33
+ }
34
+ }, intl.formatMessage(messages.create)));
35
+ };
@@ -14,8 +14,8 @@ const LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE
14
14
  return jsx(LinkCreate, props);
15
15
  }));
16
16
  export const PACKAGE_DATA = {
17
- packageName: "@atlaskit/link-create",
18
- packageVersion: "1.1.1",
17
+ packageName: "@atlaskit/link-create" || '',
18
+ packageVersion: "1.2.0" || '',
19
19
  componentName: COMPONENT_NAME,
20
20
  source: COMPONENT_NAME
21
21
  };
@@ -1,4 +1,5 @@
1
1
  export var ANALYTICS_CHANNEL = 'media';
2
2
  export var COMPONENT_NAME = 'linkCreate';
3
3
  export var CREATE_FORM_MAX_WIDTH_IN_PX = '480';
4
- export var CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
4
+ export var CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
5
+ export var LINK_CREATE_FORM_POST_CREATE_FIELD = '__post_create__';
@@ -8,10 +8,12 @@ export var FormContext = /*#__PURE__*/createContext({
8
8
  getValidators: function getValidators() {
9
9
  return {};
10
10
  },
11
- setFormErrorMessage: function setFormErrorMessage() {}
11
+ setFormErrorMessage: function setFormErrorMessage() {},
12
+ enableEditView: undefined
12
13
  });
13
14
  var FormContextProvider = function FormContextProvider(_ref) {
14
- var children = _ref.children;
15
+ var enableEditView = _ref.enableEditView,
16
+ children = _ref.children;
15
17
  var _useState = useState(),
16
18
  _useState2 = _slicedToArray(_useState, 2),
17
19
  error = _useState2[0],
@@ -42,7 +44,8 @@ var FormContextProvider = function FormContextProvider(_ref) {
42
44
  assignValidator: assignValidator,
43
45
  getValidators: getValidators,
44
46
  setFormErrorMessage: setFormErrorMessage,
45
- formErrorMessage: error
47
+ formErrorMessage: error,
48
+ enableEditView: enableEditView
46
49
  }
47
50
  }, children);
48
51
  };
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { useForm, useFormState } from 'react-final-form';
3
+ import { useIntl } from 'react-intl-next';
4
+ import LoadingButton from '@atlaskit/button/loading-button';
5
+ import { LINK_CREATE_FORM_POST_CREATE_FIELD } from '../../../../common/constants';
6
+ import { useFormContext } from '../../../../controllers/form-context';
7
+ // eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
8
+ import { FormSpy } from '../../form-spy';
9
+ import { messages } from './messages';
10
+ export var EditButton = function EditButton() {
11
+ var intl = useIntl();
12
+ var _useFormState = useFormState(),
13
+ submitting = _useFormState.submitting;
14
+ var _useForm = useForm(),
15
+ submit = _useForm.submit,
16
+ mutators = _useForm.mutators;
17
+ var _useFormContext = useFormContext(),
18
+ enableEditView = _useFormContext.enableEditView;
19
+ if (!enableEditView) {
20
+ return null;
21
+ }
22
+ return /*#__PURE__*/React.createElement(FormSpy, null, function (_ref) {
23
+ var values = _ref.values;
24
+ return /*#__PURE__*/React.createElement(LoadingButton, {
25
+ type: "button",
26
+ testId: "link-create-form-button-edit",
27
+ isLoading:
28
+ /**
29
+ * Should only be in a loading state if submitting is because we clicked
30
+ * the edit button
31
+ */
32
+ submitting && values[LINK_CREATE_FORM_POST_CREATE_FIELD] === true,
33
+ onClick: function onClick() {
34
+ var _mutators$setField;
35
+ /**
36
+ * Setting this field to true indicates that the edit button was clicked and that
37
+ * we have the intention of triggering the edit/post create flow
38
+ */
39
+ (_mutators$setField = mutators.setField) === null || _mutators$setField === void 0 || _mutators$setField.call(mutators, LINK_CREATE_FORM_POST_CREATE_FIELD, true);
40
+ submit();
41
+ }
42
+ }, intl.formatMessage(messages.edit));
43
+ });
44
+ };
@@ -0,0 +1,8 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export var messages = defineMessages({
3
+ edit: {
4
+ id: 'linkCreate.createForm.button.edit',
5
+ defaultMessage: 'Edit',
6
+ description: 'Button to edit the Create object'
7
+ }
8
+ });
@@ -1,10 +1,14 @@
1
1
  /** @jsx jsx */
2
+ import { Fragment } from 'react';
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { useIntl } from 'react-intl-next';
4
5
  import Button, { ButtonGroup } from '@atlaskit/button';
5
6
  import LoadingButton from '@atlaskit/button/loading-button';
6
7
  import ErrorIcon from '@atlaskit/icon/glyph/error';
8
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
+ import { EditButton } from './edit-button';
7
10
  import { messages } from './messages';
11
+ import { SubmitButton } from './submit-button';
8
12
  var formFooterWrapperStyles = css({
9
13
  display: 'flex',
10
14
  marginTop: "var(--ds-space-300, 24px)",
@@ -40,7 +44,7 @@ export function CreateFormFooter(_ref) {
40
44
  appearance: "subtle",
41
45
  onClick: handleCancel,
42
46
  testId: "".concat(testId, "-button-cancel")
43
- }, intl.formatMessage(messages.close)), jsx(LoadingButton, {
47
+ }, intl.formatMessage(messages.close)), getBooleanFF('platform.linking-platform.link-create.enable-edit') ? jsx(Fragment, null, jsx(EditButton, null), jsx(SubmitButton, null)) : jsx(LoadingButton, {
44
48
  type: "submit",
45
49
  appearance: "primary",
46
50
  isLoading: submitting,
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { useForm, useFormState } from 'react-final-form';
3
+ import { useIntl } from 'react-intl-next';
4
+ import LoadingButton from '@atlaskit/button/loading-button';
5
+ import { LINK_CREATE_FORM_POST_CREATE_FIELD } from '../../../../common/constants';
6
+ // eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
7
+ import { FormSpy } from '../../form-spy';
8
+ // eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
9
+ import { messages } from '../messages';
10
+ export var SubmitButton = function SubmitButton() {
11
+ var intl = useIntl();
12
+ var _useFormState = useFormState(),
13
+ submitting = _useFormState.submitting;
14
+ var _useForm = useForm(),
15
+ mutators = _useForm.mutators;
16
+ return /*#__PURE__*/React.createElement(FormSpy, null, function (_ref) {
17
+ var values = _ref.values;
18
+ return /*#__PURE__*/React.createElement(LoadingButton, {
19
+ type: "submit",
20
+ appearance: "primary",
21
+ isLoading:
22
+ /**
23
+ * Should only be in a loading state if submitting is because we clicked
24
+ * the edit button
25
+ */
26
+ submitting && values[LINK_CREATE_FORM_POST_CREATE_FIELD] === false,
27
+ testId: "link-create-form-button-submit",
28
+ onClick: function onClick() {
29
+ var _mutators$setField;
30
+ (_mutators$setField = mutators.setField) === null || _mutators$setField === void 0 || _mutators$setField.call(mutators, LINK_CREATE_FORM_POST_CREATE_FIELD, false);
31
+ }
32
+ }, intl.formatMessage(messages.create));
33
+ });
34
+ };
@@ -9,10 +9,10 @@ export var ErrorBoundary = function ErrorBoundary(_ref) {
9
9
  var _useAnalyticsEvents = useAnalyticsEvents(),
10
10
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
11
11
  var handleError = useCallback(function (error, info) {
12
- var _window, _window$navigator, _info$componentStack;
12
+ var _window, _info$componentStack;
13
13
  // Fire Analytics event
14
14
  createAnalyticsEvent(createEventPayload('operational.linkCreate.unhandledErrorCaught', {
15
- browserInfo: ((_window = window) === null || _window === void 0 ? void 0 : (_window$navigator = _window.navigator) === null || _window$navigator === void 0 ? void 0 : _window$navigator.userAgent) || 'unknown',
15
+ browserInfo: ((_window = window) === null || _window === void 0 || (_window = _window.navigator) === null || _window === void 0 ? void 0 : _window.userAgent) || 'unknown',
16
16
  error: error.toString(),
17
17
  componentStack: (_info$componentStack = info === null || info === void 0 ? void 0 : info.componentStack) !== null && _info$componentStack !== void 0 ? _info$componentStack : ''
18
18
  })).fire(ANALYTICS_CHANNEL);
@@ -15,8 +15,8 @@ var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__
15
15
  return jsx(LinkCreate, props);
16
16
  }));
17
17
  export var PACKAGE_DATA = {
18
- packageName: "@atlaskit/link-create",
19
- packageVersion: "1.1.1",
18
+ packageName: "@atlaskit/link-create" || '',
19
+ packageVersion: "1.2.0" || '',
20
20
  componentName: COMPONENT_NAME,
21
21
  source: COMPONENT_NAME
22
22
  };
@@ -2,3 +2,4 @@ export declare const ANALYTICS_CHANNEL = "media";
2
2
  export declare const COMPONENT_NAME = "linkCreate";
3
3
  export declare const CREATE_FORM_MAX_WIDTH_IN_PX = "480";
4
4
  export declare const CREATE_FORM_MIN_HEIGHT_IN_PX = "200";
5
+ export declare const LINK_CREATE_FORM_POST_CREATE_FIELD = "__post_create__";
@@ -5,9 +5,17 @@ interface FormContextType {
5
5
  assignValidator: (name: string, validators: Validator[]) => void;
6
6
  setFormErrorMessage: (errorMessage?: string) => void;
7
7
  formErrorMessage?: string;
8
+ /**
9
+ * Callback that updates link create to tell it that it should/should not open the current plugins
10
+ * edit view after creation. Should be `undefined` if the plugin does not provide an edit view, or if `onComplete`
11
+ * is not defined as a prop at the `LinkCreate` props level
12
+ */
13
+ enableEditView?: ((editButtonClicked: boolean) => void) | undefined;
8
14
  }
9
15
  export declare const FormContext: React.Context<FormContextType>;
10
- declare const FormContextProvider: React.FC<{}>;
16
+ declare const FormContextProvider: React.FC<{
17
+ enableEditView?: (editButtonClicked: boolean) => void;
18
+ }>;
11
19
  declare const useFormContext: () => FormContextType;
12
20
  export { FormContextProvider, useFormContext };
13
21
  export declare const withLinkCreateFormContext: <P extends LinkCreateProps>(WrappedComponent: React.ComponentType<P>) => (props: P) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const EditButton: () => JSX.Element | null;
@@ -0,0 +1,7 @@
1
+ export declare const messages: {
2
+ edit: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ };
@@ -1,4 +1,3 @@
1
- /** @jsx jsx */
2
1
  import { jsx } from '@emotion/react';
3
2
  export interface CreateFormFooterProps {
4
3
  formErrorMessage: string | undefined;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const SubmitButton: () => JSX.Element;
@@ -2,3 +2,4 @@ export declare const ANALYTICS_CHANNEL = "media";
2
2
  export declare const COMPONENT_NAME = "linkCreate";
3
3
  export declare const CREATE_FORM_MAX_WIDTH_IN_PX = "480";
4
4
  export declare const CREATE_FORM_MIN_HEIGHT_IN_PX = "200";
5
+ export declare const LINK_CREATE_FORM_POST_CREATE_FIELD = "__post_create__";
@@ -5,9 +5,17 @@ interface FormContextType {
5
5
  assignValidator: (name: string, validators: Validator[]) => void;
6
6
  setFormErrorMessage: (errorMessage?: string) => void;
7
7
  formErrorMessage?: string;
8
+ /**
9
+ * Callback that updates link create to tell it that it should/should not open the current plugins
10
+ * edit view after creation. Should be `undefined` if the plugin does not provide an edit view, or if `onComplete`
11
+ * is not defined as a prop at the `LinkCreate` props level
12
+ */
13
+ enableEditView?: ((editButtonClicked: boolean) => void) | undefined;
8
14
  }
9
15
  export declare const FormContext: React.Context<FormContextType>;
10
- declare const FormContextProvider: React.FC<{}>;
16
+ declare const FormContextProvider: React.FC<{
17
+ enableEditView?: (editButtonClicked: boolean) => void;
18
+ }>;
11
19
  declare const useFormContext: () => FormContextType;
12
20
  export { FormContextProvider, useFormContext };
13
21
  export declare const withLinkCreateFormContext: <P extends LinkCreateProps>(WrappedComponent: React.ComponentType<P>) => (props: P) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const EditButton: () => JSX.Element | null;
@@ -0,0 +1,7 @@
1
+ export declare const messages: {
2
+ edit: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ };
@@ -1,4 +1,3 @@
1
- /** @jsx jsx */
2
1
  import { jsx } from '@emotion/react';
3
2
  export interface CreateFormFooterProps {
4
3
  formErrorMessage: string | undefined;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const SubmitButton: () => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "The driver component of meta creation flow",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,16 +35,17 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@atlaskit/analytics-next": "^9.1.0",
38
- "@atlaskit/button": "^16.10.0",
38
+ "@atlaskit/button": "^16.12.0",
39
39
  "@atlaskit/empty-state": "^7.6.0",
40
40
  "@atlaskit/form": "^8.11.0",
41
41
  "@atlaskit/icon": "^21.12.0",
42
42
  "@atlaskit/intl-messages-provider": "^1.0.0",
43
- "@atlaskit/modal-dialog": "^12.7.0",
43
+ "@atlaskit/modal-dialog": "^12.8.0",
44
+ "@atlaskit/platform-feature-flags": "^0.2.1",
44
45
  "@atlaskit/select": "^16.7.0",
45
- "@atlaskit/spinner": "^15.4.0",
46
+ "@atlaskit/spinner": "^15.6.0",
46
47
  "@atlaskit/textfield": "^5.6.0",
47
- "@atlaskit/tokens": "^1.25.0",
48
+ "@atlaskit/tokens": "^1.28.0",
48
49
  "@babel/runtime": "^7.0.0",
49
50
  "@emotion/react": "^11.7.1",
50
51
  "debounce-promise": "^3.1.2",
@@ -57,11 +58,13 @@
57
58
  },
58
59
  "devDependencies": {
59
60
  "@af/visual-regression": "*",
60
- "@atlaskit/link-test-helpers": "^6.1.0",
61
+ "@atlaskit/link-test-helpers": "^6.2.0",
61
62
  "@atlaskit/visual-regression": "*",
62
63
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
64
+ "@atlassian/feature-flags-test-utils": "^0.1.2",
63
65
  "@testing-library/react": "^12.1.5",
64
66
  "@testing-library/user-event": "^14.4.3",
67
+ "@types/debounce-promise": "^3.1.2",
65
68
  "fetch-mock": "^8.0.0",
66
69
  "react-dom": "^16.8.0",
67
70
  "typescript": "~4.9.5",
@@ -106,5 +109,10 @@
106
109
  ]
107
110
  }
108
111
  },
109
- "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
112
+ "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
113
+ "platform-feature-flags": {
114
+ "platform.linking-platform.link-create.enable-edit": {
115
+ "type": "boolean"
116
+ }
117
+ }
110
118
  }