@atlaskit/link-create 2.1.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/common/constants.js +1 -1
  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/es2019/common/constants.js +1 -1
  10. package/dist/es2019/index.js +2 -2
  11. package/dist/es2019/ui/create-form/main.js +1 -1
  12. package/dist/es2019/ui/create-form/user-picker/index.js +1 -0
  13. package/dist/es2019/ui/create-form/user-picker/main.js +48 -0
  14. package/dist/es2019/ui/create-form/user-picker/types.js +1 -0
  15. package/dist/es2019/ui/index.js +2 -1
  16. package/dist/esm/common/constants.js +1 -1
  17. package/dist/esm/index.js +2 -2
  18. package/dist/esm/ui/create-form/main.js +1 -1
  19. package/dist/esm/ui/create-form/user-picker/index.js +1 -0
  20. package/dist/esm/ui/create-form/user-picker/main.js +51 -0
  21. package/dist/esm/ui/create-form/user-picker/types.js +1 -0
  22. package/dist/esm/ui/index.js +2 -1
  23. package/dist/types/common/ui/confirm-dismiss-dialog/main.d.ts +1 -1
  24. package/dist/types/common/ui/error-boundary/index.d.ts +1 -1
  25. package/dist/types/common/ui/link-create-content/index.d.ts +1 -1
  26. package/dist/types/common/utils/analytics/index.d.ts +1 -1
  27. package/dist/types/controllers/exit-warning-modal-context/index.d.ts +1 -1
  28. package/dist/types/controllers/form-context/index.d.ts +1 -1
  29. package/dist/types/index.d.ts +2 -2
  30. package/dist/types/ui/create-form/form-spy/index.d.ts +1 -1
  31. package/dist/types/ui/create-form/user-picker/index.d.ts +1 -0
  32. package/dist/types/ui/create-form/user-picker/main.d.ts +8 -0
  33. package/dist/types/ui/create-form/user-picker/types.d.ts +25 -0
  34. package/dist/types/ui/index.d.ts +1 -0
  35. package/dist/types-ts4.5/common/ui/confirm-dismiss-dialog/main.d.ts +1 -1
  36. package/dist/types-ts4.5/common/ui/error-boundary/index.d.ts +1 -1
  37. package/dist/types-ts4.5/common/ui/link-create-content/index.d.ts +1 -1
  38. package/dist/types-ts4.5/common/utils/analytics/index.d.ts +1 -1
  39. package/dist/types-ts4.5/controllers/exit-warning-modal-context/index.d.ts +1 -1
  40. package/dist/types-ts4.5/controllers/form-context/index.d.ts +1 -1
  41. package/dist/types-ts4.5/index.d.ts +2 -2
  42. package/dist/types-ts4.5/ui/create-form/form-spy/index.d.ts +1 -1
  43. package/dist/types-ts4.5/ui/create-form/user-picker/index.d.ts +1 -0
  44. package/dist/types-ts4.5/ui/create-form/user-picker/main.d.ts +8 -0
  45. package/dist/types-ts4.5/ui/create-form/user-picker/types.d.ts +25 -0
  46. package/dist/types-ts4.5/ui/index.d.ts +1 -0
  47. package/example-helpers/mock-disclaimer.tsx +11 -11
  48. package/example-helpers/mock-plugin-form.tsx +71 -74
  49. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/link-create
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#105330](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105330)
8
+ [`9fb53f33cb33`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9fb53f33cb33) -
9
+ [ux] Added a goal owner selector component to the goal creation modal. Additionally, added a new
10
+ user-picker component to be used in CreateForm. Goal picker has a new mandatory default owner prop
11
+
3
12
  ## 2.1.0
4
13
 
5
14
  ### Minor Changes
@@ -11,7 +11,7 @@ var CREATE_FORM_MIN_HEIGHT_IN_PX = exports.CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
11
11
  var LINK_CREATE_FORM_POST_CREATE_FIELD = exports.LINK_CREATE_FORM_POST_CREATE_FIELD = '__post_create__';
12
12
  var PACKAGE_DATA = exports.PACKAGE_DATA = {
13
13
  packageName: "@atlaskit/link-create" || '',
14
- packageVersion: "2.1.0" || '',
14
+ packageVersion: "2.2.0" || '',
15
15
  component: COMPONENT_NAME,
16
16
  componentName: COMPONENT_NAME
17
17
  };
package/dist/cjs/index.js CHANGED
@@ -52,6 +52,12 @@ Object.defineProperty(exports, "TextField", {
52
52
  return _index.TextField;
53
53
  }
54
54
  });
55
+ Object.defineProperty(exports, "UserPicker", {
56
+ enumerable: true,
57
+ get: function get() {
58
+ return _index.UserPicker;
59
+ }
60
+ });
55
61
  Object.defineProperty(exports, "default", {
56
62
  enumerable: true,
57
63
  get: function get() {
@@ -156,7 +156,7 @@ var CreateForm = exports.CreateForm = function CreateForm(_ref) {
156
156
  }
157
157
  }), (0, _react2.jsx)("p", {
158
158
  "aria-hidden": "true"
159
- }, intl.formatMessage(_messages.default.requiredFieldInstruction), ' ', (0, _react2.jsx)(_form.RequiredAsterisk, null)), (0, _react2.jsx)(_primitives.Box, null, children), !hideFooter && (0, _react2.jsx)(_formFooter.CreateFormFooter
159
+ }, intl.formatMessage(_messages.default.requiredFieldInstruction), " ", (0, _react2.jsx)(_form.RequiredAsterisk, null)), (0, _react2.jsx)(_primitives.Box, null, children), !hideFooter && (0, _react2.jsx)(_formFooter.CreateFormFooter
160
160
  /**
161
161
  * We will prefer to render the error message connected to
162
162
  * react final form state (submitError) otherwise we can
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "UserPicker", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _main.UserPicker;
10
+ }
11
+ });
12
+ var _main = require("./main");
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.TEST_ID = void 0;
8
+ exports.UserPicker = UserPicker;
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = require("@emotion/react");
11
+ var _smartUserPicker = _interopRequireDefault(require("@atlaskit/smart-user-picker"));
12
+ var _createField = require("../../../controllers/create-field");
13
+ var _excluded = ["fieldId"];
14
+ /** @jsx jsx */
15
+ var TEST_ID = exports.TEST_ID = 'link-create-user-picker';
16
+ var DEFAULT_DEBOUNCE_TIME = 400;
17
+ var UserPickerWidth = "100%";
18
+
19
+ /**
20
+ * A user picker utilising the SmartUserPicker.
21
+ */
22
+
23
+ function UserPicker(_ref) {
24
+ var productKey = _ref.productKey,
25
+ siteId = _ref.siteId,
26
+ name = _ref.name,
27
+ label = _ref.label,
28
+ placeholder = _ref.placeholder,
29
+ validators = _ref.validators,
30
+ _ref$testId = _ref.testId,
31
+ testId = _ref$testId === void 0 ? TEST_ID : _ref$testId,
32
+ defaultValue = _ref.defaultValue;
33
+ return (0, _react.jsx)(_createField.CreateField, {
34
+ name: name,
35
+ label: label,
36
+ isRequired: true,
37
+ testId: testId,
38
+ validators: validators
39
+ }, function (_ref2) {
40
+ var fieldId = _ref2.fieldId,
41
+ fieldProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
42
+ return (0, _react.jsx)(_smartUserPicker.default, {
43
+ defaultValue: defaultValue,
44
+ placeholder: placeholder,
45
+ onChange: function onChange(value) {
46
+ return fieldProps.onChange(value);
47
+ },
48
+ subtle: true,
49
+ isMulti: false,
50
+ productKey: productKey,
51
+ siteId: siteId,
52
+ fieldId: fieldId,
53
+ debounceTime: DEFAULT_DEBOUNCE_TIME,
54
+ prefetch: true,
55
+ isClearable: false,
56
+ width: UserPickerWidth
57
+ });
58
+ });
59
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -46,6 +46,12 @@ Object.defineProperty(exports, "TextField", {
46
46
  return _textfield.TextField;
47
47
  }
48
48
  });
49
+ Object.defineProperty(exports, "UserPicker", {
50
+ enumerable: true,
51
+ get: function get() {
52
+ return _userPicker.UserPicker;
53
+ }
54
+ });
49
55
  Object.defineProperty(exports, "default", {
50
56
  enumerable: true,
51
57
  get: function get() {
@@ -59,4 +65,5 @@ var _main = require("./create-form/main");
59
65
  var _formLoader = require("./create-form/form-loader");
60
66
  var _select = require("./create-form/select");
61
67
  var _asyncSelect = require("./create-form/async-select");
62
- var _formSpy = require("./create-form/form-spy");
68
+ var _formSpy = require("./create-form/form-spy");
69
+ var _userPicker = require("./create-form/user-picker");
@@ -5,7 +5,7 @@ export const CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
5
5
  export const LINK_CREATE_FORM_POST_CREATE_FIELD = '__post_create__';
6
6
  export const PACKAGE_DATA = {
7
7
  packageName: "@atlaskit/link-create" || '',
8
- packageVersion: "2.1.0" || '',
8
+ packageVersion: "2.2.0" || '',
9
9
  component: COMPONENT_NAME,
10
10
  componentName: COMPONENT_NAME
11
11
  };
@@ -1,6 +1,6 @@
1
- export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy
1
+ export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy,
2
2
  // todo: EDM-10077 - export this once inline-create is tested/ready
3
3
  //InlineCreate,
4
- } from './ui/index';
4
+ UserPicker } from './ui/index';
5
5
  export { useLinkCreateCallback, LinkCreateCallbackProvider } from './controllers/callback-context';
6
6
  export { FORM_ERROR } from 'final-form';
@@ -121,7 +121,7 @@ export const CreateForm = ({
121
121
  }
122
122
  }), jsx("p", {
123
123
  "aria-hidden": "true"
124
- }, intl.formatMessage(messages.requiredFieldInstruction), ' ', jsx(RequiredAsterisk, null)), jsx(Box, null, children), !hideFooter && jsx(CreateFormFooter
124
+ }, intl.formatMessage(messages.requiredFieldInstruction), " ", jsx(RequiredAsterisk, null)), jsx(Box, null, children), !hideFooter && jsx(CreateFormFooter
125
125
  /**
126
126
  * We will prefer to render the error message connected to
127
127
  * react final form state (submitError) otherwise we can
@@ -0,0 +1 @@
1
+ export { UserPicker } from './main';
@@ -0,0 +1,48 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import SmartUserPicker from '@atlaskit/smart-user-picker';
4
+ import { CreateField } from '../../../controllers/create-field';
5
+ export const TEST_ID = 'link-create-user-picker';
6
+ const DEFAULT_DEBOUNCE_TIME = 400;
7
+ const UserPickerWidth = "100%";
8
+
9
+ /**
10
+ * A user picker utilising the SmartUserPicker.
11
+ */
12
+
13
+ export function UserPicker({
14
+ productKey,
15
+ siteId,
16
+ name,
17
+ label,
18
+ placeholder,
19
+ validators,
20
+ testId = TEST_ID,
21
+ defaultValue
22
+ }) {
23
+ return jsx(CreateField, {
24
+ name: name,
25
+ label: label,
26
+ isRequired: true,
27
+ testId: testId,
28
+ validators: validators
29
+ }, ({
30
+ fieldId,
31
+ ...fieldProps
32
+ }) => {
33
+ return jsx(SmartUserPicker, {
34
+ defaultValue: defaultValue,
35
+ placeholder: placeholder,
36
+ onChange: value => fieldProps.onChange(value),
37
+ subtle: true,
38
+ isMulti: false,
39
+ productKey: productKey,
40
+ siteId: siteId,
41
+ fieldId: fieldId,
42
+ debounceTime: DEFAULT_DEBOUNCE_TIME,
43
+ prefetch: true,
44
+ isClearable: false,
45
+ width: UserPickerWidth
46
+ });
47
+ });
48
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -5,4 +5,5 @@ export { CreateForm } from './create-form/main';
5
5
  export { CreateFormLoader } from './create-form/form-loader';
6
6
  export { Select } from './create-form/select';
7
7
  export { AsyncSelect } from './create-form/async-select';
8
- export { FormSpy } from './create-form/form-spy';
8
+ export { FormSpy } from './create-form/form-spy';
9
+ export { UserPicker } from './create-form/user-picker';
@@ -5,7 +5,7 @@ export var CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
5
5
  export var LINK_CREATE_FORM_POST_CREATE_FIELD = '__post_create__';
6
6
  export var PACKAGE_DATA = {
7
7
  packageName: "@atlaskit/link-create" || '',
8
- packageVersion: "2.1.0" || '',
8
+ packageVersion: "2.2.0" || '',
9
9
  component: COMPONENT_NAME,
10
10
  componentName: COMPONENT_NAME
11
11
  };
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy
1
+ export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy,
2
2
  // todo: EDM-10077 - export this once inline-create is tested/ready
3
3
  //InlineCreate,
4
- } from './ui/index';
4
+ UserPicker } from './ui/index';
5
5
  export { useLinkCreateCallback, LinkCreateCallbackProvider } from './controllers/callback-context';
6
6
  export { FORM_ERROR } from 'final-form';
@@ -150,7 +150,7 @@ export var CreateForm = function CreateForm(_ref) {
150
150
  }
151
151
  }), jsx("p", {
152
152
  "aria-hidden": "true"
153
- }, intl.formatMessage(messages.requiredFieldInstruction), ' ', jsx(RequiredAsterisk, null)), jsx(Box, null, children), !hideFooter && jsx(CreateFormFooter
153
+ }, intl.formatMessage(messages.requiredFieldInstruction), " ", jsx(RequiredAsterisk, null)), jsx(Box, null, children), !hideFooter && jsx(CreateFormFooter
154
154
  /**
155
155
  * We will prefer to render the error message connected to
156
156
  * react final form state (submitError) otherwise we can
@@ -0,0 +1 @@
1
+ export { UserPicker } from './main';
@@ -0,0 +1,51 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ var _excluded = ["fieldId"];
3
+ /** @jsx jsx */
4
+ import { jsx } from '@emotion/react';
5
+ import SmartUserPicker from '@atlaskit/smart-user-picker';
6
+ import { CreateField } from '../../../controllers/create-field';
7
+ export var TEST_ID = 'link-create-user-picker';
8
+ var DEFAULT_DEBOUNCE_TIME = 400;
9
+ var UserPickerWidth = "100%";
10
+
11
+ /**
12
+ * A user picker utilising the SmartUserPicker.
13
+ */
14
+
15
+ export function UserPicker(_ref) {
16
+ var productKey = _ref.productKey,
17
+ siteId = _ref.siteId,
18
+ name = _ref.name,
19
+ label = _ref.label,
20
+ placeholder = _ref.placeholder,
21
+ validators = _ref.validators,
22
+ _ref$testId = _ref.testId,
23
+ testId = _ref$testId === void 0 ? TEST_ID : _ref$testId,
24
+ defaultValue = _ref.defaultValue;
25
+ return jsx(CreateField, {
26
+ name: name,
27
+ label: label,
28
+ isRequired: true,
29
+ testId: testId,
30
+ validators: validators
31
+ }, function (_ref2) {
32
+ var fieldId = _ref2.fieldId,
33
+ fieldProps = _objectWithoutProperties(_ref2, _excluded);
34
+ return jsx(SmartUserPicker, {
35
+ defaultValue: defaultValue,
36
+ placeholder: placeholder,
37
+ onChange: function onChange(value) {
38
+ return fieldProps.onChange(value);
39
+ },
40
+ subtle: true,
41
+ isMulti: false,
42
+ productKey: productKey,
43
+ siteId: siteId,
44
+ fieldId: fieldId,
45
+ debounceTime: DEFAULT_DEBOUNCE_TIME,
46
+ prefetch: true,
47
+ isClearable: false,
48
+ width: UserPickerWidth
49
+ });
50
+ });
51
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -5,4 +5,5 @@ export { CreateForm } from './create-form/main';
5
5
  export { CreateFormLoader } from './create-form/form-loader';
6
6
  export { Select } from './create-form/select';
7
7
  export { AsyncSelect } from './create-form/async-select';
8
- export { FormSpy } from './create-form/form-spy';
8
+ export { FormSpy } from './create-form/form-spy';
9
+ export { UserPicker } from './create-form/user-picker';
@@ -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 {};
@@ -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';
@@ -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 {};
@@ -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';
@@ -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.2.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",