@atlaskit/link-create 0.5.1 → 0.5.2

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/link-create
2
2
 
3
+ ## 0.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7734ef0bdb4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7734ef0bdb4) - allowing default values in confluence creation form.
8
+
3
9
  ## 0.5.1
4
10
 
5
11
  ### Patch Changes
@@ -12,7 +12,7 @@ var _react2 = require("@emotion/react");
12
12
  var _form = require("@atlaskit/form");
13
13
  var _select = require("@atlaskit/select");
14
14
  var _formContext = require("../../../controllers/form-context");
15
- var _excluded = ["label", "name", "validationHelpText", "isRequired", "testId", "validators"];
15
+ var _excluded = ["label", "name", "validationHelpText", "isRequired", "testId", "validators", "defaultValue"];
16
16
  /** @jsx jsx */
17
17
  /**
18
18
  * An async select utilising the Atlaskit AsyncSelect and Field objects from `@atlaskit/form`.
@@ -27,6 +27,7 @@ function AsyncSelect(_ref) {
27
27
  isRequired = _ref.isRequired,
28
28
  testId = _ref.testId,
29
29
  validators = _ref.validators,
30
+ defaultValue = _ref.defaultValue,
30
31
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
31
32
  var _useFormContext = (0, _formContext.useFormContext)(),
32
33
  assignValidator = _useFormContext.assignValidator;
@@ -40,7 +41,8 @@ function AsyncSelect(_ref) {
40
41
  }, (0, _react2.jsx)(_form.Field, {
41
42
  name: name,
42
43
  label: label,
43
- isRequired: isRequired
44
+ isRequired: isRequired,
45
+ defaultValue: defaultValue
44
46
  }, function (_ref2) {
45
47
  var fieldProps = _ref2.fieldProps,
46
48
  error = _ref2.error;
@@ -12,7 +12,7 @@ var _react2 = require("@emotion/react");
12
12
  var _form = require("@atlaskit/form");
13
13
  var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
14
14
  var _formContext = require("../../../controllers/form-context");
15
- var _excluded = ["label", "name", "validationHelpText", "validators"];
15
+ var _excluded = ["label", "name", "validationHelpText", "validators", "defaultValue"];
16
16
  /** @jsx jsx */
17
17
  /**
18
18
  * A text field utilising the Atlaskit Textfield and Field objects from `@atlaskit/form`.
@@ -26,6 +26,7 @@ function TextField(_ref) {
26
26
  name = _ref.name,
27
27
  validationHelpText = _ref.validationHelpText,
28
28
  validators = _ref.validators,
29
+ defaultValue = _ref.defaultValue,
29
30
  restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
30
31
  var _useFormContext = (0, _formContext.useFormContext)(),
31
32
  assignValidator = _useFormContext.assignValidator;
@@ -34,13 +35,22 @@ function TextField(_ref) {
34
35
  assignValidator(name, validators);
35
36
  }
36
37
  }, [name, validators, assignValidator]);
37
- return (0, _react2.jsx)(_form.Field, {
38
- name: name,
39
- label: label,
40
- defaultValue: ''
41
- }, function (_ref2) {
42
- var fieldProps = _ref2.fieldProps,
43
- error = _ref2.error;
44
- return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_textfield.default, (0, _extends2.default)({}, fieldProps, restProps)), !error && (0, _react2.jsx)(_form.HelperMessage, null, validationHelpText), error && (0, _react2.jsx)(_form.ErrorMessage, null, error));
45
- });
38
+ return (
39
+ /**
40
+ * The defaultValue here should be '' when there is nothing passed in from the props.
41
+ * This is because if we don't give it anything, the `fieldProps` wouldn't have a `value`
42
+ * prop and make the TextField component uncontrolled. Later when user starts typing, the
43
+ * `value` will be populated again in `fieldProps` which cause the TextField to be changed
44
+ * to a controlled component and raise a warning from React.
45
+ */
46
+ (0, _react2.jsx)(_form.Field, {
47
+ name: name,
48
+ label: label,
49
+ defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : ''
50
+ }, function (_ref2) {
51
+ var fieldProps = _ref2.fieldProps,
52
+ error = _ref2.error;
53
+ return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_textfield.default, (0, _extends2.default)({}, fieldProps, restProps)), !error && (0, _react2.jsx)(_form.HelperMessage, null, validationHelpText), error && (0, _react2.jsx)(_form.ErrorMessage, null, error));
54
+ })
55
+ );
46
56
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "sideEffects": false
5
5
  }
@@ -18,6 +18,7 @@ export function AsyncSelect({
18
18
  isRequired,
19
19
  testId,
20
20
  validators,
21
+ defaultValue,
21
22
  ...rest
22
23
  }) {
23
24
  const {
@@ -33,7 +34,8 @@ export function AsyncSelect({
33
34
  }, jsx(Field, {
34
35
  name: name,
35
36
  label: label,
36
- isRequired: isRequired
37
+ isRequired: isRequired,
38
+ defaultValue: defaultValue
37
39
  }, ({
38
40
  fieldProps,
39
41
  error
@@ -17,6 +17,7 @@ export function TextField({
17
17
  name,
18
18
  validationHelpText,
19
19
  validators,
20
+ defaultValue,
20
21
  ...restProps
21
22
  }) {
22
23
  const {
@@ -27,12 +28,23 @@ export function TextField({
27
28
  assignValidator(name, validators);
28
29
  }
29
30
  }, [name, validators, assignValidator]);
30
- return jsx(Field, {
31
- name: name,
32
- label: label,
33
- defaultValue: ''
34
- }, ({
35
- fieldProps,
36
- error
37
- }) => jsx(Fragment, null, jsx(AkTextfield, _extends({}, fieldProps, restProps)), !error && jsx(HelperMessage, null, validationHelpText), error && jsx(ErrorMessage, null, error)));
31
+ return (
32
+ /**
33
+ * The defaultValue here should be '' when there is nothing passed in from the props.
34
+ * This is because if we don't give it anything, the `fieldProps` wouldn't have a `value`
35
+ * prop and make the TextField component uncontrolled. Later when user starts typing, the
36
+ * `value` will be populated again in `fieldProps` which cause the TextField to be changed
37
+ * to a controlled component and raise a warning from React.
38
+ */
39
+ jsx(Field, {
40
+ name: name,
41
+ label: label,
42
+ defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : ''
43
+ }, ({
44
+ fieldProps,
45
+ error
46
+ }) => {
47
+ return jsx(Fragment, null, jsx(AkTextfield, _extends({}, fieldProps, restProps)), !error && jsx(HelperMessage, null, validationHelpText), error && jsx(ErrorMessage, null, error));
48
+ })
49
+ );
38
50
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["label", "name", "validationHelpText", "isRequired", "testId", "validators"];
3
+ var _excluded = ["label", "name", "validationHelpText", "isRequired", "testId", "validators", "defaultValue"];
4
4
  /** @jsx jsx */
5
5
  import { Fragment, useEffect } from 'react';
6
6
  import { jsx } from '@emotion/react';
@@ -20,6 +20,7 @@ export function AsyncSelect(_ref) {
20
20
  isRequired = _ref.isRequired,
21
21
  testId = _ref.testId,
22
22
  validators = _ref.validators,
23
+ defaultValue = _ref.defaultValue,
23
24
  rest = _objectWithoutProperties(_ref, _excluded);
24
25
  var _useFormContext = useFormContext(),
25
26
  assignValidator = _useFormContext.assignValidator;
@@ -33,7 +34,8 @@ export function AsyncSelect(_ref) {
33
34
  }, jsx(Field, {
34
35
  name: name,
35
36
  label: label,
36
- isRequired: isRequired
37
+ isRequired: isRequired,
38
+ defaultValue: defaultValue
37
39
  }, function (_ref2) {
38
40
  var fieldProps = _ref2.fieldProps,
39
41
  error = _ref2.error;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["label", "name", "validationHelpText", "validators"];
3
+ var _excluded = ["label", "name", "validationHelpText", "validators", "defaultValue"];
4
4
  /** @jsx jsx */
5
5
  import { Fragment, useEffect } from 'react';
6
6
  import { jsx } from '@emotion/react';
@@ -19,6 +19,7 @@ export function TextField(_ref) {
19
19
  name = _ref.name,
20
20
  validationHelpText = _ref.validationHelpText,
21
21
  validators = _ref.validators,
22
+ defaultValue = _ref.defaultValue,
22
23
  restProps = _objectWithoutProperties(_ref, _excluded);
23
24
  var _useFormContext = useFormContext(),
24
25
  assignValidator = _useFormContext.assignValidator;
@@ -27,13 +28,22 @@ export function TextField(_ref) {
27
28
  assignValidator(name, validators);
28
29
  }
29
30
  }, [name, validators, assignValidator]);
30
- return jsx(Field, {
31
- name: name,
32
- label: label,
33
- defaultValue: ''
34
- }, function (_ref2) {
35
- var fieldProps = _ref2.fieldProps,
36
- error = _ref2.error;
37
- return jsx(Fragment, null, jsx(AkTextfield, _extends({}, fieldProps, restProps)), !error && jsx(HelperMessage, null, validationHelpText), error && jsx(ErrorMessage, null, error));
38
- });
31
+ return (
32
+ /**
33
+ * The defaultValue here should be '' when there is nothing passed in from the props.
34
+ * This is because if we don't give it anything, the `fieldProps` wouldn't have a `value`
35
+ * prop and make the TextField component uncontrolled. Later when user starts typing, the
36
+ * `value` will be populated again in `fieldProps` which cause the TextField to be changed
37
+ * to a controlled component and raise a warning from React.
38
+ */
39
+ jsx(Field, {
40
+ name: name,
41
+ label: label,
42
+ defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : ''
43
+ }, function (_ref2) {
44
+ var fieldProps = _ref2.fieldProps,
45
+ error = _ref2.error;
46
+ return jsx(Fragment, null, jsx(AkTextfield, _extends({}, fieldProps, restProps)), !error && jsx(HelperMessage, null, validationHelpText), error && jsx(ErrorMessage, null, error));
47
+ })
48
+ );
39
49
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "sideEffects": false
5
5
  }
@@ -7,4 +7,4 @@ import { AsyncSelectProps } from './types';
7
7
  * the handleSubmit function passed to the form <Form> that have a key matching the `name`
8
8
  * of this text field are shown above the field.
9
9
  */
10
- export declare function AsyncSelect<T = OptionType>({ label, name, validationHelpText, isRequired, testId, validators, ...rest }: AsyncSelectProps<T>): jsx.JSX.Element;
10
+ export declare function AsyncSelect<T = OptionType>({ label, name, validationHelpText, isRequired, testId, validators, defaultValue, ...rest }: AsyncSelectProps<T>): jsx.JSX.Element;
@@ -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, validators, ...restProps }: TextFieldProps): jsx.JSX.Element;
9
+ export declare function TextField({ label, name, validationHelpText, validators, defaultValue, ...restProps }: TextFieldProps): jsx.JSX.Element;
@@ -7,4 +7,4 @@ import { AsyncSelectProps } from './types';
7
7
  * the handleSubmit function passed to the form <Form> that have a key matching the `name`
8
8
  * of this text field are shown above the field.
9
9
  */
10
- export declare function AsyncSelect<T = OptionType>({ label, name, validationHelpText, isRequired, testId, validators, ...rest }: AsyncSelectProps<T>): jsx.JSX.Element;
10
+ export declare function AsyncSelect<T = OptionType>({ label, name, validationHelpText, isRequired, testId, validators, defaultValue, ...rest }: AsyncSelectProps<T>): jsx.JSX.Element;
@@ -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, validators, ...restProps }: TextFieldProps): jsx.JSX.Element;
9
+ export declare function TextField({ label, name, validationHelpText, validators, defaultValue, ...restProps }: TextFieldProps): jsx.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "The driver component of meta creation flow",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -40,9 +40,9 @@
40
40
  "@atlaskit/form": "^8.11.0",
41
41
  "@atlaskit/icon": "^21.12.0",
42
42
  "@atlaskit/modal-dialog": "^12.5.0",
43
- "@atlaskit/select": "^16.2.0",
43
+ "@atlaskit/select": "^16.4.0",
44
44
  "@atlaskit/spinner": "^15.4.0",
45
- "@atlaskit/textfield": "^5.4.0",
45
+ "@atlaskit/textfield": "^5.5.0",
46
46
  "@atlaskit/tokens": "^1.4.0",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "@emotion/react": "^11.7.1"
@@ -53,20 +53,20 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@atlaskit/docs": "*",
56
- "@atlaskit/link-picker": "^1.20.0",
56
+ "@atlaskit/link-picker": "^1.22.0",
57
57
  "@atlaskit/link-provider": "^1.6.0",
58
- "@atlaskit/link-test-helpers": "^3.1.0",
58
+ "@atlaskit/link-test-helpers": "^4.0.0",
59
59
  "@atlaskit/popup": "^1.6.0",
60
60
  "@atlaskit/ssr": "*",
61
61
  "@atlaskit/visual-regression": "*",
62
62
  "@atlaskit/webdriver-runner": "*",
63
63
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
64
- "@atlassian/link-create-confluence": "^6.0.0",
64
+ "@atlassian/link-create-confluence": "^6.1.0",
65
65
  "@atlassian/link-create-presets": "^4.0.0",
66
- "@atlassian/link-picker-atlassian-plugin": "^30.1.0",
67
- "@atlassian/link-picker-plugins": "^20.1.0",
66
+ "@atlassian/link-picker-atlassian-plugin": "^32.1.0",
67
+ "@atlassian/link-picker-plugins": "^22.1.0",
68
68
  "@atlassian/recent-work-client": "^1.8.0",
69
- "@atlassian/search-client": "^0.9.0",
69
+ "@atlassian/search-client": "^0.10.0",
70
70
  "@testing-library/react": "^12.1.5",
71
71
  "@testing-library/user-event": "^14.4.3",
72
72
  "fetch-mock": "^8.0.0",
package/report.api.md CHANGED
@@ -34,6 +34,7 @@ export function AsyncSelect<T = OptionType>({
34
34
  isRequired,
35
35
  testId,
36
36
  validators,
37
+ defaultValue,
37
38
  ...rest
38
39
  }: AsyncSelectProps<T>): jsx.JSX.Element;
39
40
 
@@ -156,6 +157,7 @@ export function TextField({
156
157
  name,
157
158
  validationHelpText,
158
159
  validators,
160
+ defaultValue,
159
161
  ...restProps
160
162
  }: TextFieldProps): jsx.JSX.Element;
161
163
 
@@ -16,7 +16,7 @@ import { SpinnerProps } from '@atlaskit/spinner';
16
16
  import { TextFieldProps as TextFieldProps_2 } from '@atlaskit/textfield';
17
17
 
18
18
  // @public
19
- export function AsyncSelect<T = OptionType>({ label, name, validationHelpText, isRequired, testId, validators, ...rest }: AsyncSelectProps<T>): jsx.JSX.Element;
19
+ export function AsyncSelect<T = OptionType>({ label, name, validationHelpText, isRequired, testId, validators, defaultValue, ...rest }: AsyncSelectProps<T>): jsx.JSX.Element;
20
20
 
21
21
  // @public (undocumented)
22
22
  type AsyncSelectProps<T = OptionType> = AsyncSelectProps_2<T> & {
@@ -121,7 +121,7 @@ interface Option_2 {
121
121
  export { Option_2 as Option }
122
122
 
123
123
  // @public
124
- export function TextField({ label, name, validationHelpText, validators, ...restProps }: TextFieldProps): jsx.JSX.Element;
124
+ export function TextField({ label, name, validationHelpText, validators, defaultValue, ...restProps }: TextFieldProps): jsx.JSX.Element;
125
125
 
126
126
  // @public (undocumented)
127
127
  type TextFieldProps = Omit<TextFieldProps_2, 'isRequired' | 'name'> & {