@atlaskit/link-create 0.3.1 → 0.3.3

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 (50) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/common/constants.js +4 -2
  3. package/dist/cjs/controllers/form-context/main.js +17 -5
  4. package/dist/cjs/ui/create-form/main.js +29 -17
  5. package/dist/cjs/ui/create-form/messages.js +20 -0
  6. package/dist/cjs/ui/create-form/textfield/main.js +4 -3
  7. package/dist/cjs/ui/error-boundary/error-boundary-ui/error-svg/index.js +46 -44
  8. package/dist/cjs/ui/error-boundary/error-boundary-ui/messages.js +1 -1
  9. package/dist/cjs/ui/main.js +23 -5
  10. package/dist/cjs/ui/messages.js +15 -0
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/es2019/common/constants.js +2 -1
  13. package/dist/es2019/controllers/form-context/main.js +11 -2
  14. package/dist/es2019/ui/create-form/main.js +32 -16
  15. package/dist/es2019/ui/create-form/messages.js +13 -0
  16. package/dist/es2019/ui/create-form/textfield/main.js +4 -3
  17. package/dist/es2019/ui/error-boundary/error-boundary-ui/error-svg/index.js +46 -44
  18. package/dist/es2019/ui/error-boundary/error-boundary-ui/messages.js +1 -1
  19. package/dist/es2019/ui/main.js +20 -5
  20. package/dist/es2019/ui/messages.js +8 -0
  21. package/dist/es2019/version.json +1 -1
  22. package/dist/esm/common/constants.js +2 -1
  23. package/dist/esm/controllers/form-context/main.js +17 -5
  24. package/dist/esm/ui/create-form/main.js +32 -20
  25. package/dist/esm/ui/create-form/messages.js +13 -0
  26. package/dist/esm/ui/create-form/textfield/main.js +4 -3
  27. package/dist/esm/ui/error-boundary/error-boundary-ui/error-svg/index.js +46 -44
  28. package/dist/esm/ui/error-boundary/error-boundary-ui/messages.js +1 -1
  29. package/dist/esm/ui/main.js +23 -5
  30. package/dist/esm/ui/messages.js +8 -0
  31. package/dist/esm/version.json +1 -1
  32. package/dist/types/common/constants.d.ts +1 -0
  33. package/dist/types/controllers/callback-context/main.d.ts +1 -1
  34. package/dist/types/controllers/form-context/main.d.ts +2 -0
  35. package/dist/types/ui/create-form/main.d.ts +3 -3
  36. package/dist/types/ui/create-form/messages.d.ts +12 -0
  37. package/dist/types/ui/create-form/textfield/main.d.ts +1 -1
  38. package/dist/types/ui/create-form/textfield/types.d.ts +2 -0
  39. package/dist/types/ui/messages.d.ts +7 -0
  40. package/package.json +6 -4
  41. package/report.api.md +15 -4
  42. package/tmp/api-report-tmp.d.ts +10 -5
  43. package/dist/cjs/ui/create-form/styled.js +0 -13
  44. package/dist/cjs/ui/error-boundary/error-boundary-ui/error-svg/styled.js +0 -13
  45. package/dist/es2019/ui/create-form/styled.js +0 -7
  46. package/dist/es2019/ui/error-boundary/error-boundary-ui/error-svg/styled.js +0 -7
  47. package/dist/esm/ui/create-form/styled.js +0 -5
  48. package/dist/esm/ui/error-boundary/error-boundary-ui/error-svg/styled.js +0 -5
  49. package/dist/types/ui/create-form/styled.d.ts +0 -1
  50. package/dist/types/ui/error-boundary/error-boundary-ui/error-svg/styled.d.ts +0 -1
@@ -1,10 +1,10 @@
1
1
  /** @jsx jsx */
2
2
  import { ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- export interface CreateFormProps {
4
+ export interface CreateFormProps<FormData> {
5
5
  children: ReactNode;
6
6
  testId?: string;
7
7
  onCancel?: () => void;
8
- onSubmit: (data: Record<string, unknown>) => void;
8
+ onSubmit: (data: FormData) => void;
9
9
  }
10
- export declare const CreateForm: (props: any) => jsx.JSX.Element;
10
+ export declare const CreateForm: <FormData_1 extends Record<string, any> = {}>({ children, testId, onCancel, onSubmit, }: CreateFormProps<FormData_1>) => jsx.JSX.Element;
@@ -0,0 +1,12 @@
1
+ export declare const messages: {
2
+ cancel: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ create: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
@@ -6,4 +6,4 @@ import { TextFieldProps } from './types';
6
6
  * the handleSubmit function passed to the form <Form> that have a key matching the `name`
7
7
  * of this text field are shown above the field.
8
8
  */
9
- export declare function TextField({ label, name, validationHelpText, isRequired, testId, validators, }: TextFieldProps): jsx.JSX.Element;
9
+ export declare function TextField({ label, name, validationHelpText, isRequired, testId, validators, placeholder, }: TextFieldProps): jsx.JSX.Element;
@@ -4,6 +4,8 @@ export interface TextFieldProps {
4
4
  name: string;
5
5
  /** This should be properly internationalization-ed */
6
6
  label: string;
7
+ /** This should be properly internationalization-ed */
8
+ placeholder?: string;
7
9
  /**
8
10
  * Optional text below the textfield explaining any requirements for a valid value.
9
11
  * eg. "Must be 4 or more letters"
@@ -0,0 +1,7 @@
1
+ export declare const messages: {
2
+ heading: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "The driver component of meta creation flow",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,7 +29,8 @@
29
29
  "@atlaskit/analytics-next": "^9.0.0",
30
30
  "@atlaskit/button": "^16.6.0",
31
31
  "@atlaskit/empty-state": "^7.4.0",
32
- "@atlaskit/form": "^8.8.4",
32
+ "@atlaskit/form": "^8.10.0",
33
+ "@atlaskit/icon": "^21.11.0",
33
34
  "@atlaskit/modal-dialog": "^12.4.4",
34
35
  "@atlaskit/select": "^16.1.5",
35
36
  "@atlaskit/textfield": "^5.3.5",
@@ -51,13 +52,14 @@
51
52
  "@atlaskit/visual-regression": "*",
52
53
  "@atlaskit/webdriver-runner": "*",
53
54
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
54
- "@atlassian/link-create-confluence": "^3.0.0",
55
+ "@atlassian/link-create-confluence": "^4.0.0",
55
56
  "@atlassian/link-create-presets": "^2.0.0",
56
57
  "@atlassian/link-picker-plugins": "^18.1.0",
57
58
  "@atlassian/recent-work-client": "^1.7.0",
58
- "@atlassian/search-client": "^0.6.0",
59
+ "@atlassian/search-client": "^0.7.0",
59
60
  "@testing-library/react": "^12.1.5",
60
61
  "@testing-library/user-event": "^14.4.3",
62
+ "fetch-mock": "^8.0.0",
61
63
  "react-dom": "^16.8.0",
62
64
  "typescript": "4.5.5",
63
65
  "wait-for-expect": "^1.2.0"
package/report.api.md CHANGED
@@ -52,16 +52,21 @@ const ComposedLinkCreate: MemoExoticComponent<
52
52
  export default ComposedLinkCreate;
53
53
 
54
54
  // @public (undocumented)
55
- export const CreateForm: (props: any) => jsx.JSX.Element;
55
+ export const CreateForm: <FormData_1 extends Record<string, any> = {}>({
56
+ children,
57
+ testId,
58
+ onCancel,
59
+ onSubmit,
60
+ }: CreateFormProps<FormData_1>) => jsx.JSX.Element;
56
61
 
57
62
  // @public (undocumented)
58
- export interface CreateFormProps {
63
+ export interface CreateFormProps<FormData> {
59
64
  // (undocumented)
60
65
  children: ReactNode;
61
66
  // (undocumented)
62
67
  onCancel?: () => void;
63
68
  // (undocumented)
64
- onSubmit: (data: Record<string, unknown>) => void;
69
+ onSubmit: (data: FormData) => void;
65
70
  // (undocumented)
66
71
  testId?: string;
67
72
  }
@@ -74,7 +79,11 @@ interface FormContextType {
74
79
  // (undocumented)
75
80
  assignValidator: (name: string, validators: Validator[]) => void;
76
81
  // (undocumented)
82
+ formErrorMessage?: string;
83
+ // (undocumented)
77
84
  getValidators: () => ValidatorMap;
85
+ // (undocumented)
86
+ setFormErrorMessage: (errorMessage?: string) => void;
78
87
  }
79
88
 
80
89
  // @public (undocumented)
@@ -95,7 +104,7 @@ interface LinkCreateCallbackProviderProps {
95
104
  objectId: string;
96
105
  objectType: string;
97
106
  }) => void;
98
- onFailure?: (error: unknown) => void;
107
+ onFailure?: (errorMessage: string) => void;
99
108
  }
100
109
 
101
110
  // @public (undocumented)
@@ -136,6 +145,7 @@ export function TextField({
136
145
  isRequired,
137
146
  testId,
138
147
  validators,
148
+ placeholder,
139
149
  }: TextFieldProps): jsx.JSX.Element;
140
150
 
141
151
  // @public (undocumented)
@@ -143,6 +153,7 @@ interface TextFieldProps {
143
153
  isRequired?: boolean;
144
154
  label: string;
145
155
  name: string;
156
+ placeholder?: string;
146
157
  // (undocumented)
147
158
  testId?: string;
148
159
  validationHelpText?: string;
@@ -31,16 +31,16 @@ const ComposedLinkCreate: MemoExoticComponent<(props: LinkCreateProps) => jsx.JS
31
31
  export default ComposedLinkCreate;
32
32
 
33
33
  // @public (undocumented)
34
- export const CreateForm: (props: any) => jsx.JSX.Element;
34
+ export const CreateForm: <FormData_1 extends Record<string, any> = {}>({ children, testId, onCancel, onSubmit, }: CreateFormProps<FormData_1>) => jsx.JSX.Element;
35
35
 
36
36
  // @public (undocumented)
37
- export interface CreateFormProps {
37
+ export interface CreateFormProps<FormData> {
38
38
  // (undocumented)
39
39
  children: ReactNode;
40
40
  // (undocumented)
41
41
  onCancel?: () => void;
42
42
  // (undocumented)
43
- onSubmit: (data: Record<string, unknown>) => void;
43
+ onSubmit: (data: FormData) => void;
44
44
  // (undocumented)
45
45
  testId?: string;
46
46
  }
@@ -53,7 +53,11 @@ interface FormContextType {
53
53
  // (undocumented)
54
54
  assignValidator: (name: string, validators: Validator[]) => void;
55
55
  // (undocumented)
56
+ formErrorMessage?: string;
57
+ // (undocumented)
56
58
  getValidators: () => ValidatorMap;
59
+ // (undocumented)
60
+ setFormErrorMessage: (errorMessage?: string) => void;
57
61
  }
58
62
 
59
63
  // @public (undocumented)
@@ -74,7 +78,7 @@ interface LinkCreateCallbackProviderProps {
74
78
  objectId: string;
75
79
  objectType: string;
76
80
  }) => void;
77
- onFailure?: (error: unknown) => void;
81
+ onFailure?: (errorMessage: string) => void;
78
82
  }
79
83
 
80
84
  // @public (undocumented)
@@ -108,13 +112,14 @@ interface Option_2 {
108
112
  export { Option_2 as Option }
109
113
 
110
114
  // @public
111
- export function TextField({ label, name, validationHelpText, isRequired, testId, validators, }: TextFieldProps): jsx.JSX.Element;
115
+ export function TextField({ label, name, validationHelpText, isRequired, testId, validators, placeholder, }: TextFieldProps): jsx.JSX.Element;
112
116
 
113
117
  // @public (undocumented)
114
118
  interface TextFieldProps {
115
119
  isRequired?: boolean;
116
120
  label: string;
117
121
  name: string;
122
+ placeholder?: string;
118
123
  // (undocumented)
119
124
  testId?: string;
120
125
  validationHelpText?: string;
@@ -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
- exports.formStyles = void 0;
8
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
- var _react = require("@emotion/react");
10
- var _templateObject;
11
- var CREATE_FORM_MAX_WIDTH_IN_PX = '600';
12
- var formStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 auto;\n max-width: ", "px;\n padding: 0 0 ", " 0;\n"])), CREATE_FORM_MAX_WIDTH_IN_PX, "var(--ds-space-300, 24px)");
13
- exports.formStyles = formStyles;
@@ -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
- exports.errorStyles = void 0;
8
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
- var _react = require("@emotion/react");
10
- var _templateObject;
11
- var WIDTH = 82;
12
- var errorStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: ", "px;\n margin: 0 auto ", ";\n display: block;\n"])), WIDTH, "var(--ds-space-300, 24px)");
13
- exports.errorStyles = errorStyles;
@@ -1,7 +0,0 @@
1
- import { css } from '@emotion/react';
2
- const CREATE_FORM_MAX_WIDTH_IN_PX = '600';
3
- export const formStyles = css`
4
- margin: 0 auto;
5
- max-width: ${CREATE_FORM_MAX_WIDTH_IN_PX}px;
6
- padding: 0 0 ${"var(--ds-space-300, 24px)"} 0;
7
- `;
@@ -1,7 +0,0 @@
1
- import { css } from '@emotion/react';
2
- const WIDTH = 82;
3
- export const errorStyles = css`
4
- width: ${WIDTH}px;
5
- margin: 0 auto ${"var(--ds-space-300, 24px)"};
6
- display: block;
7
- `;
@@ -1,5 +0,0 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
3
- import { css } from '@emotion/react';
4
- var CREATE_FORM_MAX_WIDTH_IN_PX = '600';
5
- export var formStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 0 auto;\n max-width: ", "px;\n padding: 0 0 ", " 0;\n"])), CREATE_FORM_MAX_WIDTH_IN_PX, "var(--ds-space-300, 24px)");
@@ -1,5 +0,0 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
3
- import { css } from '@emotion/react';
4
- var WIDTH = 82;
5
- export var errorStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: ", "px;\n margin: 0 auto ", ";\n display: block;\n"])), WIDTH, "var(--ds-space-300, 24px)");
@@ -1 +0,0 @@
1
- export declare const formStyles: import("@emotion/react").SerializedStyles;
@@ -1 +0,0 @@
1
- export declare const errorStyles: import("@emotion/react").SerializedStyles;