@atlaskit/link-create 2.0.0 → 2.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.
- package/CHANGELOG.md +352 -337
- package/dist/cjs/common/constants.js +8 -2
- package/dist/cjs/{ui/link-create → common/ui}/confirm-dismiss-dialog/main.js +4 -6
- package/dist/cjs/{ui/link-create → common/ui}/edit-modal/index.js +4 -8
- package/dist/cjs/{ui/link-create → common/ui}/error-boundary/index.js +1 -1
- package/dist/cjs/{controllers → common/ui}/experience-tracker/index.js +3 -3
- package/dist/cjs/common/ui/link-create-content/index.js +21 -0
- package/dist/cjs/{ui/link-create → common/ui}/modal-hero/index.js +1 -3
- package/dist/cjs/controllers/callback-context/main.js +1 -1
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/ui/create-form/main.js +1 -1
- package/dist/cjs/ui/create-form/user-picker/index.js +12 -0
- package/dist/cjs/ui/create-form/user-picker/main.js +59 -0
- package/dist/cjs/ui/create-form/user-picker/types.js +5 -0
- package/dist/cjs/ui/index.js +19 -5
- package/dist/cjs/ui/{main.js → inline-create/index.js} +11 -17
- package/dist/cjs/ui/inline-create/main.js +125 -0
- package/dist/cjs/ui/modal-create/index.js +38 -0
- package/dist/cjs/ui/{link-create → modal-create}/main.js +36 -39
- package/dist/es2019/common/constants.js +7 -1
- package/dist/es2019/{ui/link-create → common/ui}/confirm-dismiss-dialog/main.js +4 -7
- package/dist/es2019/{ui/link-create → common/ui}/edit-modal/index.js +4 -10
- package/dist/es2019/{ui/link-create → common/ui}/error-boundary/index.js +1 -1
- package/dist/es2019/{controllers → common/ui}/experience-tracker/index.js +3 -3
- package/dist/es2019/common/ui/link-create-content/index.js +11 -0
- package/dist/es2019/{ui/link-create → common/ui}/modal-hero/index.js +1 -3
- package/dist/es2019/controllers/callback-context/main.js +1 -1
- package/dist/es2019/index.js +4 -1
- package/dist/es2019/ui/create-form/main.js +1 -1
- package/dist/es2019/ui/create-form/user-picker/index.js +1 -0
- package/dist/es2019/ui/create-form/user-picker/main.js +48 -0
- package/dist/es2019/ui/create-form/user-picker/types.js +1 -0
- package/dist/es2019/ui/index.js +4 -2
- package/dist/es2019/ui/inline-create/index.js +30 -0
- package/dist/es2019/ui/inline-create/main.js +100 -0
- package/dist/es2019/ui/{main.js → modal-create/index.js} +8 -14
- package/dist/es2019/ui/{link-create → modal-create}/main.js +19 -19
- package/dist/esm/common/constants.js +7 -1
- package/dist/esm/{ui/link-create → common/ui}/confirm-dismiss-dialog/main.js +4 -6
- package/dist/esm/{ui/link-create → common/ui}/edit-modal/index.js +4 -8
- package/dist/esm/{ui/link-create → common/ui}/error-boundary/index.js +1 -1
- package/dist/esm/{controllers → common/ui}/experience-tracker/index.js +3 -3
- package/dist/esm/common/ui/link-create-content/index.js +12 -0
- package/dist/esm/{ui/link-create → common/ui}/modal-hero/index.js +1 -3
- package/dist/esm/controllers/callback-context/main.js +1 -1
- package/dist/esm/index.js +4 -1
- package/dist/esm/ui/create-form/main.js +1 -1
- package/dist/esm/ui/create-form/user-picker/index.js +1 -0
- package/dist/esm/ui/create-form/user-picker/main.js +51 -0
- package/dist/esm/ui/create-form/user-picker/types.js +1 -0
- package/dist/esm/ui/index.js +4 -2
- package/dist/esm/ui/inline-create/index.js +30 -0
- package/dist/esm/ui/inline-create/main.js +119 -0
- package/dist/esm/ui/{main.js → modal-create/index.js} +8 -14
- package/dist/esm/ui/{link-create → modal-create}/main.js +38 -41
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/ui/Button/index.d.ts +1 -1
- package/dist/types/common/ui/confirm-dismiss-dialog/main.d.ts +7 -0
- package/dist/types/common/ui/edit-modal/index.d.ts +11 -0
- package/dist/types/{ui/link-create → common/ui}/error-boundary/index.d.ts +1 -1
- package/dist/types/common/ui/link-create-content/index.d.ts +8 -0
- package/dist/types/common/utils/analytics/index.d.ts +1 -1
- package/dist/types/controllers/exit-warning-modal-context/index.d.ts +1 -1
- package/dist/types/controllers/form-context/index.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/ui/create-form/form-spy/index.d.ts +1 -1
- package/dist/types/ui/create-form/user-picker/index.d.ts +1 -0
- package/dist/types/ui/create-form/user-picker/main.d.ts +8 -0
- package/dist/types/ui/create-form/user-picker/types.d.ts +25 -0
- package/dist/types/ui/index.d.ts +3 -1
- package/dist/types/ui/inline-create/index.d.ts +5 -0
- package/dist/types/ui/inline-create/main.d.ts +5 -0
- package/dist/types/ui/modal-create/index.d.ts +5 -0
- package/dist/{types-ts4.5/ui/link-create → types/ui/modal-create}/main.d.ts +1 -1
- package/dist/types-ts4.5/common/constants.d.ts +2 -0
- package/dist/types-ts4.5/common/ui/Button/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/confirm-dismiss-dialog/main.d.ts +7 -0
- package/dist/types-ts4.5/common/ui/edit-modal/index.d.ts +11 -0
- package/dist/types-ts4.5/{ui/link-create → common/ui}/error-boundary/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/link-create-content/index.d.ts +8 -0
- package/dist/types-ts4.5/common/utils/analytics/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/index.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/create-form/form-spy/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/create-form/user-picker/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/create-form/user-picker/main.d.ts +8 -0
- package/dist/types-ts4.5/ui/create-form/user-picker/types.d.ts +25 -0
- package/dist/types-ts4.5/ui/index.d.ts +3 -1
- package/dist/types-ts4.5/ui/{main.d.ts → inline-create/index.d.ts} +1 -3
- package/dist/types-ts4.5/ui/inline-create/main.d.ts +5 -0
- package/dist/{types/ui/main.d.ts → types-ts4.5/ui/modal-create/index.d.ts} +1 -3
- package/dist/{types/ui/link-create → types-ts4.5/ui/modal-create}/main.d.ts +1 -1
- package/example-helpers/mock-disclaimer.tsx +11 -11
- package/example-helpers/mock-plugin-form.tsx +71 -74
- package/package.json +6 -7
- package/dist/cjs/ui/link-create/index.js +0 -13
- package/dist/es2019/ui/link-create/index.js +0 -1
- package/dist/esm/ui/link-create/index.js +0 -1
- package/dist/types/ui/link-create/confirm-dismiss-dialog/main.d.ts +0 -6
- package/dist/types/ui/link-create/edit-modal/index.d.ts +0 -8
- package/dist/types/ui/link-create/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/link-create/confirm-dismiss-dialog/main.d.ts +0 -6
- package/dist/types-ts4.5/ui/link-create/edit-modal/index.d.ts +0 -8
- package/dist/types-ts4.5/ui/link-create/index.d.ts +0 -1
- /package/dist/cjs/{ui/link-create → common/ui}/confirm-dismiss-dialog/index.js +0 -0
- /package/dist/cjs/{ui/link-create → common/ui}/confirm-dismiss-dialog/messages.js +0 -0
- /package/dist/cjs/{ui/link-create → common/ui}/error-boundary/error-boundary-base/index.js +0 -0
- /package/dist/cjs/ui/{link-create → modal-create}/messages.js +0 -0
- /package/dist/es2019/{ui/link-create → common/ui}/confirm-dismiss-dialog/index.js +0 -0
- /package/dist/es2019/{ui/link-create → common/ui}/confirm-dismiss-dialog/messages.js +0 -0
- /package/dist/es2019/{ui/link-create → common/ui}/error-boundary/error-boundary-base/index.js +0 -0
- /package/dist/es2019/ui/{link-create → modal-create}/messages.js +0 -0
- /package/dist/esm/{ui/link-create → common/ui}/confirm-dismiss-dialog/index.js +0 -0
- /package/dist/esm/{ui/link-create → common/ui}/confirm-dismiss-dialog/messages.js +0 -0
- /package/dist/esm/{ui/link-create → common/ui}/error-boundary/error-boundary-base/index.js +0 -0
- /package/dist/esm/ui/{link-create → modal-create}/messages.js +0 -0
- /package/dist/types/{ui/link-create → common/ui}/confirm-dismiss-dialog/index.d.ts +0 -0
- /package/dist/types/{ui/link-create → common/ui}/confirm-dismiss-dialog/messages.d.ts +0 -0
- /package/dist/types/{ui/link-create → common/ui}/error-boundary/error-boundary-base/index.d.ts +0 -0
- /package/dist/types/{controllers → common/ui}/experience-tracker/index.d.ts +0 -0
- /package/dist/types/{ui/link-create → common/ui}/modal-hero/index.d.ts +0 -0
- /package/dist/types/ui/{link-create → modal-create}/messages.d.ts +0 -0
- /package/dist/types-ts4.5/{ui/link-create → common/ui}/confirm-dismiss-dialog/index.d.ts +0 -0
- /package/dist/types-ts4.5/{ui/link-create → common/ui}/confirm-dismiss-dialog/messages.d.ts +0 -0
- /package/dist/types-ts4.5/{ui/link-create → common/ui}/error-boundary/error-boundary-base/index.d.ts +0 -0
- /package/dist/types-ts4.5/{controllers → common/ui}/experience-tracker/index.d.ts +0 -0
- /package/dist/types-ts4.5/{ui/link-create → common/ui}/modal-hero/index.d.ts +0 -0
- /package/dist/types-ts4.5/ui/{link-create → modal-create}/messages.d.ts +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { type LinkCreateWithModalProps } from '../../common/types';
|
|
4
|
+
declare const ComposedLinkCreate: import("react").MemoExoticComponent<(props: LinkCreateWithModalProps) => jsx.JSX.Element>;
|
|
5
|
+
export default ComposedLinkCreate;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import {
|
|
2
|
+
import type { LinkCreateWithModalProps } from '../../common/types';
|
|
3
3
|
export declare const TEST_ID = "link-create";
|
|
4
4
|
declare const LinkCreateModal: (props: LinkCreateWithModalProps) => jsx.JSX.Element;
|
|
5
5
|
export default LinkCreateModal;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { PackageMetaDataType } from './utils/analytics/analytics.codegen';
|
|
1
2
|
export declare const ANALYTICS_CHANNEL = "media";
|
|
2
3
|
export declare const COMPONENT_NAME = "linkCreate";
|
|
3
4
|
export declare const CREATE_FORM_MAX_WIDTH_IN_PX = "480";
|
|
4
5
|
export declare const CREATE_FORM_MIN_HEIGHT_IN_PX = "200";
|
|
5
6
|
export declare const LINK_CREATE_FORM_POST_CREATE_FIELD = "__post_create__";
|
|
7
|
+
export declare const PACKAGE_DATA: PackageMetaDataType;
|
|
@@ -2,4 +2,4 @@ import React from 'react';
|
|
|
2
2
|
import { type AnalyticsEventAttributes } from '../../../common/utils/analytics/analytics.codegen';
|
|
3
3
|
export declare const Button: React.ForwardRefExoticComponent<Pick<import("@atlaskit/button").ButtonProps & React.RefAttributes<HTMLElement> & {
|
|
4
4
|
actionSubjectId: "create" | "edit" | "cancel" | "confirm";
|
|
5
|
-
}, "key" | keyof import("@atlaskit/button").ButtonProps
|
|
5
|
+
}, "actionSubjectId" | "key" | keyof import("@atlaskit/button").ButtonProps> & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type CreatePayload, type LinkCreatePlugin } from '../../types';
|
|
3
|
+
import { Modal } from '../ModalDialog';
|
|
4
|
+
type EditModalProps = {
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onCloseComplete?: React.ComponentProps<typeof Modal>['onCloseComplete'];
|
|
7
|
+
editViewPayload?: CreatePayload;
|
|
8
|
+
activePlugin?: LinkCreatePlugin<string> | null;
|
|
9
|
+
};
|
|
10
|
+
export declare const EditModal: ({ onClose, onCloseComplete, editViewPayload, activePlugin, }: EditModalProps) => JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -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
|
|
5
|
+
export declare const ErrorBoundary: ({ children, errorComponent }: ErrorBoundaryProps) => JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { LinkCreatePlugin } from '../../types';
|
|
3
|
+
type LinkCreateContentProps = {
|
|
4
|
+
plugins: LinkCreatePlugin[];
|
|
5
|
+
entityKey: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const LinkCreateContent: ({ plugins, entityKey }: LinkCreateContentProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useLinkCreateAnalytics, withLinkCreateAnalyticsContext
|
|
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
|
|
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
|
|
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
|
|
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 {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { default } from './
|
|
1
|
+
export { default } from './modal-create';
|
|
2
|
+
export { default as InlineCreate } from './inline-create';
|
|
2
3
|
export { TextField } from './create-form/textfield';
|
|
3
4
|
export { CreateForm } from './create-form/main';
|
|
4
5
|
export { CreateFormLoader } from './create-form/form-loader';
|
|
@@ -6,3 +7,4 @@ export type { CreateFormProps } from './create-form/main';
|
|
|
6
7
|
export { Select } from './create-form/select';
|
|
7
8
|
export { AsyncSelect } from './create-form/async-select';
|
|
8
9
|
export { FormSpy } from './create-form/form-spy';
|
|
10
|
+
export { UserPicker } from './create-form/user-picker';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
import {
|
|
4
|
-
import { type PackageMetaDataType } from '../common/utils/analytics/analytics.codegen';
|
|
5
|
-
export declare const PACKAGE_DATA: PackageMetaDataType;
|
|
3
|
+
import type { LinkCreateWithModalProps } from '../../common/types';
|
|
6
4
|
declare const ComposedLinkCreate: import("react").MemoExoticComponent<(props: LinkCreateWithModalProps) => jsx.JSX.Element>;
|
|
7
5
|
export default ComposedLinkCreate;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
import { type LinkCreateWithModalProps } from '
|
|
4
|
-
import { type PackageMetaDataType } from '../common/utils/analytics/analytics.codegen';
|
|
5
|
-
export declare const PACKAGE_DATA: PackageMetaDataType;
|
|
3
|
+
import { type LinkCreateWithModalProps } from '../../common/types';
|
|
6
4
|
declare const ComposedLinkCreate: import("react").MemoExoticComponent<(props: LinkCreateWithModalProps) => jsx.JSX.Element>;
|
|
7
5
|
export default ComposedLinkCreate;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import {
|
|
2
|
+
import type { LinkCreateWithModalProps } from '../../common/types';
|
|
3
3
|
export declare const TEST_ID = "link-create";
|
|
4
4
|
declare const LinkCreateModal: (props: LinkCreateWithModalProps) => jsx.JSX.Element;
|
|
5
5
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const { locale } = useIntl();
|
|
7
|
+
const parentLocale = locale.split(/[-_]/)[0];
|
|
8
|
+
const disclaimer = 'This is a mocked plugin.';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
15
|
+
shouldThrowError?: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function MockPluginForm({ shouldThrowError }: pluginProps) {
|
|
19
|
-
|
|
19
|
+
const { onCreate, onFailure, onCancel } = useLinkCreateCallback();
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
type MockOptions = {
|
|
22
|
+
label: string;
|
|
23
|
+
value: string;
|
|
24
|
+
};
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "The driver component of meta creation flow",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,15 +39,16 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@atlaskit/analytics-next": "^9.3.0",
|
|
42
|
-
"@atlaskit/button": "^17.
|
|
42
|
+
"@atlaskit/button": "^17.17.0",
|
|
43
43
|
"@atlaskit/empty-state": "^7.8.0",
|
|
44
|
-
"@atlaskit/form": "^10.
|
|
44
|
+
"@atlaskit/form": "^10.3.0",
|
|
45
45
|
"@atlaskit/icon": "^22.3.0",
|
|
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.
|
|
50
|
-
"@atlaskit/select": "^17.
|
|
49
|
+
"@atlaskit/primitives": "^6.5.0",
|
|
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",
|
|
@@ -66,7 +67,6 @@
|
|
|
66
67
|
"@af/visual-regression": "*",
|
|
67
68
|
"@atlaskit/link-test-helpers": "^7.0.0",
|
|
68
69
|
"@atlaskit/visual-regression": "*",
|
|
69
|
-
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
70
70
|
"@atlassian/feature-flags-test-utils": "*",
|
|
71
71
|
"@testing-library/react": "^12.1.5",
|
|
72
72
|
"@testing-library/user-event": "^14.4.3",
|
|
@@ -115,6 +115,5 @@
|
|
|
115
115
|
]
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|
|
119
118
|
"platform-feature-flags": {}
|
|
120
119
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "default", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _main.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var _main = _interopRequireDefault(require("./main"));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './main';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './main';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Modal } from '../../../common/ui/ModalDialog';
|
|
3
|
-
type EditModalProps = {
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
onCloseComplete?: React.ComponentProps<typeof Modal>['onCloseComplete'];
|
|
6
|
-
};
|
|
7
|
-
export declare const EditModal: ({ onClose, onCloseComplete }: EditModalProps) => JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './main';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Modal } from '../../../common/ui/ModalDialog';
|
|
3
|
-
type EditModalProps = {
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
onCloseComplete?: React.ComponentProps<typeof Modal>['onCloseComplete'];
|
|
6
|
-
};
|
|
7
|
-
export declare const EditModal: ({ onClose, onCloseComplete }: EditModalProps) => JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './main';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/es2019/{ui/link-create → common/ui}/error-boundary/error-boundary-base/index.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/types/{ui/link-create → common/ui}/error-boundary/error-boundary-base/index.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/types-ts4.5/{ui/link-create → common/ui}/error-boundary/error-boundary-base/index.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|