@atlaskit/link-create 2.1.0 → 2.3.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 (68) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/common/constants.js +4 -2
  3. package/dist/cjs/index.js +6 -0
  4. package/dist/cjs/ui/create-form/main.js +1 -1
  5. package/dist/cjs/ui/create-form/user-picker/index.js +12 -0
  6. package/dist/cjs/ui/create-form/user-picker/main.js +59 -0
  7. package/dist/cjs/ui/create-form/user-picker/types.js +5 -0
  8. package/dist/cjs/ui/index.js +8 -1
  9. package/dist/cjs/ui/inline-create/inline-analytics/index.js +22 -0
  10. package/dist/cjs/ui/inline-create/main.js +9 -8
  11. package/dist/cjs/ui/modal-create/main.js +3 -5
  12. package/dist/es2019/common/constants.js +3 -1
  13. package/dist/es2019/index.js +2 -2
  14. package/dist/es2019/ui/create-form/main.js +1 -1
  15. package/dist/es2019/ui/create-form/user-picker/index.js +1 -0
  16. package/dist/es2019/ui/create-form/user-picker/main.js +48 -0
  17. package/dist/es2019/ui/create-form/user-picker/types.js +1 -0
  18. package/dist/es2019/ui/index.js +2 -1
  19. package/dist/es2019/ui/inline-create/inline-analytics/index.js +14 -0
  20. package/dist/es2019/ui/inline-create/main.js +8 -10
  21. package/dist/es2019/ui/modal-create/main.js +2 -4
  22. package/dist/esm/common/constants.js +3 -1
  23. package/dist/esm/index.js +2 -2
  24. package/dist/esm/ui/create-form/main.js +1 -1
  25. package/dist/esm/ui/create-form/user-picker/index.js +1 -0
  26. package/dist/esm/ui/create-form/user-picker/main.js +51 -0
  27. package/dist/esm/ui/create-form/user-picker/types.js +1 -0
  28. package/dist/esm/ui/index.js +2 -1
  29. package/dist/esm/ui/inline-create/inline-analytics/index.js +15 -0
  30. package/dist/esm/ui/inline-create/main.js +9 -10
  31. package/dist/esm/ui/modal-create/main.js +2 -4
  32. package/dist/types/common/constants.d.ts +2 -0
  33. package/dist/types/common/ui/confirm-dismiss-dialog/main.d.ts +1 -1
  34. package/dist/types/common/ui/error-boundary/index.d.ts +1 -1
  35. package/dist/types/common/ui/error-boundary-modal/index.d.ts +1 -1
  36. package/dist/types/common/ui/link-create-content/index.d.ts +1 -1
  37. package/dist/types/common/utils/analytics/index.d.ts +1 -1
  38. package/dist/types/controllers/exit-warning-modal-context/index.d.ts +1 -1
  39. package/dist/types/controllers/form-context/index.d.ts +1 -1
  40. package/dist/types/index.d.ts +2 -2
  41. package/dist/types/ui/create-form/form-spy/index.d.ts +1 -1
  42. package/dist/types/ui/create-form/user-picker/index.d.ts +1 -0
  43. package/dist/types/ui/create-form/user-picker/main.d.ts +8 -0
  44. package/dist/types/ui/create-form/user-picker/types.d.ts +25 -0
  45. package/dist/types/ui/index.d.ts +1 -0
  46. package/dist/types/ui/inline-create/inline-analytics/index.d.ts +9 -0
  47. package/dist/types/ui/inline-create/main.d.ts +0 -1
  48. package/dist/types/ui/modal-create/main.d.ts +0 -1
  49. package/dist/types-ts4.5/common/constants.d.ts +2 -0
  50. package/dist/types-ts4.5/common/ui/confirm-dismiss-dialog/main.d.ts +1 -1
  51. package/dist/types-ts4.5/common/ui/error-boundary/index.d.ts +1 -1
  52. package/dist/types-ts4.5/common/ui/error-boundary-modal/index.d.ts +1 -1
  53. package/dist/types-ts4.5/common/ui/link-create-content/index.d.ts +1 -1
  54. package/dist/types-ts4.5/common/utils/analytics/index.d.ts +1 -1
  55. package/dist/types-ts4.5/controllers/exit-warning-modal-context/index.d.ts +1 -1
  56. package/dist/types-ts4.5/controllers/form-context/index.d.ts +1 -1
  57. package/dist/types-ts4.5/index.d.ts +2 -2
  58. package/dist/types-ts4.5/ui/create-form/form-spy/index.d.ts +1 -1
  59. package/dist/types-ts4.5/ui/create-form/user-picker/index.d.ts +1 -0
  60. package/dist/types-ts4.5/ui/create-form/user-picker/main.d.ts +8 -0
  61. package/dist/types-ts4.5/ui/create-form/user-picker/types.d.ts +25 -0
  62. package/dist/types-ts4.5/ui/index.d.ts +1 -0
  63. package/dist/types-ts4.5/ui/inline-create/inline-analytics/index.d.ts +9 -0
  64. package/dist/types-ts4.5/ui/inline-create/main.d.ts +0 -1
  65. package/dist/types-ts4.5/ui/modal-create/main.d.ts +0 -1
  66. package/example-helpers/mock-disclaimer.tsx +11 -11
  67. package/example-helpers/mock-plugin-form.tsx +71 -74
  68. package/package.json +3 -2
@@ -6,21 +6,17 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  import { useCallback, useState } from 'react';
7
7
  import { jsx } from '@emotion/react';
8
8
  import { Box } from '@atlaskit/primitives';
9
+ import { DEFAULT_TEST_ID, SCREEN_ID } from '../../common/constants';
9
10
  import { ConfirmDismissDialog } from '../../common/ui/confirm-dismiss-dialog';
10
11
  import { EditModal } from '../../common/ui/edit-modal';
11
12
  import { ErrorBoundary } from '../../common/ui/error-boundary';
12
13
  import { LinkCreateContent } from '../../common/ui/link-create-content';
13
- import { LinkCreateCallbackProvider
14
- // useLinkCreateCallback,
15
- } from '../../controllers/callback-context';
14
+ import { LinkCreateCallbackProvider } from '../../controllers/callback-context';
16
15
  import { EditPostCreateModalProvider, useEditPostCreateModal } from '../../controllers/edit-post-create-context';
17
16
  import { ExitWarningModalProvider, useExitWarningModal } from '../../controllers/exit-warning-modal-context';
18
17
  import { FormContextProvider } from '../../controllers/form-context';
19
18
  import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../controllers/plugin-context';
20
- export var TEST_ID = 'link-create';
21
- // todo: EDM-10075 trigger the screen.viewed_linkCreateScreen event when inline-create is mounted
22
- // const SCREEN_ID = 'linkCreateScreen';
23
-
19
+ import { InlineAnalytics } from './inline-analytics';
24
20
  var InlineCreateContent = function InlineCreateContent(_ref) {
25
21
  var onCreate = _ref.onCreate,
26
22
  onFailure = _ref.onFailure,
@@ -28,7 +24,8 @@ var InlineCreateContent = function InlineCreateContent(_ref) {
28
24
  onComplete = _ref.onComplete,
29
25
  plugins = _ref.plugins,
30
26
  entityKey = _ref.entityKey,
31
- testId = _ref.testId;
27
+ _ref$testId = _ref.testId,
28
+ testId = _ref$testId === void 0 ? DEFAULT_TEST_ID : _ref$testId;
32
29
  var _useExitWarningModal = useExitWarningModal(),
33
30
  getShouldShowWarning = _useExitWarningModal.getShouldShowWarning;
34
31
  var _useState = useState(false),
@@ -53,12 +50,14 @@ var InlineCreateContent = function InlineCreateContent(_ref) {
53
50
  onCreate: onCreate,
54
51
  onFailure: onFailure,
55
52
  onCancel: handleCancel
56
- }, jsx(ErrorBoundary, null, jsx(Box, {
53
+ }, jsx(ErrorBoundary, null, jsx(InlineAnalytics, {
54
+ screen: SCREEN_ID
55
+ }, jsx(Box, {
57
56
  testId: testId
58
57
  }, jsx(LinkCreateContent, {
59
58
  plugins: plugins,
60
59
  entityKey: entityKey
61
- }))), onComplete && jsx(EditModal, {
60
+ })))), onComplete && jsx(EditModal, {
62
61
  onClose: onComplete,
63
62
  editViewPayload: editViewPayload,
64
63
  activePlugin: activePlugin
@@ -8,7 +8,7 @@ import { jsx } from '@emotion/react';
8
8
  import { useIntl } from 'react-intl-next';
9
9
  import { ModalBody, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
10
10
  import { Box } from '@atlaskit/primitives';
11
- import { CREATE_FORM_MAX_WIDTH_IN_PX } from '../../common/constants';
11
+ import { CREATE_FORM_MAX_WIDTH_IN_PX, DEFAULT_TEST_ID, SCREEN_ID } from '../../common/constants';
12
12
  import { ConfirmDismissDialog } from '../../common/ui/confirm-dismiss-dialog';
13
13
  import { EditModal } from '../../common/ui/edit-modal';
14
14
  import { ErrorBoundary } from '../../common/ui/error-boundary';
@@ -21,8 +21,6 @@ import { ExitWarningModalProvider, useExitWarningModal } from '../../controllers
21
21
  import { FormContextProvider } from '../../controllers/form-context';
22
22
  import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../controllers/plugin-context';
23
23
  import { messages } from './messages';
24
- export var TEST_ID = 'link-create';
25
- var SCREEN_ID = 'linkCreateScreen';
26
24
  var LinkCreateWithModal = function LinkCreateWithModal(_ref) {
27
25
  var active = _ref.active,
28
26
  modalTitle = _ref.modalTitle,
@@ -33,7 +31,7 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref) {
33
31
  onOpenComplete = _ref.onOpenComplete,
34
32
  onCloseComplete = _ref.onCloseComplete,
35
33
  _ref$testId = _ref.testId,
36
- testId = _ref$testId === void 0 ? TEST_ID : _ref$testId,
34
+ testId = _ref$testId === void 0 ? DEFAULT_TEST_ID : _ref$testId,
37
35
  plugins = _ref.plugins,
38
36
  entityKey = _ref.entityKey,
39
37
  modalHero = _ref.modalHero;
@@ -1,6 +1,8 @@
1
1
  import type { PackageMetaDataType } from './utils/analytics/analytics.codegen';
2
2
  export declare const ANALYTICS_CHANNEL = "media";
3
3
  export declare const COMPONENT_NAME = "linkCreate";
4
+ export declare const SCREEN_ID = "linkCreateScreen";
5
+ export declare const DEFAULT_TEST_ID = "link-create";
4
6
  export declare const CREATE_FORM_MAX_WIDTH_IN_PX = "480";
5
7
  export declare const CREATE_FORM_MIN_HEIGHT_IN_PX = "200";
6
8
  export declare const LINK_CREATE_FORM_POST_CREATE_FIELD = "__post_create__";
@@ -4,4 +4,4 @@ export type ConfirmDismissDialogProps = {
4
4
  onClose: () => void;
5
5
  onCancel?: () => void;
6
6
  };
7
- export declare const ConfirmDismissDialog: ({ active, onClose, onCancel, }: ConfirmDismissDialogProps) => JSX.Element;
7
+ export declare const ConfirmDismissDialog: ({ active, onClose, onCancel }: ConfirmDismissDialogProps) => JSX.Element;
@@ -2,5 +2,5 @@ import { type PropsWithChildren } from 'react';
2
2
  type ErrorBoundaryProps = PropsWithChildren<{
3
3
  errorComponent?: JSX.Element;
4
4
  }>;
5
- export declare const ErrorBoundary: ({ children, errorComponent, }: ErrorBoundaryProps) => JSX.Element;
5
+ export declare const ErrorBoundary: ({ children, errorComponent }: ErrorBoundaryProps) => JSX.Element;
6
6
  export {};
@@ -7,5 +7,5 @@ type ErrorBoundaryModalProps = {
7
7
  active?: boolean;
8
8
  onClose?: () => void;
9
9
  };
10
- export declare const ErrorBoundaryModal: React.FC<ErrorBoundaryModalProps>;
10
+ export declare const ErrorBoundaryModal: ({ active, onClose }: ErrorBoundaryModalProps) => JSX.Element;
11
11
  export {};
@@ -4,5 +4,5 @@ type LinkCreateContentProps = {
4
4
  plugins: LinkCreatePlugin[];
5
5
  entityKey: string;
6
6
  };
7
- export declare const LinkCreateContent: ({ plugins, entityKey, }: LinkCreateContentProps) => JSX.Element;
7
+ export declare const LinkCreateContent: ({ plugins, entityKey }: LinkCreateContentProps) => JSX.Element;
8
8
  export {};
@@ -1 +1 @@
1
- export { useLinkCreateAnalytics, withLinkCreateAnalyticsContext, } from './context';
1
+ export { useLinkCreateAnalytics, withLinkCreateAnalyticsContext } from './context';
@@ -3,7 +3,7 @@ type ExitWarningModalContextValue = {
3
3
  getShouldShowWarning: () => boolean;
4
4
  setShouldShowWarning: (show: boolean) => void;
5
5
  };
6
- export declare const ExitWarningModalProvider: ({ children, }: {
6
+ export declare const ExitWarningModalProvider: ({ children }: {
7
7
  children: React.ReactNode;
8
8
  }) => JSX.Element;
9
9
  export declare const useExitWarningModal: () => ExitWarningModalContextValue;
@@ -1 +1 @@
1
- export { FormContextProvider, useFormContext, withLinkCreateFormContext, } from './main';
1
+ export { FormContextProvider, useFormContext, withLinkCreateFormContext } from './main';
@@ -1,6 +1,6 @@
1
1
  export type { CreateFormProps } from './ui/index';
2
2
  export type { LinkCreateProps, LinkCreatePlugin, LinkCreateWithModalProps, CreatePayload, EditViewProps, } from './common/types';
3
- export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy, } from './ui/index';
4
- export { useLinkCreateCallback, LinkCreateCallbackProvider, } from './controllers/callback-context';
3
+ export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy, UserPicker, } from './ui/index';
4
+ export { useLinkCreateCallback, LinkCreateCallbackProvider } from './controllers/callback-context';
5
5
  export type { Validator, ValidatorMap } from './common/types';
6
6
  export { FORM_ERROR } from 'final-form';
@@ -9,4 +9,4 @@ export type FormSpyProps<T> = {
9
9
  * FormSpy component so that we can control selectively
10
10
  * how much of the API we are commited to.
11
11
  */
12
- export declare const FormSpy: <T extends Record<string, unknown>>({ children, }: FormSpyProps<T>) => JSX.Element;
12
+ export declare const FormSpy: <T extends Record<string, unknown>>({ children }: FormSpyProps<T>) => JSX.Element;
@@ -0,0 +1 @@
1
+ export { UserPicker } from './main';
@@ -0,0 +1,8 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { type UserPickerProps } from './types';
4
+ export declare const TEST_ID = "link-create-user-picker";
5
+ /**
6
+ * A user picker utilising the SmartUserPicker.
7
+ */
8
+ export declare function UserPicker({ productKey, siteId, name, label, placeholder, validators, testId, defaultValue, }: UserPickerProps): jsx.JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { type Validator } from '../../../common/types';
2
+ export type UserPickerProps = {
3
+ /** Name to pass into the <Field> */
4
+ name: string;
5
+ /** Refers to a product identifier, Jira, Confluence, Townsquare, ect. */
6
+ productKey: string;
7
+ /** Identifier for the product's tenant, also known as tenantId or cloudId */
8
+ siteId: string;
9
+ /** The label text above the component */
10
+ label?: string;
11
+ /** Placeholder text to display in the text field whenever it is empty. */
12
+ placeholder?: string;
13
+ /** Validators for this field */
14
+ validators?: Validator[];
15
+ testId?: string;
16
+ defaultValue: User;
17
+ };
18
+ type User = {
19
+ id: string;
20
+ userId: string;
21
+ name: string;
22
+ avatar: string;
23
+ email: string;
24
+ };
25
+ export {};
@@ -7,3 +7,4 @@ export type { CreateFormProps } from './create-form/main';
7
7
  export { Select } from './create-form/select';
8
8
  export { AsyncSelect } from './create-form/async-select';
9
9
  export { FormSpy } from './create-form/form-spy';
10
+ export { UserPicker } from './create-form/user-picker';
@@ -0,0 +1,9 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ import type { AnalyticsEventAttributes } from '../../../common/utils/analytics/analytics.codegen';
3
+ type InlineAnalyticsProps = {
4
+ screen: keyof {
5
+ [Key in keyof AnalyticsEventAttributes as Key extends `screen.${infer ScreenName}.viewed` ? ScreenName : never]: any;
6
+ };
7
+ };
8
+ export declare const InlineAnalytics: ({ screen, children }: PropsWithChildren<InlineAnalyticsProps>) => JSX.Element;
9
+ export {};
@@ -1,5 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { LinkCreateProps } from '../../common/types';
3
- export declare const TEST_ID = "link-create";
4
3
  declare const InlineCreate: (props: LinkCreateProps) => jsx.JSX.Element;
5
4
  export default InlineCreate;
@@ -1,5 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { LinkCreateWithModalProps } from '../../common/types';
3
- export declare const TEST_ID = "link-create";
4
3
  declare const LinkCreateModal: (props: LinkCreateWithModalProps) => jsx.JSX.Element;
5
4
  export default LinkCreateModal;
@@ -1,6 +1,8 @@
1
1
  import type { PackageMetaDataType } from './utils/analytics/analytics.codegen';
2
2
  export declare const ANALYTICS_CHANNEL = "media";
3
3
  export declare const COMPONENT_NAME = "linkCreate";
4
+ export declare const SCREEN_ID = "linkCreateScreen";
5
+ export declare const DEFAULT_TEST_ID = "link-create";
4
6
  export declare const CREATE_FORM_MAX_WIDTH_IN_PX = "480";
5
7
  export declare const CREATE_FORM_MIN_HEIGHT_IN_PX = "200";
6
8
  export declare const LINK_CREATE_FORM_POST_CREATE_FIELD = "__post_create__";
@@ -4,4 +4,4 @@ export type ConfirmDismissDialogProps = {
4
4
  onClose: () => void;
5
5
  onCancel?: () => void;
6
6
  };
7
- export declare const ConfirmDismissDialog: ({ active, onClose, onCancel, }: ConfirmDismissDialogProps) => JSX.Element;
7
+ export declare const ConfirmDismissDialog: ({ active, onClose, onCancel }: ConfirmDismissDialogProps) => JSX.Element;
@@ -2,5 +2,5 @@ import { type PropsWithChildren } from 'react';
2
2
  type ErrorBoundaryProps = PropsWithChildren<{
3
3
  errorComponent?: JSX.Element;
4
4
  }>;
5
- export declare const ErrorBoundary: ({ children, errorComponent, }: ErrorBoundaryProps) => JSX.Element;
5
+ export declare const ErrorBoundary: ({ children, errorComponent }: ErrorBoundaryProps) => JSX.Element;
6
6
  export {};
@@ -7,5 +7,5 @@ type ErrorBoundaryModalProps = {
7
7
  active?: boolean;
8
8
  onClose?: () => void;
9
9
  };
10
- export declare const ErrorBoundaryModal: React.FC<ErrorBoundaryModalProps>;
10
+ export declare const ErrorBoundaryModal: ({ active, onClose }: ErrorBoundaryModalProps) => JSX.Element;
11
11
  export {};
@@ -4,5 +4,5 @@ type LinkCreateContentProps = {
4
4
  plugins: LinkCreatePlugin[];
5
5
  entityKey: string;
6
6
  };
7
- export declare const LinkCreateContent: ({ plugins, entityKey, }: LinkCreateContentProps) => JSX.Element;
7
+ export declare const LinkCreateContent: ({ plugins, entityKey }: LinkCreateContentProps) => JSX.Element;
8
8
  export {};
@@ -1 +1 @@
1
- export { useLinkCreateAnalytics, withLinkCreateAnalyticsContext, } from './context';
1
+ export { useLinkCreateAnalytics, withLinkCreateAnalyticsContext } from './context';
@@ -3,7 +3,7 @@ type ExitWarningModalContextValue = {
3
3
  getShouldShowWarning: () => boolean;
4
4
  setShouldShowWarning: (show: boolean) => void;
5
5
  };
6
- export declare const ExitWarningModalProvider: ({ children, }: {
6
+ export declare const ExitWarningModalProvider: ({ children }: {
7
7
  children: React.ReactNode;
8
8
  }) => JSX.Element;
9
9
  export declare const useExitWarningModal: () => ExitWarningModalContextValue;
@@ -1 +1 @@
1
- export { FormContextProvider, useFormContext, withLinkCreateFormContext, } from './main';
1
+ export { FormContextProvider, useFormContext, withLinkCreateFormContext } from './main';
@@ -1,6 +1,6 @@
1
1
  export type { CreateFormProps } from './ui/index';
2
2
  export type { LinkCreateProps, LinkCreatePlugin, LinkCreateWithModalProps, CreatePayload, EditViewProps, } from './common/types';
3
- export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy, } from './ui/index';
4
- export { useLinkCreateCallback, LinkCreateCallbackProvider, } from './controllers/callback-context';
3
+ export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy, UserPicker, } from './ui/index';
4
+ export { useLinkCreateCallback, LinkCreateCallbackProvider } from './controllers/callback-context';
5
5
  export type { Validator, ValidatorMap } from './common/types';
6
6
  export { FORM_ERROR } from 'final-form';
@@ -9,4 +9,4 @@ export type FormSpyProps<T> = {
9
9
  * FormSpy component so that we can control selectively
10
10
  * how much of the API we are commited to.
11
11
  */
12
- export declare const FormSpy: <T extends Record<string, unknown>>({ children, }: FormSpyProps<T>) => JSX.Element;
12
+ export declare const FormSpy: <T extends Record<string, unknown>>({ children }: FormSpyProps<T>) => JSX.Element;
@@ -0,0 +1 @@
1
+ export { UserPicker } from './main';
@@ -0,0 +1,8 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { type UserPickerProps } from './types';
4
+ export declare const TEST_ID = "link-create-user-picker";
5
+ /**
6
+ * A user picker utilising the SmartUserPicker.
7
+ */
8
+ export declare function UserPicker({ productKey, siteId, name, label, placeholder, validators, testId, defaultValue, }: UserPickerProps): jsx.JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { type Validator } from '../../../common/types';
2
+ export type UserPickerProps = {
3
+ /** Name to pass into the <Field> */
4
+ name: string;
5
+ /** Refers to a product identifier, Jira, Confluence, Townsquare, ect. */
6
+ productKey: string;
7
+ /** Identifier for the product's tenant, also known as tenantId or cloudId */
8
+ siteId: string;
9
+ /** The label text above the component */
10
+ label?: string;
11
+ /** Placeholder text to display in the text field whenever it is empty. */
12
+ placeholder?: string;
13
+ /** Validators for this field */
14
+ validators?: Validator[];
15
+ testId?: string;
16
+ defaultValue: User;
17
+ };
18
+ type User = {
19
+ id: string;
20
+ userId: string;
21
+ name: string;
22
+ avatar: string;
23
+ email: string;
24
+ };
25
+ export {};
@@ -7,3 +7,4 @@ export type { CreateFormProps } from './create-form/main';
7
7
  export { Select } from './create-form/select';
8
8
  export { AsyncSelect } from './create-form/async-select';
9
9
  export { FormSpy } from './create-form/form-spy';
10
+ export { UserPicker } from './create-form/user-picker';
@@ -0,0 +1,9 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ import type { AnalyticsEventAttributes } from '../../../common/utils/analytics/analytics.codegen';
3
+ type InlineAnalyticsProps = {
4
+ screen: keyof {
5
+ [Key in keyof AnalyticsEventAttributes as Key extends `screen.${infer ScreenName}.viewed` ? ScreenName : never]: any;
6
+ };
7
+ };
8
+ export declare const InlineAnalytics: ({ screen, children }: PropsWithChildren<InlineAnalyticsProps>) => JSX.Element;
9
+ export {};
@@ -1,5 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { LinkCreateProps } from '../../common/types';
3
- export declare const TEST_ID = "link-create";
4
3
  declare const InlineCreate: (props: LinkCreateProps) => jsx.JSX.Element;
5
4
  export default InlineCreate;
@@ -1,5 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { LinkCreateWithModalProps } from '../../common/types';
3
- export declare const TEST_ID = "link-create";
4
3
  declare const LinkCreateModal: (props: LinkCreateWithModalProps) => jsx.JSX.Element;
5
4
  export default LinkCreateModal;
@@ -3,17 +3,17 @@ import React from 'react';
3
3
  import { useIntl } from 'react-intl-next';
4
4
 
5
5
  export const MockDisclaimer = () => {
6
- const { locale } = useIntl();
7
- const parentLocale = locale.split(/[-_]/)[0];
8
- const disclaimer = 'This is a mocked plugin.';
6
+ const { locale } = useIntl();
7
+ const parentLocale = locale.split(/[-_]/)[0];
8
+ const disclaimer = 'This is a mocked plugin.';
9
9
 
10
- if (parentLocale !== 'en') {
11
- return (
12
- <p>
13
- {disclaimer} <small>{`(locale ${locale} not available)`}</small>
14
- </p>
15
- );
16
- }
10
+ if (parentLocale !== 'en') {
11
+ return (
12
+ <p>
13
+ {disclaimer} <small>{`(locale ${locale} not available)`}</small>
14
+ </p>
15
+ );
16
+ }
17
17
 
18
- return <p>{disclaimer}</p>;
18
+ return <p>{disclaimer}</p>;
19
19
  };
@@ -1,92 +1,89 @@
1
1
  import React, { useCallback, useMemo } from 'react';
2
2
 
3
3
  import {
4
- AsyncSelect,
5
- CreateForm,
6
- type CreateFormProps,
7
- TextField,
8
- useLinkCreateCallback,
9
- type Validator,
4
+ AsyncSelect,
5
+ CreateForm,
6
+ type CreateFormProps,
7
+ TextField,
8
+ useLinkCreateCallback,
9
+ type Validator,
10
10
  } from '../src';
11
11
 
12
12
  import { MockDisclaimer } from './mock-disclaimer';
13
13
 
14
14
  interface pluginProps {
15
- shouldThrowError?: boolean;
15
+ shouldThrowError?: boolean;
16
16
  }
17
17
 
18
18
  export function MockPluginForm({ shouldThrowError }: pluginProps) {
19
- const { onCreate, onFailure, onCancel } = useLinkCreateCallback();
19
+ const { onCreate, onFailure, onCancel } = useLinkCreateCallback();
20
20
 
21
- type MockOptions = {
22
- label: string;
23
- value: string;
24
- };
21
+ type MockOptions = {
22
+ label: string;
23
+ value: string;
24
+ };
25
25
 
26
- const mockHandleSubmit = async () => {
27
- if (onCreate) {
28
- await onCreate({
29
- url: 'https://atlassian.com/product/new-object-id',
30
- objectId: 'new-object-id',
31
- objectType: 'object-type',
32
- data: {},
33
- ari: 'example-ari',
34
- });
35
- }
36
- };
26
+ const mockHandleSubmit = async () => {
27
+ if (onCreate) {
28
+ await onCreate({
29
+ url: 'https://atlassian.com/product/new-object-id',
30
+ objectId: 'new-object-id',
31
+ objectType: 'object-type',
32
+ data: {},
33
+ ari: 'example-ari',
34
+ });
35
+ }
36
+ };
37
37
 
38
- const mockValidator: Validator = useMemo(
39
- () => ({
40
- isValid: (val: unknown) => !!val,
41
- errorMessage: 'Validation Error: You need to provide a value.',
42
- }),
43
- [],
44
- );
38
+ const mockValidator: Validator = useMemo(
39
+ () => ({
40
+ isValid: (val: unknown) => !!val,
41
+ errorMessage: 'Validation Error: You need to provide a value.',
42
+ }),
43
+ [],
44
+ );
45
45
 
46
- const mockLoadOptions = useCallback(async () => {
47
- const exampleOptions = [
48
- { label: 'Option 1', value: 'option-1' },
49
- { label: 'Option 2', value: 'option-2' },
50
- ];
46
+ const mockLoadOptions = useCallback(async () => {
47
+ const exampleOptions = [
48
+ { label: 'Option 1', value: 'option-1' },
49
+ { label: 'Option 2', value: 'option-2' },
50
+ ];
51
51
 
52
- try {
53
- if (shouldThrowError) {
54
- throw new Error('This is an error message.');
55
- }
56
- return exampleOptions;
57
- } catch (error) {
58
- if (error instanceof Error) {
59
- onFailure && onFailure(error);
60
- }
61
- return [];
62
- }
63
- }, [onFailure, shouldThrowError]);
52
+ try {
53
+ if (shouldThrowError) {
54
+ throw new Error('This is an error message.');
55
+ }
56
+ return exampleOptions;
57
+ } catch (error) {
58
+ if (error instanceof Error) {
59
+ onFailure && onFailure(error);
60
+ }
61
+ return [];
62
+ }
63
+ }, [onFailure, shouldThrowError]);
64
64
 
65
- return (
66
- <div>
67
- <MockDisclaimer />
68
- <CreateForm<CreateFormProps<FormData>>
69
- onSubmit={mockHandleSubmit}
70
- onCancel={onCancel}
71
- >
72
- <TextField
73
- name={'textField-name'}
74
- label={'Enter some Text'}
75
- placeholder={'Type something here...'}
76
- validators={[mockValidator]}
77
- autoFocus
78
- maxLength={255}
79
- />
80
- <AsyncSelect<MockOptions>
81
- isRequired
82
- isSearchable
83
- name={'asyncSelect-name'}
84
- label={'Select an Option'}
85
- validators={[mockValidator]}
86
- defaultOptions={true}
87
- loadOptions={mockLoadOptions}
88
- ></AsyncSelect>
89
- </CreateForm>
90
- </div>
91
- );
65
+ return (
66
+ <div>
67
+ <MockDisclaimer />
68
+ <CreateForm<CreateFormProps<FormData>> onSubmit={mockHandleSubmit} onCancel={onCancel}>
69
+ <TextField
70
+ name={'textField-name'}
71
+ label={'Enter some Text'}
72
+ placeholder={'Type something here...'}
73
+ validators={[mockValidator]}
74
+ autoFocus
75
+ maxLength={255}
76
+ />
77
+ <AsyncSelect<MockOptions>
78
+ isRequired
79
+ isSearchable
80
+ name={'asyncSelect-name'}
81
+ label={'Select an Option'}
82
+ validators={[mockValidator]}
83
+ defaultOptions={true}
84
+ loadOptions={mockLoadOptions}
85
+ ></AsyncSelect>
86
+ </CreateForm>
87
+ </div>
88
+ );
92
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "The driver component of meta creation flow",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -46,8 +46,9 @@
46
46
  "@atlaskit/intl-messages-provider": "^1.0.2",
47
47
  "@atlaskit/linking-common": "^5.7.0",
48
48
  "@atlaskit/modal-dialog": "^12.13.0",
49
- "@atlaskit/primitives": "^6.4.0",
49
+ "@atlaskit/primitives": "^6.5.0",
50
50
  "@atlaskit/select": "^17.10.0",
51
+ "@atlaskit/smart-user-picker": "^6.9.0",
51
52
  "@atlaskit/spinner": "^16.1.0",
52
53
  "@atlaskit/textfield": "^6.3.0",
53
54
  "@atlaskit/tokens": "^1.49.0",