@atlaskit/link-create 0.8.2 → 0.9.1
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 +12 -0
- package/dist/cjs/ui/create-form/async-select/main.js +8 -2
- package/dist/cjs/ui/create-form/form-footer/index.js +12 -0
- package/dist/cjs/ui/create-form/form-footer/main.js +48 -0
- package/dist/cjs/ui/create-form/main.js +14 -36
- package/dist/cjs/ui/create-form/textfield/main.js +13 -4
- package/dist/cjs/ui/link-create/main.js +6 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/ui/create-form/async-select/main.js +5 -2
- package/dist/es2019/ui/create-form/form-footer/index.js +1 -0
- package/dist/es2019/ui/create-form/form-footer/main.js +38 -0
- package/dist/es2019/ui/create-form/main.js +11 -32
- package/dist/es2019/ui/create-form/textfield/main.js +9 -2
- package/dist/es2019/ui/link-create/main.js +3 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/ui/create-form/async-select/main.js +6 -2
- package/dist/esm/ui/create-form/form-footer/index.js +1 -0
- package/dist/esm/ui/create-form/form-footer/main.js +37 -0
- package/dist/esm/ui/create-form/main.js +12 -32
- package/dist/esm/ui/create-form/textfield/main.js +11 -3
- package/dist/esm/ui/link-create/main.js +4 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/ui/create-form/async-select/main.d.ts +1 -0
- package/dist/types/ui/create-form/form-footer/index.d.ts +1 -0
- package/dist/types/ui/create-form/form-footer/main.d.ts +9 -0
- package/dist/types/ui/create-form/main.d.ts +1 -0
- package/dist/types/ui/create-form/textfield/main.d.ts +2 -1
- package/dist/types/ui/link-create/main.d.ts +1 -0
- package/dist/types-ts4.5/ui/create-form/async-select/main.d.ts +1 -0
- package/dist/types-ts4.5/ui/create-form/form-footer/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/create-form/form-footer/main.d.ts +9 -0
- package/dist/types-ts4.5/ui/create-form/main.d.ts +1 -0
- package/dist/types-ts4.5/ui/create-form/textfield/main.d.ts +2 -1
- package/dist/types-ts4.5/ui/link-create/main.d.ts +1 -0
- package/package.json +8 -2
- package/report.api.md +1 -0
- /package/dist/cjs/ui/create-form/{messages.js → form-footer/messages.js} +0 -0
- /package/dist/es2019/ui/create-form/{messages.js → form-footer/messages.js} +0 -0
- /package/dist/esm/ui/create-form/{messages.js → form-footer/messages.js} +0 -0
- /package/dist/types/ui/create-form/{messages.d.ts → form-footer/messages.d.ts} +0 -0
- /package/dist/types-ts4.5/ui/create-form/{messages.d.ts → form-footer/messages.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/link-create
|
|
2
2
|
|
|
3
|
+
## 0.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`84b33e5a4b6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/84b33e5a4b6) - EDM-6544: minor internal refactors with no expected functional change
|
|
8
|
+
|
|
9
|
+
## 0.9.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`c209f670761`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c209f670761) - Improved testIds
|
|
14
|
+
|
|
3
15
|
## 0.8.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.AsyncSelect = AsyncSelect;
|
|
8
|
+
exports.TEST_ID = void 0;
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
11
|
var _react = require("react");
|
|
@@ -15,18 +16,21 @@ var _form2 = require("../../../common/utils/form");
|
|
|
15
16
|
var _formContext = require("../../../controllers/form-context");
|
|
16
17
|
var _excluded = ["label", "name", "validationHelpText", "isRequired", "testId", "validators", "defaultValue"];
|
|
17
18
|
/** @jsx jsx */
|
|
19
|
+
var TEST_ID = 'link-create-async-select';
|
|
18
20
|
/**
|
|
19
21
|
* An async select utilising the Atlaskit AsyncSelect and Field objects from `@atlaskit/form`.
|
|
20
22
|
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
21
23
|
* the handleSubmit function passed to the form <Form> that have a key matching the `name`
|
|
22
24
|
* of this text field are shown above the field.
|
|
23
25
|
*/
|
|
26
|
+
exports.TEST_ID = TEST_ID;
|
|
24
27
|
function AsyncSelect(_ref) {
|
|
25
28
|
var label = _ref.label,
|
|
26
29
|
name = _ref.name,
|
|
27
30
|
validationHelpText = _ref.validationHelpText,
|
|
28
31
|
isRequired = _ref.isRequired,
|
|
29
|
-
testId = _ref.testId,
|
|
32
|
+
_ref$testId = _ref.testId,
|
|
33
|
+
testId = _ref$testId === void 0 ? TEST_ID : _ref$testId,
|
|
30
34
|
validators = _ref.validators,
|
|
31
35
|
defaultValue = _ref.defaultValue,
|
|
32
36
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -51,7 +55,9 @@ function AsyncSelect(_ref) {
|
|
|
51
55
|
var isInvalid = (0, _form2.validateSubmitErrors)(meta);
|
|
52
56
|
return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_select.AsyncSelect, (0, _extends2.default)({}, fieldProps, rest, {
|
|
53
57
|
isInvalid: isInvalid
|
|
54
|
-
})), !error && validationHelpText && (0, _react2.jsx)(_form.HelperMessage,
|
|
58
|
+
})), !error && validationHelpText && (0, _react2.jsx)(_form.HelperMessage, {
|
|
59
|
+
testId: "".concat(testId, "-helper-message")
|
|
60
|
+
}, validationHelpText), isInvalid && (0, _react2.jsx)(_form.ErrorMessage, {
|
|
55
61
|
testId: "".concat(testId, "-error-message")
|
|
56
62
|
}, error));
|
|
57
63
|
}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "CreateFormFooter", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _main.CreateFormFooter;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _main = require("./main");
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.CreateFormFooter = CreateFormFooter;
|
|
9
|
+
var _react = require("@emotion/react");
|
|
10
|
+
var _reactIntlNext = require("react-intl-next");
|
|
11
|
+
var _button = _interopRequireWildcard(require("@atlaskit/button"));
|
|
12
|
+
var _loadingButton = _interopRequireDefault(require("@atlaskit/button/loading-button"));
|
|
13
|
+
var _form = require("@atlaskit/form");
|
|
14
|
+
var _error = _interopRequireDefault(require("@atlaskit/icon/glyph/error"));
|
|
15
|
+
var _messages = require("./messages");
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
+
/** @jsx jsx */
|
|
19
|
+
|
|
20
|
+
var errorStyles = (0, _react.css)({
|
|
21
|
+
display: 'flex',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
marginRight: 'auto'
|
|
24
|
+
});
|
|
25
|
+
function CreateFormFooter(_ref) {
|
|
26
|
+
var formErrorMessage = _ref.formErrorMessage,
|
|
27
|
+
handleCancel = _ref.handleCancel,
|
|
28
|
+
submitting = _ref.submitting,
|
|
29
|
+
testId = _ref.testId;
|
|
30
|
+
var intl = (0, _reactIntlNext.useIntl)();
|
|
31
|
+
return (0, _react.jsx)(_form.FormFooter, null, formErrorMessage && (0, _react.jsx)("div", {
|
|
32
|
+
css: errorStyles,
|
|
33
|
+
"data-testid": "".concat(testId, "-error")
|
|
34
|
+
}, (0, _react.jsx)(_error.default, {
|
|
35
|
+
label: formErrorMessage,
|
|
36
|
+
primaryColor: "var(--ds-icon-danger, #E34935)"
|
|
37
|
+
}), formErrorMessage), (0, _react.jsx)(_button.ButtonGroup, null, (0, _react.jsx)(_button.default, {
|
|
38
|
+
type: "button",
|
|
39
|
+
appearance: "subtle",
|
|
40
|
+
onClick: handleCancel,
|
|
41
|
+
testId: "".concat(testId, "-button-cancel")
|
|
42
|
+
}, intl.formatMessage(_messages.messages.close)), (0, _react.jsx)(_loadingButton.default, {
|
|
43
|
+
type: "submit",
|
|
44
|
+
appearance: "primary",
|
|
45
|
+
isLoading: submitting,
|
|
46
|
+
testId: "".concat(testId, "-button-submit")
|
|
47
|
+
}, intl.formatMessage(_messages.messages.create))));
|
|
48
|
+
}
|
|
@@ -1,31 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.CreateForm = void 0;
|
|
7
|
+
exports.TEST_ID = exports.CreateForm = void 0;
|
|
9
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
11
|
var _react = require("react");
|
|
13
12
|
var _react2 = require("@emotion/react");
|
|
14
|
-
var _reactIntlNext = require("react-intl-next");
|
|
15
13
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
16
|
-
var
|
|
17
|
-
var _loadingButton = _interopRequireDefault(require("@atlaskit/button/loading-button"));
|
|
18
|
-
var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
|
|
19
|
-
var _form = _interopRequireWildcard(require("@atlaskit/form"));
|
|
20
|
-
var _error = _interopRequireDefault(require("@atlaskit/icon/glyph/error"));
|
|
14
|
+
var _form = _interopRequireDefault(require("@atlaskit/form"));
|
|
21
15
|
var _constants = require("../../common/constants");
|
|
22
16
|
var _analytics = _interopRequireDefault(require("../../common/utils/analytics/analytics.codegen"));
|
|
23
17
|
var _formContext = require("../../controllers/form-context");
|
|
18
|
+
var _formFooter = require("./form-footer");
|
|
24
19
|
var _formLoader = require("./form-loader");
|
|
25
|
-
var _messages = require("./messages");
|
|
26
20
|
var _utils = require("./utils");
|
|
27
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
21
|
/** @jsx jsx */
|
|
30
22
|
|
|
31
23
|
var formStyles = (0, _react2.css)({
|
|
@@ -33,19 +25,16 @@ var formStyles = (0, _react2.css)({
|
|
|
33
25
|
padding: "0 0 ".concat("var(--ds-space-300, 24px)", " 0"),
|
|
34
26
|
margin: "var(--ds-space-0, 0px)".concat(" auto")
|
|
35
27
|
});
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
alignItems: 'center',
|
|
39
|
-
marginRight: 'auto'
|
|
40
|
-
});
|
|
28
|
+
var TEST_ID = 'link-create-form';
|
|
29
|
+
exports.TEST_ID = TEST_ID;
|
|
41
30
|
var CreateForm = function CreateForm(_ref) {
|
|
42
31
|
var children = _ref.children,
|
|
43
|
-
testId = _ref.testId,
|
|
32
|
+
_ref$testId = _ref.testId,
|
|
33
|
+
testId = _ref$testId === void 0 ? TEST_ID : _ref$testId,
|
|
44
34
|
onSubmit = _ref.onSubmit,
|
|
45
35
|
onCancel = _ref.onCancel,
|
|
46
36
|
isLoading = _ref.isLoading,
|
|
47
37
|
hideFooter = _ref.hideFooter;
|
|
48
|
-
var intl = (0, _reactIntlNext.useIntl)();
|
|
49
38
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
50
39
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
51
40
|
var _useFormContext = (0, _formContext.useFormContext)(),
|
|
@@ -93,26 +82,15 @@ var CreateForm = function CreateForm(_ref) {
|
|
|
93
82
|
var formProps = _ref3.formProps,
|
|
94
83
|
submitting = _ref3.submitting;
|
|
95
84
|
return (0, _react2.jsx)("form", (0, _extends2.default)({}, formProps, {
|
|
96
|
-
name: "
|
|
85
|
+
name: "link-create-form",
|
|
97
86
|
"data-testid": testId,
|
|
98
87
|
css: formStyles
|
|
99
|
-
}), (0, _react2.jsx)("div", null, children), !hideFooter && (0, _react2.jsx)(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}), formErrorMessage), (0, _react2.jsx)(_button.ButtonGroup, null, (0, _react2.jsx)(_standardButton.default, {
|
|
106
|
-
type: "button",
|
|
107
|
-
appearance: "subtle",
|
|
108
|
-
onClick: handleCancel,
|
|
109
|
-
testId: 'close-button'
|
|
110
|
-
}, intl.formatMessage(_messages.messages.close)), (0, _react2.jsx)(_loadingButton.default, {
|
|
111
|
-
type: "submit",
|
|
112
|
-
appearance: "primary",
|
|
113
|
-
isLoading: submitting,
|
|
114
|
-
testId: 'create-button'
|
|
115
|
-
}, intl.formatMessage(_messages.messages.create)))));
|
|
88
|
+
}), (0, _react2.jsx)("div", null, children), !hideFooter && (0, _react2.jsx)(_formFooter.CreateFormFooter, {
|
|
89
|
+
formErrorMessage: formErrorMessage,
|
|
90
|
+
handleCancel: handleCancel,
|
|
91
|
+
submitting: submitting,
|
|
92
|
+
testId: testId
|
|
93
|
+
}));
|
|
116
94
|
});
|
|
117
95
|
};
|
|
118
96
|
exports.CreateForm = CreateForm;
|
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.TEST_ID = void 0;
|
|
7
8
|
exports.TextField = TextField;
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -13,18 +14,22 @@ var _form = require("@atlaskit/form");
|
|
|
13
14
|
var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
14
15
|
var _form2 = require("../../../common/utils/form");
|
|
15
16
|
var _formContext = require("../../../controllers/form-context");
|
|
16
|
-
var _excluded = ["label", "name", "validationHelpText", "validators", "defaultValue", "isRequired"];
|
|
17
|
+
var _excluded = ["label", "name", "testId", "validationHelpText", "validators", "defaultValue", "isRequired"];
|
|
17
18
|
/** @jsx jsx */
|
|
19
|
+
var TEST_ID = 'link-create-text-field';
|
|
20
|
+
|
|
18
21
|
/**
|
|
19
22
|
* A text field utilising the Atlaskit Textfield and Field objects from `@atlaskit/form`.
|
|
20
23
|
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
21
24
|
* the handleSubmit function passed to the form <Form> that have a key matching the `name`
|
|
22
25
|
* of this text field are shown above the field.
|
|
23
26
|
*/
|
|
24
|
-
|
|
27
|
+
exports.TEST_ID = TEST_ID;
|
|
25
28
|
function TextField(_ref) {
|
|
26
29
|
var label = _ref.label,
|
|
27
30
|
name = _ref.name,
|
|
31
|
+
_ref$testId = _ref.testId,
|
|
32
|
+
testId = _ref$testId === void 0 ? TEST_ID : _ref$testId,
|
|
28
33
|
validationHelpText = _ref.validationHelpText,
|
|
29
34
|
validators = _ref.validators,
|
|
30
35
|
defaultValue = _ref.defaultValue,
|
|
@@ -45,6 +50,7 @@ function TextField(_ref) {
|
|
|
45
50
|
* `value` will be populated again in `fieldProps` which cause the TextField to be changed
|
|
46
51
|
* to a controlled component and raise a warning from React.
|
|
47
52
|
*/
|
|
53
|
+
|
|
48
54
|
(0, _react2.jsx)(_form.Field, {
|
|
49
55
|
name: name,
|
|
50
56
|
label: label,
|
|
@@ -56,10 +62,13 @@ function TextField(_ref) {
|
|
|
56
62
|
error = _ref2.error;
|
|
57
63
|
var isInvalid = (0, _form2.validateSubmitErrors)(meta);
|
|
58
64
|
return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_textfield.default, (0, _extends2.default)({}, fieldProps, restProps, {
|
|
65
|
+
testId: testId,
|
|
59
66
|
isInvalid: isInvalid,
|
|
60
67
|
isRequired: false // Remove the default browser validation
|
|
61
|
-
})), !error && validationHelpText && (0, _react2.jsx)(_form.HelperMessage,
|
|
62
|
-
testId: "".concat(
|
|
68
|
+
})), !error && validationHelpText && (0, _react2.jsx)(_form.HelperMessage, {
|
|
69
|
+
testId: "".concat(testId, "-helper-message")
|
|
70
|
+
}, validationHelpText), error && isInvalid && (0, _react2.jsx)(_form.ErrorMessage, {
|
|
71
|
+
testId: "".concat(testId, "-error-message")
|
|
63
72
|
}, error));
|
|
64
73
|
})
|
|
65
74
|
);
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = void 0;
|
|
8
|
+
exports.default = exports.TEST_ID = void 0;
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -24,6 +24,8 @@ var _excluded = ["testId", "onCreate", "onFailure", "onCancel"],
|
|
|
24
24
|
/** @jsx jsx */
|
|
25
25
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
26
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
+
var TEST_ID = 'link-create';
|
|
28
|
+
exports.TEST_ID = TEST_ID;
|
|
27
29
|
var LinkCreateContent = function LinkCreateContent(_ref) {
|
|
28
30
|
var plugins = _ref.plugins,
|
|
29
31
|
entityKey = _ref.entityKey;
|
|
@@ -36,7 +38,8 @@ var LinkCreateContent = function LinkCreateContent(_ref) {
|
|
|
36
38
|
return (0, _react2.jsx)(_react.Fragment, null, chosenOne.form);
|
|
37
39
|
};
|
|
38
40
|
var LinkCreate = (0, _formContext.withLinkCreateFormContext)(function (_ref2) {
|
|
39
|
-
var testId = _ref2.testId,
|
|
41
|
+
var _ref2$testId = _ref2.testId,
|
|
42
|
+
testId = _ref2$testId === void 0 ? TEST_ID : _ref2$testId,
|
|
40
43
|
onCreate = _ref2.onCreate,
|
|
41
44
|
onFailure = _ref2.onFailure,
|
|
42
45
|
onCancel = _ref2.onCancel,
|
|
@@ -87,7 +90,7 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref4) {
|
|
|
87
90
|
createProps = (0, _objectWithoutProperties2.default)(_ref4, _excluded2);
|
|
88
91
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
89
92
|
return (0, _react2.jsx)(_modalDialog.ModalTransition, null, !!active && (0, _react2.jsx)(_modalDialog.default, {
|
|
90
|
-
testId:
|
|
93
|
+
testId: "link-create-modal",
|
|
91
94
|
onClose: createProps.onCancel,
|
|
92
95
|
shouldScrollInViewport: true,
|
|
93
96
|
onOpenComplete: onOpenComplete,
|
package/dist/cjs/version.json
CHANGED
|
@@ -6,6 +6,7 @@ import { ErrorMessage, Field, HelperMessage } from '@atlaskit/form';
|
|
|
6
6
|
import { AsyncSelect as AkAsyncSelect } from '@atlaskit/select';
|
|
7
7
|
import { validateSubmitErrors } from '../../../common/utils/form';
|
|
8
8
|
import { useFormContext } from '../../../controllers/form-context';
|
|
9
|
+
export const TEST_ID = 'link-create-async-select';
|
|
9
10
|
/**
|
|
10
11
|
* An async select utilising the Atlaskit AsyncSelect and Field objects from `@atlaskit/form`.
|
|
11
12
|
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
@@ -17,7 +18,7 @@ export function AsyncSelect({
|
|
|
17
18
|
name,
|
|
18
19
|
validationHelpText,
|
|
19
20
|
isRequired,
|
|
20
|
-
testId,
|
|
21
|
+
testId = TEST_ID,
|
|
21
22
|
validators,
|
|
22
23
|
defaultValue,
|
|
23
24
|
...rest
|
|
@@ -45,7 +46,9 @@ export function AsyncSelect({
|
|
|
45
46
|
const isInvalid = validateSubmitErrors(meta);
|
|
46
47
|
return jsx(Fragment, null, jsx(AkAsyncSelect, _extends({}, fieldProps, rest, {
|
|
47
48
|
isInvalid: isInvalid
|
|
48
|
-
})), !error && validationHelpText && jsx(HelperMessage,
|
|
49
|
+
})), !error && validationHelpText && jsx(HelperMessage, {
|
|
50
|
+
testId: `${testId}-helper-message`
|
|
51
|
+
}, validationHelpText), isInvalid && jsx(ErrorMessage, {
|
|
49
52
|
testId: `${testId}-error-message`
|
|
50
53
|
}, error));
|
|
51
54
|
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CreateFormFooter } from './main';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
3
|
+
import { useIntl } from 'react-intl-next';
|
|
4
|
+
import Button, { ButtonGroup } from '@atlaskit/button';
|
|
5
|
+
import LoadingButton from '@atlaskit/button/loading-button';
|
|
6
|
+
import { FormFooter } from '@atlaskit/form';
|
|
7
|
+
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
8
|
+
import { messages } from './messages';
|
|
9
|
+
const errorStyles = css({
|
|
10
|
+
display: 'flex',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
marginRight: 'auto'
|
|
13
|
+
});
|
|
14
|
+
export function CreateFormFooter({
|
|
15
|
+
formErrorMessage,
|
|
16
|
+
handleCancel,
|
|
17
|
+
submitting,
|
|
18
|
+
testId
|
|
19
|
+
}) {
|
|
20
|
+
const intl = useIntl();
|
|
21
|
+
return jsx(FormFooter, null, formErrorMessage && jsx("div", {
|
|
22
|
+
css: errorStyles,
|
|
23
|
+
"data-testid": `${testId}-error`
|
|
24
|
+
}, jsx(ErrorIcon, {
|
|
25
|
+
label: formErrorMessage,
|
|
26
|
+
primaryColor: "var(--ds-icon-danger, #E34935)"
|
|
27
|
+
}), formErrorMessage), jsx(ButtonGroup, null, jsx(Button, {
|
|
28
|
+
type: "button",
|
|
29
|
+
appearance: "subtle",
|
|
30
|
+
onClick: handleCancel,
|
|
31
|
+
testId: `${testId}-button-cancel`
|
|
32
|
+
}, intl.formatMessage(messages.close)), jsx(LoadingButton, {
|
|
33
|
+
type: "submit",
|
|
34
|
+
appearance: "primary",
|
|
35
|
+
isLoading: submitting,
|
|
36
|
+
testId: `${testId}-button-submit`
|
|
37
|
+
}, intl.formatMessage(messages.create))));
|
|
38
|
+
}
|
|
@@ -2,38 +2,28 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import { useIntl } from 'react-intl-next';
|
|
6
5
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
|
-
import
|
|
8
|
-
import LoadingButton from '@atlaskit/button/loading-button';
|
|
9
|
-
import Button from '@atlaskit/button/standard-button';
|
|
10
|
-
import Form, { FormFooter } from '@atlaskit/form';
|
|
11
|
-
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
6
|
+
import Form from '@atlaskit/form';
|
|
12
7
|
import { ANALYTICS_CHANNEL, CREATE_FORM_MAX_WIDTH_IN_PX } from '../../common/constants';
|
|
13
8
|
import createEventPayload from '../../common/utils/analytics/analytics.codegen';
|
|
14
9
|
import { useFormContext } from '../../controllers/form-context';
|
|
10
|
+
import { CreateFormFooter } from './form-footer';
|
|
15
11
|
import { CreateFormLoader } from './form-loader';
|
|
16
|
-
import { messages } from './messages';
|
|
17
12
|
import { validateFormData } from './utils';
|
|
18
13
|
const formStyles = css({
|
|
19
14
|
maxWidth: `${CREATE_FORM_MAX_WIDTH_IN_PX}px`,
|
|
20
15
|
padding: `0 0 ${"var(--ds-space-300, 24px)"} 0`,
|
|
21
16
|
margin: `${"var(--ds-space-0, 0px)"} auto`
|
|
22
17
|
});
|
|
23
|
-
const
|
|
24
|
-
display: 'flex',
|
|
25
|
-
alignItems: 'center',
|
|
26
|
-
marginRight: 'auto'
|
|
27
|
-
});
|
|
18
|
+
export const TEST_ID = 'link-create-form';
|
|
28
19
|
export const CreateForm = ({
|
|
29
20
|
children,
|
|
30
|
-
testId,
|
|
21
|
+
testId = TEST_ID,
|
|
31
22
|
onSubmit,
|
|
32
23
|
onCancel,
|
|
33
24
|
isLoading,
|
|
34
25
|
hideFooter
|
|
35
26
|
}) => {
|
|
36
|
-
const intl = useIntl();
|
|
37
27
|
const {
|
|
38
28
|
createAnalyticsEvent
|
|
39
29
|
} = useAnalyticsEvents();
|
|
@@ -66,24 +56,13 @@ export const CreateForm = ({
|
|
|
66
56
|
formProps,
|
|
67
57
|
submitting
|
|
68
58
|
}) => jsx("form", _extends({}, formProps, {
|
|
69
|
-
name: "
|
|
59
|
+
name: "link-create-form",
|
|
70
60
|
"data-testid": testId,
|
|
71
61
|
css: formStyles
|
|
72
|
-
}), jsx("div", null, children), !hideFooter && jsx(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}), formErrorMessage), jsx(ButtonGroup, null, jsx(Button, {
|
|
79
|
-
type: "button",
|
|
80
|
-
appearance: "subtle",
|
|
81
|
-
onClick: handleCancel,
|
|
82
|
-
testId: 'close-button'
|
|
83
|
-
}, intl.formatMessage(messages.close)), jsx(LoadingButton, {
|
|
84
|
-
type: "submit",
|
|
85
|
-
appearance: "primary",
|
|
86
|
-
isLoading: submitting,
|
|
87
|
-
testId: 'create-button'
|
|
88
|
-
}, intl.formatMessage(messages.create))))));
|
|
62
|
+
}), jsx("div", null, children), !hideFooter && jsx(CreateFormFooter, {
|
|
63
|
+
formErrorMessage: formErrorMessage,
|
|
64
|
+
handleCancel: handleCancel,
|
|
65
|
+
submitting: submitting,
|
|
66
|
+
testId: testId
|
|
67
|
+
})));
|
|
89
68
|
};
|
|
@@ -6,6 +6,8 @@ import { ErrorMessage, Field, HelperMessage } from '@atlaskit/form';
|
|
|
6
6
|
import AkTextfield from '@atlaskit/textfield';
|
|
7
7
|
import { validateSubmitErrors } from '../../../common/utils/form';
|
|
8
8
|
import { useFormContext } from '../../../controllers/form-context';
|
|
9
|
+
export const TEST_ID = 'link-create-text-field';
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* A text field utilising the Atlaskit Textfield and Field objects from `@atlaskit/form`.
|
|
11
13
|
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
@@ -16,6 +18,7 @@ import { useFormContext } from '../../../controllers/form-context';
|
|
|
16
18
|
export function TextField({
|
|
17
19
|
label,
|
|
18
20
|
name,
|
|
21
|
+
testId = TEST_ID,
|
|
19
22
|
validationHelpText,
|
|
20
23
|
validators,
|
|
21
24
|
defaultValue,
|
|
@@ -38,6 +41,7 @@ export function TextField({
|
|
|
38
41
|
* `value` will be populated again in `fieldProps` which cause the TextField to be changed
|
|
39
42
|
* to a controlled component and raise a warning from React.
|
|
40
43
|
*/
|
|
44
|
+
|
|
41
45
|
jsx(Field, {
|
|
42
46
|
name: name,
|
|
43
47
|
label: label,
|
|
@@ -50,10 +54,13 @@ export function TextField({
|
|
|
50
54
|
}) => {
|
|
51
55
|
const isInvalid = validateSubmitErrors(meta);
|
|
52
56
|
return jsx(Fragment, null, jsx(AkTextfield, _extends({}, fieldProps, restProps, {
|
|
57
|
+
testId: testId,
|
|
53
58
|
isInvalid: isInvalid,
|
|
54
59
|
isRequired: false // Remove the default browser validation
|
|
55
|
-
})), !error && validationHelpText && jsx(HelperMessage,
|
|
56
|
-
testId: `${
|
|
60
|
+
})), !error && validationHelpText && jsx(HelperMessage, {
|
|
61
|
+
testId: `${testId}-helper-message`
|
|
62
|
+
}, validationHelpText), error && isInvalid && jsx(ErrorMessage, {
|
|
63
|
+
testId: `${testId}-error-message`
|
|
57
64
|
}, error));
|
|
58
65
|
})
|
|
59
66
|
);
|
|
@@ -9,6 +9,7 @@ import { useFormContext, withLinkCreateFormContext } from '../../controllers/for
|
|
|
9
9
|
import { ErrorBoundary } from './error-boundary';
|
|
10
10
|
import { messages } from './messages';
|
|
11
11
|
import TrackMount from './track-mount';
|
|
12
|
+
export const TEST_ID = 'link-create';
|
|
12
13
|
const LinkCreateContent = ({
|
|
13
14
|
plugins,
|
|
14
15
|
entityKey
|
|
@@ -20,7 +21,7 @@ const LinkCreateContent = ({
|
|
|
20
21
|
return jsx(Fragment, null, chosenOne.form);
|
|
21
22
|
};
|
|
22
23
|
const LinkCreate = withLinkCreateFormContext(({
|
|
23
|
-
testId,
|
|
24
|
+
testId = TEST_ID,
|
|
24
25
|
onCreate,
|
|
25
26
|
onFailure,
|
|
26
27
|
onCancel,
|
|
@@ -58,7 +59,7 @@ const LinkCreateWithModal = ({
|
|
|
58
59
|
}) => {
|
|
59
60
|
const intl = useIntl();
|
|
60
61
|
return jsx(ModalTransition, null, !!active && jsx(Modal, {
|
|
61
|
-
testId:
|
|
62
|
+
testId: "link-create-modal",
|
|
62
63
|
onClose: createProps.onCancel,
|
|
63
64
|
shouldScrollInViewport: true,
|
|
64
65
|
onOpenComplete: onOpenComplete,
|
package/dist/es2019/version.json
CHANGED
|
@@ -8,6 +8,7 @@ import { ErrorMessage, Field, HelperMessage } from '@atlaskit/form';
|
|
|
8
8
|
import { AsyncSelect as AkAsyncSelect } from '@atlaskit/select';
|
|
9
9
|
import { validateSubmitErrors } from '../../../common/utils/form';
|
|
10
10
|
import { useFormContext } from '../../../controllers/form-context';
|
|
11
|
+
export var TEST_ID = 'link-create-async-select';
|
|
11
12
|
/**
|
|
12
13
|
* An async select utilising the Atlaskit AsyncSelect and Field objects from `@atlaskit/form`.
|
|
13
14
|
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
@@ -19,7 +20,8 @@ export function AsyncSelect(_ref) {
|
|
|
19
20
|
name = _ref.name,
|
|
20
21
|
validationHelpText = _ref.validationHelpText,
|
|
21
22
|
isRequired = _ref.isRequired,
|
|
22
|
-
testId = _ref.testId,
|
|
23
|
+
_ref$testId = _ref.testId,
|
|
24
|
+
testId = _ref$testId === void 0 ? TEST_ID : _ref$testId,
|
|
23
25
|
validators = _ref.validators,
|
|
24
26
|
defaultValue = _ref.defaultValue,
|
|
25
27
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -44,7 +46,9 @@ export function AsyncSelect(_ref) {
|
|
|
44
46
|
var isInvalid = validateSubmitErrors(meta);
|
|
45
47
|
return jsx(Fragment, null, jsx(AkAsyncSelect, _extends({}, fieldProps, rest, {
|
|
46
48
|
isInvalid: isInvalid
|
|
47
|
-
})), !error && validationHelpText && jsx(HelperMessage,
|
|
49
|
+
})), !error && validationHelpText && jsx(HelperMessage, {
|
|
50
|
+
testId: "".concat(testId, "-helper-message")
|
|
51
|
+
}, validationHelpText), isInvalid && jsx(ErrorMessage, {
|
|
48
52
|
testId: "".concat(testId, "-error-message")
|
|
49
53
|
}, error));
|
|
50
54
|
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CreateFormFooter } from './main';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
3
|
+
import { useIntl } from 'react-intl-next';
|
|
4
|
+
import Button, { ButtonGroup } from '@atlaskit/button';
|
|
5
|
+
import LoadingButton from '@atlaskit/button/loading-button';
|
|
6
|
+
import { FormFooter } from '@atlaskit/form';
|
|
7
|
+
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
8
|
+
import { messages } from './messages';
|
|
9
|
+
var errorStyles = css({
|
|
10
|
+
display: 'flex',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
marginRight: 'auto'
|
|
13
|
+
});
|
|
14
|
+
export function CreateFormFooter(_ref) {
|
|
15
|
+
var formErrorMessage = _ref.formErrorMessage,
|
|
16
|
+
handleCancel = _ref.handleCancel,
|
|
17
|
+
submitting = _ref.submitting,
|
|
18
|
+
testId = _ref.testId;
|
|
19
|
+
var intl = useIntl();
|
|
20
|
+
return jsx(FormFooter, null, formErrorMessage && jsx("div", {
|
|
21
|
+
css: errorStyles,
|
|
22
|
+
"data-testid": "".concat(testId, "-error")
|
|
23
|
+
}, jsx(ErrorIcon, {
|
|
24
|
+
label: formErrorMessage,
|
|
25
|
+
primaryColor: "var(--ds-icon-danger, #E34935)"
|
|
26
|
+
}), formErrorMessage), jsx(ButtonGroup, null, jsx(Button, {
|
|
27
|
+
type: "button",
|
|
28
|
+
appearance: "subtle",
|
|
29
|
+
onClick: handleCancel,
|
|
30
|
+
testId: "".concat(testId, "-button-cancel")
|
|
31
|
+
}, intl.formatMessage(messages.close)), jsx(LoadingButton, {
|
|
32
|
+
type: "submit",
|
|
33
|
+
appearance: "primary",
|
|
34
|
+
isLoading: submitting,
|
|
35
|
+
testId: "".concat(testId, "-button-submit")
|
|
36
|
+
}, intl.formatMessage(messages.create))));
|
|
37
|
+
}
|
|
@@ -4,37 +4,28 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
import { useCallback } from 'react';
|
|
6
6
|
import { css, jsx } from '@emotion/react';
|
|
7
|
-
import { useIntl } from 'react-intl-next';
|
|
8
7
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
9
|
-
import
|
|
10
|
-
import LoadingButton from '@atlaskit/button/loading-button';
|
|
11
|
-
import Button from '@atlaskit/button/standard-button';
|
|
12
|
-
import Form, { FormFooter } from '@atlaskit/form';
|
|
13
|
-
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
8
|
+
import Form from '@atlaskit/form';
|
|
14
9
|
import { ANALYTICS_CHANNEL, CREATE_FORM_MAX_WIDTH_IN_PX } from '../../common/constants';
|
|
15
10
|
import createEventPayload from '../../common/utils/analytics/analytics.codegen';
|
|
16
11
|
import { useFormContext } from '../../controllers/form-context';
|
|
12
|
+
import { CreateFormFooter } from './form-footer';
|
|
17
13
|
import { CreateFormLoader } from './form-loader';
|
|
18
|
-
import { messages } from './messages';
|
|
19
14
|
import { validateFormData } from './utils';
|
|
20
15
|
var formStyles = css({
|
|
21
16
|
maxWidth: "".concat(CREATE_FORM_MAX_WIDTH_IN_PX, "px"),
|
|
22
17
|
padding: "0 0 ".concat("var(--ds-space-300, 24px)", " 0"),
|
|
23
18
|
margin: "var(--ds-space-0, 0px)".concat(" auto")
|
|
24
19
|
});
|
|
25
|
-
var
|
|
26
|
-
display: 'flex',
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
marginRight: 'auto'
|
|
29
|
-
});
|
|
20
|
+
export var TEST_ID = 'link-create-form';
|
|
30
21
|
export var CreateForm = function CreateForm(_ref) {
|
|
31
22
|
var children = _ref.children,
|
|
32
|
-
testId = _ref.testId,
|
|
23
|
+
_ref$testId = _ref.testId,
|
|
24
|
+
testId = _ref$testId === void 0 ? TEST_ID : _ref$testId,
|
|
33
25
|
onSubmit = _ref.onSubmit,
|
|
34
26
|
onCancel = _ref.onCancel,
|
|
35
27
|
isLoading = _ref.isLoading,
|
|
36
28
|
hideFooter = _ref.hideFooter;
|
|
37
|
-
var intl = useIntl();
|
|
38
29
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
39
30
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
40
31
|
var _useFormContext = useFormContext(),
|
|
@@ -82,25 +73,14 @@ export var CreateForm = function CreateForm(_ref) {
|
|
|
82
73
|
var formProps = _ref3.formProps,
|
|
83
74
|
submitting = _ref3.submitting;
|
|
84
75
|
return jsx("form", _extends({}, formProps, {
|
|
85
|
-
name: "
|
|
76
|
+
name: "link-create-form",
|
|
86
77
|
"data-testid": testId,
|
|
87
78
|
css: formStyles
|
|
88
|
-
}), jsx("div", null, children), !hideFooter && jsx(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}), formErrorMessage), jsx(ButtonGroup, null, jsx(Button, {
|
|
95
|
-
type: "button",
|
|
96
|
-
appearance: "subtle",
|
|
97
|
-
onClick: handleCancel,
|
|
98
|
-
testId: 'close-button'
|
|
99
|
-
}, intl.formatMessage(messages.close)), jsx(LoadingButton, {
|
|
100
|
-
type: "submit",
|
|
101
|
-
appearance: "primary",
|
|
102
|
-
isLoading: submitting,
|
|
103
|
-
testId: 'create-button'
|
|
104
|
-
}, intl.formatMessage(messages.create)))));
|
|
79
|
+
}), jsx("div", null, children), !hideFooter && jsx(CreateFormFooter, {
|
|
80
|
+
formErrorMessage: formErrorMessage,
|
|
81
|
+
handleCancel: handleCancel,
|
|
82
|
+
submitting: submitting,
|
|
83
|
+
testId: testId
|
|
84
|
+
}));
|
|
105
85
|
});
|
|
106
86
|
};
|
|
@@ -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", "defaultValue", "isRequired"];
|
|
3
|
+
var _excluded = ["label", "name", "testId", "validationHelpText", "validators", "defaultValue", "isRequired"];
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
import { Fragment, useEffect } from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
@@ -8,6 +8,8 @@ import { ErrorMessage, Field, HelperMessage } from '@atlaskit/form';
|
|
|
8
8
|
import AkTextfield from '@atlaskit/textfield';
|
|
9
9
|
import { validateSubmitErrors } from '../../../common/utils/form';
|
|
10
10
|
import { useFormContext } from '../../../controllers/form-context';
|
|
11
|
+
export var TEST_ID = 'link-create-text-field';
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
* A text field utilising the Atlaskit Textfield and Field objects from `@atlaskit/form`.
|
|
13
15
|
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
@@ -18,6 +20,8 @@ import { useFormContext } from '../../../controllers/form-context';
|
|
|
18
20
|
export function TextField(_ref) {
|
|
19
21
|
var label = _ref.label,
|
|
20
22
|
name = _ref.name,
|
|
23
|
+
_ref$testId = _ref.testId,
|
|
24
|
+
testId = _ref$testId === void 0 ? TEST_ID : _ref$testId,
|
|
21
25
|
validationHelpText = _ref.validationHelpText,
|
|
22
26
|
validators = _ref.validators,
|
|
23
27
|
defaultValue = _ref.defaultValue,
|
|
@@ -38,6 +42,7 @@ export function TextField(_ref) {
|
|
|
38
42
|
* `value` will be populated again in `fieldProps` which cause the TextField to be changed
|
|
39
43
|
* to a controlled component and raise a warning from React.
|
|
40
44
|
*/
|
|
45
|
+
|
|
41
46
|
jsx(Field, {
|
|
42
47
|
name: name,
|
|
43
48
|
label: label,
|
|
@@ -49,10 +54,13 @@ export function TextField(_ref) {
|
|
|
49
54
|
error = _ref2.error;
|
|
50
55
|
var isInvalid = validateSubmitErrors(meta);
|
|
51
56
|
return jsx(Fragment, null, jsx(AkTextfield, _extends({}, fieldProps, restProps, {
|
|
57
|
+
testId: testId,
|
|
52
58
|
isInvalid: isInvalid,
|
|
53
59
|
isRequired: false // Remove the default browser validation
|
|
54
|
-
})), !error && validationHelpText && jsx(HelperMessage,
|
|
55
|
-
testId: "".concat(
|
|
60
|
+
})), !error && validationHelpText && jsx(HelperMessage, {
|
|
61
|
+
testId: "".concat(testId, "-helper-message")
|
|
62
|
+
}, validationHelpText), error && isInvalid && jsx(ErrorMessage, {
|
|
63
|
+
testId: "".concat(testId, "-error-message")
|
|
56
64
|
}, error));
|
|
57
65
|
})
|
|
58
66
|
);
|
|
@@ -14,6 +14,7 @@ import { useFormContext, withLinkCreateFormContext } from '../../controllers/for
|
|
|
14
14
|
import { ErrorBoundary } from './error-boundary';
|
|
15
15
|
import { messages } from './messages';
|
|
16
16
|
import TrackMount from './track-mount';
|
|
17
|
+
export var TEST_ID = 'link-create';
|
|
17
18
|
var LinkCreateContent = function LinkCreateContent(_ref) {
|
|
18
19
|
var plugins = _ref.plugins,
|
|
19
20
|
entityKey = _ref.entityKey;
|
|
@@ -26,7 +27,8 @@ var LinkCreateContent = function LinkCreateContent(_ref) {
|
|
|
26
27
|
return jsx(Fragment, null, chosenOne.form);
|
|
27
28
|
};
|
|
28
29
|
var LinkCreate = withLinkCreateFormContext(function (_ref2) {
|
|
29
|
-
var testId = _ref2.testId,
|
|
30
|
+
var _ref2$testId = _ref2.testId,
|
|
31
|
+
testId = _ref2$testId === void 0 ? TEST_ID : _ref2$testId,
|
|
30
32
|
onCreate = _ref2.onCreate,
|
|
31
33
|
onFailure = _ref2.onFailure,
|
|
32
34
|
onCancel = _ref2.onCancel,
|
|
@@ -77,7 +79,7 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref4) {
|
|
|
77
79
|
createProps = _objectWithoutProperties(_ref4, _excluded2);
|
|
78
80
|
var intl = useIntl();
|
|
79
81
|
return jsx(ModalTransition, null, !!active && jsx(Modal, {
|
|
80
|
-
testId:
|
|
82
|
+
testId: "link-create-modal",
|
|
81
83
|
onClose: createProps.onCancel,
|
|
82
84
|
shouldScrollInViewport: true,
|
|
83
85
|
onOpenComplete: onOpenComplete,
|
package/dist/esm/version.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import { OptionType } from '@atlaskit/select';
|
|
3
3
|
import { AsyncSelectProps } from './types';
|
|
4
|
+
export declare const TEST_ID = "link-create-async-select";
|
|
4
5
|
/**
|
|
5
6
|
* An async select utilising the Atlaskit AsyncSelect and Field objects from `@atlaskit/form`.
|
|
6
7
|
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CreateFormFooter } from './main';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
export interface CreateFormFooterProps {
|
|
4
|
+
formErrorMessage: string | undefined;
|
|
5
|
+
handleCancel: () => void;
|
|
6
|
+
submitting: boolean;
|
|
7
|
+
testId?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function CreateFormFooter({ formErrorMessage, handleCancel, submitting, testId, }: CreateFormFooterProps): jsx.JSX.Element;
|
|
@@ -9,4 +9,5 @@ export interface CreateFormProps<FormData> {
|
|
|
9
9
|
isLoading?: boolean;
|
|
10
10
|
hideFooter?: boolean;
|
|
11
11
|
}
|
|
12
|
+
export declare const TEST_ID = "link-create-form";
|
|
12
13
|
export declare const CreateForm: <FormData_1 extends Record<string, any> = {}>({ children, testId, onSubmit, onCancel, isLoading, hideFooter, }: CreateFormProps<FormData_1>) => jsx.JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import { TextFieldProps } from './types';
|
|
3
|
+
export declare const TEST_ID = "link-create-text-field";
|
|
3
4
|
/**
|
|
4
5
|
* A text field utilising the Atlaskit Textfield and Field objects from `@atlaskit/form`.
|
|
5
6
|
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
6
7
|
* the handleSubmit function passed to the form <Form> that have a key matching the `name`
|
|
7
8
|
* of this text field are shown above the field.
|
|
8
9
|
*/
|
|
9
|
-
export declare function TextField({ label, name, validationHelpText, validators, defaultValue, isRequired, ...restProps }: TextFieldProps): jsx.JSX.Element;
|
|
10
|
+
export declare function TextField({ label, name, testId, validationHelpText, validators, defaultValue, isRequired, ...restProps }: TextFieldProps): jsx.JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import { LinkCreateWithModalProps } from '../../common/types';
|
|
3
|
+
export declare const TEST_ID = "link-create";
|
|
3
4
|
declare const LinkCreateWithModal: ({ active, modalTitle, onOpenComplete, onCloseComplete, ...createProps }: LinkCreateWithModalProps) => jsx.JSX.Element;
|
|
4
5
|
export default LinkCreateWithModal;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import { OptionType } from '@atlaskit/select';
|
|
3
3
|
import { AsyncSelectProps } from './types';
|
|
4
|
+
export declare const TEST_ID = "link-create-async-select";
|
|
4
5
|
/**
|
|
5
6
|
* An async select utilising the Atlaskit AsyncSelect and Field objects from `@atlaskit/form`.
|
|
6
7
|
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CreateFormFooter } from './main';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
export interface CreateFormFooterProps {
|
|
4
|
+
formErrorMessage: string | undefined;
|
|
5
|
+
handleCancel: () => void;
|
|
6
|
+
submitting: boolean;
|
|
7
|
+
testId?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function CreateFormFooter({ formErrorMessage, handleCancel, submitting, testId, }: CreateFormFooterProps): jsx.JSX.Element;
|
|
@@ -9,4 +9,5 @@ export interface CreateFormProps<FormData> {
|
|
|
9
9
|
isLoading?: boolean;
|
|
10
10
|
hideFooter?: boolean;
|
|
11
11
|
}
|
|
12
|
+
export declare const TEST_ID = "link-create-form";
|
|
12
13
|
export declare const CreateForm: <FormData_1 extends Record<string, any> = {}>({ children, testId, onSubmit, onCancel, isLoading, hideFooter, }: CreateFormProps<FormData_1>) => jsx.JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import { TextFieldProps } from './types';
|
|
3
|
+
export declare const TEST_ID = "link-create-text-field";
|
|
3
4
|
/**
|
|
4
5
|
* A text field utilising the Atlaskit Textfield and Field objects from `@atlaskit/form`.
|
|
5
6
|
* Validation is handled by the form as it is on form submission. Any errors returned by
|
|
6
7
|
* the handleSubmit function passed to the form <Form> that have a key matching the `name`
|
|
7
8
|
* of this text field are shown above the field.
|
|
8
9
|
*/
|
|
9
|
-
export declare function TextField({ label, name, validationHelpText, validators, defaultValue, isRequired, ...restProps }: TextFieldProps): jsx.JSX.Element;
|
|
10
|
+
export declare function TextField({ label, name, testId, validationHelpText, validators, defaultValue, isRequired, ...restProps }: TextFieldProps): jsx.JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import { LinkCreateWithModalProps } from '../../common/types';
|
|
3
|
+
export declare const TEST_ID = "link-create";
|
|
3
4
|
declare const LinkCreateWithModal: ({ active, modalTitle, onOpenComplete, onCloseComplete, ...createProps }: LinkCreateWithModalProps) => jsx.JSX.Element;
|
|
4
5
|
export default LinkCreateWithModal;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-create",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "The driver component of meta creation flow",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/select": "^16.5.0",
|
|
45
45
|
"@atlaskit/spinner": "^15.4.0",
|
|
46
46
|
"@atlaskit/textfield": "^5.6.0",
|
|
47
|
-
"@atlaskit/tokens": "^1.
|
|
47
|
+
"@atlaskit/tokens": "^1.13.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"@emotion/react": "^11.7.1"
|
|
50
50
|
},
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
+
"@af/visual-regression": "*",
|
|
56
57
|
"@atlaskit/link-test-helpers": "^4.1.0",
|
|
57
58
|
"@atlaskit/visual-regression": "*",
|
|
58
59
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
@@ -102,5 +103,10 @@
|
|
|
102
103
|
]
|
|
103
104
|
}
|
|
104
105
|
},
|
|
106
|
+
"techstackIgnore": {
|
|
107
|
+
"stricter": [
|
|
108
|
+
"@atlassian/tangerine/project-structure"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
105
111
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
106
112
|
}
|
package/report.api.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|