@atlaskit/link-create 2.11.4 → 2.11.6
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 +14 -0
- package/dist/cjs/common/constants.js +1 -1
- package/dist/cjs/common/ui/message/index.js +81 -0
- package/dist/cjs/controllers/create-field/main.js +31 -10
- package/dist/cjs/ui/create-form/async-select/main.js +13 -1
- package/dist/cjs/ui/create-form/form-footer/main.js +1 -0
- package/dist/cjs/ui/create-form/main.js +8 -3
- package/dist/cjs/ui/create-form/select/main.js +9 -1
- package/dist/cjs/ui/create-form/textfield/main.js +6 -0
- package/dist/cjs/ui/create-form/user-picker/main.js +4 -2
- package/dist/es2019/common/constants.js +1 -1
- package/dist/es2019/common/ui/message/index.js +74 -0
- package/dist/es2019/controllers/create-field/main.js +27 -4
- package/dist/es2019/ui/create-form/async-select/main.js +12 -0
- package/dist/es2019/ui/create-form/form-footer/main.js +1 -0
- package/dist/es2019/ui/create-form/main.js +8 -3
- package/dist/es2019/ui/create-form/select/main.js +8 -0
- package/dist/es2019/ui/create-form/textfield/main.js +6 -0
- package/dist/es2019/ui/create-form/user-picker/main.js +3 -1
- package/dist/esm/common/constants.js +1 -1
- package/dist/esm/common/ui/message/index.js +73 -0
- package/dist/esm/controllers/create-field/main.js +25 -3
- package/dist/esm/ui/create-form/async-select/main.js +13 -1
- package/dist/esm/ui/create-form/form-footer/main.js +1 -0
- package/dist/esm/ui/create-form/main.js +8 -3
- package/dist/esm/ui/create-form/select/main.js +9 -1
- package/dist/esm/ui/create-form/textfield/main.js +6 -0
- package/dist/esm/ui/create-form/user-picker/main.js +4 -2
- package/dist/types/common/ui/message/index.d.ts +15 -0
- package/dist/types/controllers/create-field/main.d.ts +0 -4
- package/dist/types/controllers/create-field/types.d.ts +5 -0
- package/dist/types/ui/create-form/select/main.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/message/index.d.ts +15 -0
- package/dist/types-ts4.5/controllers/create-field/main.d.ts +0 -4
- package/dist/types-ts4.5/controllers/create-field/types.d.ts +5 -0
- package/dist/types-ts4.5/ui/create-form/select/main.d.ts +1 -1
- package/package.json +12 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/link-create
|
|
2
2
|
|
|
3
|
+
## 2.11.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#137381](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/137381)
|
|
8
|
+
[`224684c4c470e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/224684c4c470e) -
|
|
9
|
+
Improves form field accessibility of error messages and help text behind a feature flag.
|
|
10
|
+
|
|
11
|
+
## 2.11.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 2.11.4
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -13,7 +13,7 @@ var CREATE_FORM_MIN_HEIGHT_IN_PX = exports.CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
|
|
|
13
13
|
var LINK_CREATE_FORM_POST_CREATE_FIELD = exports.LINK_CREATE_FORM_POST_CREATE_FIELD = '__post_create__';
|
|
14
14
|
var PACKAGE_DATA = exports.PACKAGE_DATA = {
|
|
15
15
|
packageName: "@atlaskit/link-create" || '',
|
|
16
|
-
packageVersion: "2.11.
|
|
16
|
+
packageVersion: "2.11.6" || '',
|
|
17
17
|
component: COMPONENT_NAME,
|
|
18
18
|
componentName: COMPONENT_NAME
|
|
19
19
|
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Message = void 0;
|
|
8
|
+
var _react = require("@emotion/react");
|
|
9
|
+
var _checkCircle = _interopRequireDefault(require("@atlaskit/icon/utility/check-circle"));
|
|
10
|
+
var _error = _interopRequireDefault(require("@atlaskit/icon/utility/error"));
|
|
11
|
+
var _primitives = require("@atlaskit/primitives");
|
|
12
|
+
/**
|
|
13
|
+
* @jsxRuntime classic
|
|
14
|
+
* @jsx jsx
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
18
|
+
|
|
19
|
+
var messageStyles = (0, _primitives.xcss)({
|
|
20
|
+
display: 'flex',
|
|
21
|
+
justifyContent: 'baseline',
|
|
22
|
+
gap: 'space.050',
|
|
23
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
24
|
+
marginBlockStart: 'space.050'
|
|
25
|
+
});
|
|
26
|
+
var messageAppearanceStyles = {
|
|
27
|
+
default: (0, _primitives.xcss)({
|
|
28
|
+
color: 'color.text.subtlest'
|
|
29
|
+
}),
|
|
30
|
+
error: (0, _primitives.xcss)({
|
|
31
|
+
color: 'color.text.danger'
|
|
32
|
+
}),
|
|
33
|
+
valid: (0, _primitives.xcss)({
|
|
34
|
+
color: 'color.text.success'
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
var iconWrapperStyles = (0, _react.css)({
|
|
38
|
+
display: 'flex',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
marginInlineStart: "var(--ds-space-025, 2px)",
|
|
41
|
+
marginInlineEnd: "var(--ds-space-025, 2px)"
|
|
42
|
+
});
|
|
43
|
+
var IconWrapper = function IconWrapper(_ref) {
|
|
44
|
+
var children = _ref.children;
|
|
45
|
+
return (0, _react.jsx)("span", {
|
|
46
|
+
css: iconWrapperStyles
|
|
47
|
+
}, children);
|
|
48
|
+
};
|
|
49
|
+
var messageIcons = {
|
|
50
|
+
error: (0, _react.jsx)(_error.default, {
|
|
51
|
+
color: "var(--ds-text-danger, #AE2A19)",
|
|
52
|
+
label: "error"
|
|
53
|
+
}),
|
|
54
|
+
valid: (0, _react.jsx)(_checkCircle.default, {
|
|
55
|
+
color: "var(--ds-text-success, #216E4E)",
|
|
56
|
+
label: "success"
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
var Message = exports.Message = function Message(_ref2) {
|
|
60
|
+
var children = _ref2.children,
|
|
61
|
+
_ref2$appearance = _ref2.appearance,
|
|
62
|
+
appearance = _ref2$appearance === void 0 ? 'default' : _ref2$appearance,
|
|
63
|
+
id = _ref2.id,
|
|
64
|
+
testId = _ref2.testId;
|
|
65
|
+
var icon = messageIcons[appearance];
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The wrapping span is necessary to preserve spaces between children.
|
|
69
|
+
* Otherwise the flex layout of the message will remove any whitespace
|
|
70
|
+
* between children.
|
|
71
|
+
*
|
|
72
|
+
* If the child is just a string, this is not required and we can use one
|
|
73
|
+
* less DOM element.
|
|
74
|
+
*/
|
|
75
|
+
var content = typeof children === 'string' ? children : (0, _react.jsx)("span", null, children);
|
|
76
|
+
return (0, _react.jsx)(_primitives.Box, {
|
|
77
|
+
xcss: [messageStyles, messageAppearanceStyles[appearance]],
|
|
78
|
+
testId: testId,
|
|
79
|
+
id: id
|
|
80
|
+
}, icon && (0, _react.jsx)(IconWrapper, null, icon), content);
|
|
81
|
+
};
|
|
@@ -6,16 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.CreateField = CreateField;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _react = require("
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _react2 = require("@emotion/react");
|
|
10
11
|
var _reactFinalForm = require("react-final-form");
|
|
11
12
|
var _form = require("@atlaskit/form");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
|
+
var _message = require("../../common/ui/message");
|
|
12
15
|
var _form2 = require("../../common/utils/form");
|
|
13
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
15
18
|
* @jsxRuntime classic
|
|
16
19
|
* @jsx jsx
|
|
17
|
-
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
18
|
-
var fieldWrapperStyles = (0,
|
|
20
|
+
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
21
|
+
var fieldWrapperStyles = (0, _react2.css)({
|
|
19
22
|
marginTop: "var(--ds-space-100, 8px)"
|
|
20
23
|
});
|
|
21
24
|
function CreateField(_ref) {
|
|
@@ -28,7 +31,7 @@ function CreateField(_ref) {
|
|
|
28
31
|
testId = _ref.testId,
|
|
29
32
|
children = _ref.children;
|
|
30
33
|
var fieldId = id ? id : "link-create-field-".concat(name);
|
|
31
|
-
return (0,
|
|
34
|
+
return (0, _react2.jsx)(_reactFinalForm.Field, {
|
|
32
35
|
name: name,
|
|
33
36
|
validate: function validate(value) {
|
|
34
37
|
var _find;
|
|
@@ -43,20 +46,38 @@ function CreateField(_ref) {
|
|
|
43
46
|
var submitError = meta.submitError,
|
|
44
47
|
error = meta.error;
|
|
45
48
|
var hasError = !!submitError || !!error;
|
|
46
|
-
|
|
49
|
+
var showErrorMessage = hasError && isInvalid;
|
|
50
|
+
var describedById = "".concat(fieldId, "-description");
|
|
51
|
+
var errorMessageId = "".concat(fieldId, "-error");
|
|
52
|
+
var ariaErrorMessage = showErrorMessage ? errorMessageId : undefined;
|
|
53
|
+
return (0, _react2.jsx)("div", {
|
|
47
54
|
css: fieldWrapperStyles,
|
|
48
55
|
"data-testid": testId
|
|
49
|
-
}, label && (0,
|
|
56
|
+
}, label && (0, _react2.jsx)(_form.Label, {
|
|
50
57
|
htmlFor: fieldId,
|
|
51
58
|
id: "".concat(fieldId, "-label"),
|
|
52
59
|
testId: "".concat(testId, "-label")
|
|
53
|
-
}, label, isRequired && (0,
|
|
60
|
+
}, label, isRequired && (0, _react2.jsx)(_form.RequiredAsterisk, null)), children(_objectSpread(_objectSpread({}, input), {}, {
|
|
54
61
|
fieldId: fieldId,
|
|
55
62
|
isInvalid: isInvalid
|
|
56
|
-
}
|
|
63
|
+
}, (0, _platformFeatureFlags.fg)('linking-platform-create-field-error-association') ? {
|
|
64
|
+
isRequired: isRequired,
|
|
65
|
+
'aria-errormessage': ariaErrorMessage,
|
|
66
|
+
'aria-describedby': describedById
|
|
67
|
+
} : {})), (0, _platformFeatureFlags.fg)('linking-platform-create-field-error-association') ? (0, _react2.jsx)("div", {
|
|
68
|
+
id: describedById
|
|
69
|
+
}, !hasError && validationHelpText && (0, _react2.jsx)(_message.Message, {
|
|
57
70
|
testId: "".concat(testId, "-helper-message")
|
|
58
|
-
}, validationHelpText),
|
|
71
|
+
}, validationHelpText), (0, _react2.jsx)("div", {
|
|
72
|
+
"aria-live": "polite"
|
|
73
|
+
}, showErrorMessage && (0, _react2.jsx)(_message.Message, {
|
|
74
|
+
id: errorMessageId,
|
|
75
|
+
appearance: "error",
|
|
59
76
|
testId: "".concat(testId, "-error-message")
|
|
60
|
-
}, submitError || error))
|
|
77
|
+
}, submitError || error))) : (0, _react2.jsx)(_react.Fragment, null, !hasError && validationHelpText && (0, _react2.jsx)(_form.HelperMessage, {
|
|
78
|
+
testId: "".concat(testId, "-helper-message")
|
|
79
|
+
}, validationHelpText), hasError && isInvalid && (0, _react2.jsx)(_form.ErrorMessage, {
|
|
80
|
+
testId: "".concat(testId, "-error-message")
|
|
81
|
+
}, submitError || error)));
|
|
61
82
|
});
|
|
62
83
|
}
|
|
@@ -16,13 +16,14 @@ var _react2 = require("@emotion/react");
|
|
|
16
16
|
var _debouncePromise = _interopRequireDefault(require("debounce-promise"));
|
|
17
17
|
var _reactFinalForm = require("react-final-form");
|
|
18
18
|
var _reactIntlNext = require("react-intl-next");
|
|
19
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
20
|
var _select = require("@atlaskit/select");
|
|
20
21
|
var _messages = _interopRequireDefault(require("../../../common/messages"));
|
|
21
22
|
var _callbackContext = require("../../../controllers/callback-context");
|
|
22
23
|
var _createField = require("../../../controllers/create-field");
|
|
23
24
|
var _formContext = require("../../../controllers/form-context");
|
|
24
25
|
var _excluded = ["id", "name", "label", "isRequired", "validators", "validationHelpText", "testId", "defaultOption", "loadOptions"],
|
|
25
|
-
_excluded2 = ["fieldId"];
|
|
26
|
+
_excluded2 = ["fieldId", "isRequired"];
|
|
26
27
|
/**
|
|
27
28
|
* @jsxRuntime classic
|
|
28
29
|
* @jsx jsx
|
|
@@ -180,7 +181,18 @@ function AsyncSelect(_ref) {
|
|
|
180
181
|
testId: testId
|
|
181
182
|
}, function (_ref4) {
|
|
182
183
|
var fieldId = _ref4.fieldId,
|
|
184
|
+
isRequired = _ref4.isRequired,
|
|
183
185
|
fieldProps = (0, _objectWithoutProperties2.default)(_ref4, _excluded2);
|
|
186
|
+
if ((0, _platformFeatureFlags.fg)('linking-platform-create-field-error-association')) {
|
|
187
|
+
return (0, _react2.jsx)(_select.AsyncSelect, (0, _extends2.default)({
|
|
188
|
+
inputId: fieldId
|
|
189
|
+
}, fieldProps, restProps, {
|
|
190
|
+
required: isRequired,
|
|
191
|
+
loadOptions: debouncedLoadOptions,
|
|
192
|
+
defaultOptions: defaultOptions,
|
|
193
|
+
isLoading: isLoadingDefaultOptions
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
184
196
|
return (0, _react2.jsx)(_select.AsyncSelect, (0, _extends2.default)({
|
|
185
197
|
inputId: fieldId
|
|
186
198
|
}, fieldProps, restProps, {
|
|
@@ -43,6 +43,7 @@ function CreateFormFooter(_ref) {
|
|
|
43
43
|
"data-testid": "".concat(testId, "-footer"),
|
|
44
44
|
css: formFooterWrapperStyles
|
|
45
45
|
}, formErrorMessage && (0, _react.jsx)("div", {
|
|
46
|
+
role: "alert",
|
|
46
47
|
css: errorStyles,
|
|
47
48
|
"data-testid": "".concat(testId, "-error")
|
|
48
49
|
}, (0, _react.jsx)(_error.default, {
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.TEST_ID = exports.CreateForm = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -16,6 +17,7 @@ var _finalForm = require("final-form");
|
|
|
16
17
|
var _reactFinalForm = require("react-final-form");
|
|
17
18
|
var _reactIntlNext = require("react-intl-next");
|
|
18
19
|
var _form = require("@atlaskit/form");
|
|
20
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
21
|
var _primitives = require("@atlaskit/primitives");
|
|
20
22
|
var _constants = require("../../common/constants");
|
|
21
23
|
var _messages = _interopRequireDefault(require("../../common/messages"));
|
|
@@ -139,12 +141,15 @@ var CreateForm = exports.CreateForm = function CreateForm(_ref) {
|
|
|
139
141
|
}, function (_ref5) {
|
|
140
142
|
var submitError = _ref5.submitError,
|
|
141
143
|
formProps = (0, _objectWithoutProperties2.default)(_ref5, _excluded);
|
|
142
|
-
return (0, _react2.jsx)("form", {
|
|
144
|
+
return (0, _react2.jsx)("form", (0, _extends2.default)({
|
|
143
145
|
onSubmit: formProps.handleSubmit,
|
|
144
|
-
name: "link-create-form"
|
|
146
|
+
name: "link-create-form"
|
|
147
|
+
}, (0, _platformFeatureFlags.fg)('linking-platform-create-field-error-association') ? {
|
|
148
|
+
noValidate: true
|
|
149
|
+
} : {}, {
|
|
145
150
|
"data-testid": testId,
|
|
146
151
|
css: formStyles
|
|
147
|
-
}, (0, _react2.jsx)(_reactFinalForm.FormSpy, {
|
|
152
|
+
}), (0, _react2.jsx)(_reactFinalForm.FormSpy, {
|
|
148
153
|
subscription: {
|
|
149
154
|
modified: true
|
|
150
155
|
},
|
|
@@ -12,6 +12,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
12
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
13
|
var _react = require("@emotion/react");
|
|
14
14
|
var _reactIntlNext = require("react-intl-next");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _primitives = require("@atlaskit/primitives");
|
|
16
17
|
var _select = _interopRequireWildcard(require("@atlaskit/select"));
|
|
17
18
|
var _constants = require("@atlaskit/theme/constants");
|
|
@@ -19,7 +20,7 @@ var _icon = require("../../../common/ui/icon");
|
|
|
19
20
|
var _createField = require("../../../controllers/create-field");
|
|
20
21
|
var _messages = require("./messages");
|
|
21
22
|
var _excluded = ["id", "name", "label", "isRequired", "validators", "validationHelpText", "testId"],
|
|
22
|
-
_excluded2 = ["fieldId"],
|
|
23
|
+
_excluded2 = ["fieldId", "isRequired"],
|
|
23
24
|
_excluded3 = ["children"],
|
|
24
25
|
_excluded4 = ["children"];
|
|
25
26
|
/**
|
|
@@ -59,7 +60,14 @@ function Select(_ref) {
|
|
|
59
60
|
testId: testId
|
|
60
61
|
}, function (_ref2) {
|
|
61
62
|
var fieldId = _ref2.fieldId,
|
|
63
|
+
isRequired = _ref2.isRequired,
|
|
62
64
|
fieldProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
65
|
+
if ((0, _platformFeatureFlags.fg)('linking-platform-create-field-error-association')) {
|
|
66
|
+
return (0, _react.jsx)(_select.default, (0, _extends2.default)({
|
|
67
|
+
required: isRequired,
|
|
68
|
+
inputId: fieldId
|
|
69
|
+
}, fieldProps, restProps));
|
|
70
|
+
}
|
|
63
71
|
return (0, _react.jsx)(_select.default, (0, _extends2.default)({
|
|
64
72
|
inputId: fieldId
|
|
65
73
|
}, fieldProps, restProps));
|
|
@@ -9,6 +9,7 @@ exports.TextField = TextField;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = require("@emotion/react");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
13
|
var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
13
14
|
var _createField = require("../../../controllers/create-field");
|
|
14
15
|
var _excluded = ["id", "name", "label", "isRequired", "validators", "validationHelpText", "testId"],
|
|
@@ -48,6 +49,11 @@ function TextField(_ref) {
|
|
|
48
49
|
}, function (_ref2) {
|
|
49
50
|
var fieldId = _ref2.fieldId,
|
|
50
51
|
fieldProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
52
|
+
if ((0, _platformFeatureFlags.fg)('linking-platform-create-field-error-association')) {
|
|
53
|
+
return (0, _react.jsx)(_textfield.default, (0, _extends2.default)({
|
|
54
|
+
id: fieldId
|
|
55
|
+
}, fieldProps, restProps));
|
|
56
|
+
}
|
|
51
57
|
return (0, _react.jsx)(_textfield.default, (0, _extends2.default)({
|
|
52
58
|
id: fieldId
|
|
53
59
|
}, fieldProps, restProps, {
|
|
@@ -11,7 +11,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
var _react = require("@emotion/react");
|
|
12
12
|
var _smartUserPicker = _interopRequireDefault(require("@atlaskit/smart-user-picker"));
|
|
13
13
|
var _createField = require("../../../controllers/create-field");
|
|
14
|
-
var _excluded = ["fieldId"];
|
|
14
|
+
var _excluded = ["fieldId", "isRequired"];
|
|
15
15
|
/**
|
|
16
16
|
* @jsxRuntime classic
|
|
17
17
|
* @jsx jsx
|
|
@@ -45,6 +45,7 @@ function UserPicker(_ref) {
|
|
|
45
45
|
validators: validators
|
|
46
46
|
}, function (_ref2) {
|
|
47
47
|
var fieldId = _ref2.fieldId,
|
|
48
|
+
isRequired = _ref2.isRequired,
|
|
48
49
|
fieldProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
49
50
|
return (0, _react.jsx)(_smartUserPicker.default, {
|
|
50
51
|
defaultValue: defaultValue ? _objectSpread(_objectSpread({}, defaultValue), {}, {
|
|
@@ -63,7 +64,8 @@ function UserPicker(_ref) {
|
|
|
63
64
|
debounceTime: DEFAULT_DEBOUNCE_TIME,
|
|
64
65
|
prefetch: true,
|
|
65
66
|
isClearable: false,
|
|
66
|
-
width: UserPickerWidth
|
|
67
|
+
width: UserPickerWidth,
|
|
68
|
+
required: isRequired
|
|
67
69
|
});
|
|
68
70
|
});
|
|
69
71
|
}
|
|
@@ -7,7 +7,7 @@ export const CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
|
|
|
7
7
|
export const LINK_CREATE_FORM_POST_CREATE_FIELD = '__post_create__';
|
|
8
8
|
export const PACKAGE_DATA = {
|
|
9
9
|
packageName: "@atlaskit/link-create" || '',
|
|
10
|
-
packageVersion: "2.11.
|
|
10
|
+
packageVersion: "2.11.6" || '',
|
|
11
11
|
component: COMPONENT_NAME,
|
|
12
12
|
componentName: COMPONENT_NAME
|
|
13
13
|
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
+
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import SuccessIcon from '@atlaskit/icon/utility/check-circle';
|
|
9
|
+
import ErrorIcon from '@atlaskit/icon/utility/error';
|
|
10
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
11
|
+
const messageStyles = xcss({
|
|
12
|
+
display: 'flex',
|
|
13
|
+
justifyContent: 'baseline',
|
|
14
|
+
gap: 'space.050',
|
|
15
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
16
|
+
marginBlockStart: 'space.050'
|
|
17
|
+
});
|
|
18
|
+
const messageAppearanceStyles = {
|
|
19
|
+
default: xcss({
|
|
20
|
+
color: 'color.text.subtlest'
|
|
21
|
+
}),
|
|
22
|
+
error: xcss({
|
|
23
|
+
color: 'color.text.danger'
|
|
24
|
+
}),
|
|
25
|
+
valid: xcss({
|
|
26
|
+
color: 'color.text.success'
|
|
27
|
+
})
|
|
28
|
+
};
|
|
29
|
+
const iconWrapperStyles = css({
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
marginInlineStart: "var(--ds-space-025, 2px)",
|
|
33
|
+
marginInlineEnd: "var(--ds-space-025, 2px)"
|
|
34
|
+
});
|
|
35
|
+
const IconWrapper = ({
|
|
36
|
+
children
|
|
37
|
+
}) => {
|
|
38
|
+
return jsx("span", {
|
|
39
|
+
css: iconWrapperStyles
|
|
40
|
+
}, children);
|
|
41
|
+
};
|
|
42
|
+
const messageIcons = {
|
|
43
|
+
error: jsx(ErrorIcon, {
|
|
44
|
+
color: "var(--ds-text-danger, #AE2A19)",
|
|
45
|
+
label: "error"
|
|
46
|
+
}),
|
|
47
|
+
valid: jsx(SuccessIcon, {
|
|
48
|
+
color: "var(--ds-text-success, #216E4E)",
|
|
49
|
+
label: "success"
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
export const Message = ({
|
|
53
|
+
children,
|
|
54
|
+
appearance = 'default',
|
|
55
|
+
id,
|
|
56
|
+
testId
|
|
57
|
+
}) => {
|
|
58
|
+
const icon = messageIcons[appearance];
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The wrapping span is necessary to preserve spaces between children.
|
|
62
|
+
* Otherwise the flex layout of the message will remove any whitespace
|
|
63
|
+
* between children.
|
|
64
|
+
*
|
|
65
|
+
* If the child is just a string, this is not required and we can use one
|
|
66
|
+
* less DOM element.
|
|
67
|
+
*/
|
|
68
|
+
const content = typeof children === 'string' ? children : jsx("span", null, children);
|
|
69
|
+
return jsx(Box, {
|
|
70
|
+
xcss: [messageStyles, messageAppearanceStyles[appearance]],
|
|
71
|
+
testId: testId,
|
|
72
|
+
id: id
|
|
73
|
+
}, icon && jsx(IconWrapper, null, icon), content);
|
|
74
|
+
};
|
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
import { Fragment } from 'react';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
6
8
|
import { css, jsx } from '@emotion/react';
|
|
7
9
|
import { Field } from 'react-final-form';
|
|
8
10
|
import { ErrorMessage, HelperMessage, Label, RequiredAsterisk } from '@atlaskit/form';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
+
import { Message } from '../../common/ui/message';
|
|
9
13
|
import { shouldShowValidationErrors } from '../../common/utils/form';
|
|
10
14
|
const fieldWrapperStyles = css({
|
|
11
15
|
marginTop: "var(--ds-space-100, 8px)"
|
|
@@ -39,6 +43,10 @@ export function CreateField({
|
|
|
39
43
|
error
|
|
40
44
|
} = meta;
|
|
41
45
|
const hasError = !!submitError || !!error;
|
|
46
|
+
const showErrorMessage = hasError && isInvalid;
|
|
47
|
+
const describedById = `${fieldId}-description`;
|
|
48
|
+
const errorMessageId = `${fieldId}-error`;
|
|
49
|
+
const ariaErrorMessage = showErrorMessage ? errorMessageId : undefined;
|
|
42
50
|
return jsx("div", {
|
|
43
51
|
css: fieldWrapperStyles,
|
|
44
52
|
"data-testid": testId
|
|
@@ -49,11 +57,26 @@ export function CreateField({
|
|
|
49
57
|
}, label, isRequired && jsx(RequiredAsterisk, null)), children({
|
|
50
58
|
...input,
|
|
51
59
|
fieldId,
|
|
52
|
-
isInvalid
|
|
53
|
-
|
|
60
|
+
isInvalid,
|
|
61
|
+
...(fg('linking-platform-create-field-error-association') ? {
|
|
62
|
+
isRequired,
|
|
63
|
+
'aria-errormessage': ariaErrorMessage,
|
|
64
|
+
'aria-describedby': describedById
|
|
65
|
+
} : {})
|
|
66
|
+
}), fg('linking-platform-create-field-error-association') ? jsx("div", {
|
|
67
|
+
id: describedById
|
|
68
|
+
}, !hasError && validationHelpText && jsx(Message, {
|
|
69
|
+
testId: `${testId}-helper-message`
|
|
70
|
+
}, validationHelpText), jsx("div", {
|
|
71
|
+
"aria-live": "polite"
|
|
72
|
+
}, showErrorMessage && jsx(Message, {
|
|
73
|
+
id: errorMessageId,
|
|
74
|
+
appearance: "error",
|
|
75
|
+
testId: `${testId}-error-message`
|
|
76
|
+
}, submitError || error))) : jsx(Fragment, null, !hasError && validationHelpText && jsx(HelperMessage, {
|
|
54
77
|
testId: `${testId}-helper-message`
|
|
55
78
|
}, validationHelpText), hasError && isInvalid && jsx(ErrorMessage, {
|
|
56
79
|
testId: `${testId}-error-message`
|
|
57
|
-
}, submitError || error));
|
|
80
|
+
}, submitError || error)));
|
|
58
81
|
});
|
|
59
82
|
}
|
|
@@ -10,6 +10,7 @@ import { jsx } from '@emotion/react';
|
|
|
10
10
|
import debounce from 'debounce-promise';
|
|
11
11
|
import { useForm } from 'react-final-form';
|
|
12
12
|
import { useIntl } from 'react-intl-next';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { AsyncSelect as AkAsyncSelect } from '@atlaskit/select';
|
|
14
15
|
import messages from '../../../common/messages';
|
|
15
16
|
import { useLinkCreateCallback } from '../../../controllers/callback-context';
|
|
@@ -120,8 +121,19 @@ export function AsyncSelect({
|
|
|
120
121
|
testId: testId
|
|
121
122
|
}, ({
|
|
122
123
|
fieldId,
|
|
124
|
+
isRequired,
|
|
123
125
|
...fieldProps
|
|
124
126
|
}) => {
|
|
127
|
+
if (fg('linking-platform-create-field-error-association')) {
|
|
128
|
+
return jsx(AkAsyncSelect, _extends({
|
|
129
|
+
inputId: fieldId
|
|
130
|
+
}, fieldProps, restProps, {
|
|
131
|
+
required: isRequired,
|
|
132
|
+
loadOptions: debouncedLoadOptions,
|
|
133
|
+
defaultOptions: defaultOptions,
|
|
134
|
+
isLoading: isLoadingDefaultOptions
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
125
137
|
return jsx(AkAsyncSelect, _extends({
|
|
126
138
|
inputId: fieldId
|
|
127
139
|
}, fieldProps, restProps, {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
/**
|
|
2
3
|
* @jsxRuntime classic
|
|
3
4
|
* @jsx jsx
|
|
@@ -10,6 +11,7 @@ import { FORM_ERROR } from 'final-form';
|
|
|
10
11
|
import { Form, FormSpy } from 'react-final-form';
|
|
11
12
|
import { useIntl } from 'react-intl-next';
|
|
12
13
|
import { RequiredAsterisk } from '@atlaskit/form';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
15
|
import { Box } from '@atlaskit/primitives';
|
|
14
16
|
import { CREATE_FORM_MAX_WIDTH_IN_PX, LINK_CREATE_FORM_POST_CREATE_FIELD } from '../../common/constants';
|
|
15
17
|
import messages from '../../common/messages';
|
|
@@ -108,12 +110,15 @@ export const CreateForm = ({
|
|
|
108
110
|
submitError,
|
|
109
111
|
...formProps
|
|
110
112
|
}) => {
|
|
111
|
-
return jsx("form", {
|
|
113
|
+
return jsx("form", _extends({
|
|
112
114
|
onSubmit: formProps.handleSubmit,
|
|
113
|
-
name: "link-create-form"
|
|
115
|
+
name: "link-create-form"
|
|
116
|
+
}, fg('linking-platform-create-field-error-association') ? {
|
|
117
|
+
noValidate: true
|
|
118
|
+
} : {}, {
|
|
114
119
|
"data-testid": testId,
|
|
115
120
|
css: formStyles
|
|
116
|
-
}, jsx(FormSpy, {
|
|
121
|
+
}), jsx(FormSpy, {
|
|
117
122
|
subscription: {
|
|
118
123
|
modified: true
|
|
119
124
|
},
|
|
@@ -7,6 +7,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
9
|
import { useIntl } from 'react-intl-next';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { Inline } from '@atlaskit/primitives';
|
|
11
12
|
import AkSelect, { components } from '@atlaskit/select';
|
|
12
13
|
import { layers } from '@atlaskit/theme/constants';
|
|
@@ -41,8 +42,15 @@ export function Select({
|
|
|
41
42
|
testId: testId
|
|
42
43
|
}, ({
|
|
43
44
|
fieldId,
|
|
45
|
+
isRequired,
|
|
44
46
|
...fieldProps
|
|
45
47
|
}) => {
|
|
48
|
+
if (fg('linking-platform-create-field-error-association')) {
|
|
49
|
+
return jsx(AkSelect, _extends({
|
|
50
|
+
required: isRequired,
|
|
51
|
+
inputId: fieldId
|
|
52
|
+
}, fieldProps, restProps));
|
|
53
|
+
}
|
|
46
54
|
return jsx(AkSelect, _extends({
|
|
47
55
|
inputId: fieldId
|
|
48
56
|
}, fieldProps, restProps));
|
|
@@ -5,6 +5,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
5
5
|
*/
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import AkTextfield from '@atlaskit/textfield';
|
|
9
10
|
import { CreateField } from '../../../controllers/create-field';
|
|
10
11
|
export const TEST_ID = 'link-create-text-field';
|
|
@@ -38,6 +39,11 @@ export function TextField({
|
|
|
38
39
|
fieldId,
|
|
39
40
|
...fieldProps
|
|
40
41
|
}) => {
|
|
42
|
+
if (fg('linking-platform-create-field-error-association')) {
|
|
43
|
+
return jsx(AkTextfield, _extends({
|
|
44
|
+
id: fieldId
|
|
45
|
+
}, fieldProps, restProps));
|
|
46
|
+
}
|
|
41
47
|
return jsx(AkTextfield, _extends({
|
|
42
48
|
id: fieldId
|
|
43
49
|
}, fieldProps, restProps, {
|
|
@@ -32,6 +32,7 @@ export function UserPicker({
|
|
|
32
32
|
validators: validators
|
|
33
33
|
}, ({
|
|
34
34
|
fieldId,
|
|
35
|
+
isRequired,
|
|
35
36
|
...fieldProps
|
|
36
37
|
}) => {
|
|
37
38
|
return jsx(SmartUserPicker, {
|
|
@@ -50,7 +51,8 @@ export function UserPicker({
|
|
|
50
51
|
debounceTime: DEFAULT_DEBOUNCE_TIME,
|
|
51
52
|
prefetch: true,
|
|
52
53
|
isClearable: false,
|
|
53
|
-
width: UserPickerWidth
|
|
54
|
+
width: UserPickerWidth,
|
|
55
|
+
required: isRequired
|
|
54
56
|
});
|
|
55
57
|
});
|
|
56
58
|
}
|
|
@@ -7,7 +7,7 @@ export var CREATE_FORM_MIN_HEIGHT_IN_PX = '200';
|
|
|
7
7
|
export var LINK_CREATE_FORM_POST_CREATE_FIELD = '__post_create__';
|
|
8
8
|
export var PACKAGE_DATA = {
|
|
9
9
|
packageName: "@atlaskit/link-create" || '',
|
|
10
|
-
packageVersion: "2.11.
|
|
10
|
+
packageVersion: "2.11.6" || '',
|
|
11
11
|
component: COMPONENT_NAME,
|
|
12
12
|
componentName: COMPONENT_NAME
|
|
13
13
|
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
+
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import SuccessIcon from '@atlaskit/icon/utility/check-circle';
|
|
9
|
+
import ErrorIcon from '@atlaskit/icon/utility/error';
|
|
10
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
11
|
+
var messageStyles = xcss({
|
|
12
|
+
display: 'flex',
|
|
13
|
+
justifyContent: 'baseline',
|
|
14
|
+
gap: 'space.050',
|
|
15
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
16
|
+
marginBlockStart: 'space.050'
|
|
17
|
+
});
|
|
18
|
+
var messageAppearanceStyles = {
|
|
19
|
+
default: xcss({
|
|
20
|
+
color: 'color.text.subtlest'
|
|
21
|
+
}),
|
|
22
|
+
error: xcss({
|
|
23
|
+
color: 'color.text.danger'
|
|
24
|
+
}),
|
|
25
|
+
valid: xcss({
|
|
26
|
+
color: 'color.text.success'
|
|
27
|
+
})
|
|
28
|
+
};
|
|
29
|
+
var iconWrapperStyles = css({
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
marginInlineStart: "var(--ds-space-025, 2px)",
|
|
33
|
+
marginInlineEnd: "var(--ds-space-025, 2px)"
|
|
34
|
+
});
|
|
35
|
+
var IconWrapper = function IconWrapper(_ref) {
|
|
36
|
+
var children = _ref.children;
|
|
37
|
+
return jsx("span", {
|
|
38
|
+
css: iconWrapperStyles
|
|
39
|
+
}, children);
|
|
40
|
+
};
|
|
41
|
+
var messageIcons = {
|
|
42
|
+
error: jsx(ErrorIcon, {
|
|
43
|
+
color: "var(--ds-text-danger, #AE2A19)",
|
|
44
|
+
label: "error"
|
|
45
|
+
}),
|
|
46
|
+
valid: jsx(SuccessIcon, {
|
|
47
|
+
color: "var(--ds-text-success, #216E4E)",
|
|
48
|
+
label: "success"
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
export var Message = function Message(_ref2) {
|
|
52
|
+
var children = _ref2.children,
|
|
53
|
+
_ref2$appearance = _ref2.appearance,
|
|
54
|
+
appearance = _ref2$appearance === void 0 ? 'default' : _ref2$appearance,
|
|
55
|
+
id = _ref2.id,
|
|
56
|
+
testId = _ref2.testId;
|
|
57
|
+
var icon = messageIcons[appearance];
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The wrapping span is necessary to preserve spaces between children.
|
|
61
|
+
* Otherwise the flex layout of the message will remove any whitespace
|
|
62
|
+
* between children.
|
|
63
|
+
*
|
|
64
|
+
* If the child is just a string, this is not required and we can use one
|
|
65
|
+
* less DOM element.
|
|
66
|
+
*/
|
|
67
|
+
var content = typeof children === 'string' ? children : jsx("span", null, children);
|
|
68
|
+
return jsx(Box, {
|
|
69
|
+
xcss: [messageStyles, messageAppearanceStyles[appearance]],
|
|
70
|
+
testId: testId,
|
|
71
|
+
id: id
|
|
72
|
+
}, icon && jsx(IconWrapper, null, icon), content);
|
|
73
|
+
};
|
|
@@ -5,10 +5,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
* @jsxRuntime classic
|
|
6
6
|
* @jsx jsx
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
import { Fragment } from 'react';
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
9
11
|
import { css, jsx } from '@emotion/react';
|
|
10
12
|
import { Field } from 'react-final-form';
|
|
11
13
|
import { ErrorMessage, HelperMessage, Label, RequiredAsterisk } from '@atlaskit/form';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
|
+
import { Message } from '../../common/ui/message';
|
|
12
16
|
import { shouldShowValidationErrors } from '../../common/utils/form';
|
|
13
17
|
var fieldWrapperStyles = css({
|
|
14
18
|
marginTop: "var(--ds-space-100, 8px)"
|
|
@@ -38,6 +42,10 @@ export function CreateField(_ref) {
|
|
|
38
42
|
var submitError = meta.submitError,
|
|
39
43
|
error = meta.error;
|
|
40
44
|
var hasError = !!submitError || !!error;
|
|
45
|
+
var showErrorMessage = hasError && isInvalid;
|
|
46
|
+
var describedById = "".concat(fieldId, "-description");
|
|
47
|
+
var errorMessageId = "".concat(fieldId, "-error");
|
|
48
|
+
var ariaErrorMessage = showErrorMessage ? errorMessageId : undefined;
|
|
41
49
|
return jsx("div", {
|
|
42
50
|
css: fieldWrapperStyles,
|
|
43
51
|
"data-testid": testId
|
|
@@ -48,10 +56,24 @@ export function CreateField(_ref) {
|
|
|
48
56
|
}, label, isRequired && jsx(RequiredAsterisk, null)), children(_objectSpread(_objectSpread({}, input), {}, {
|
|
49
57
|
fieldId: fieldId,
|
|
50
58
|
isInvalid: isInvalid
|
|
51
|
-
}
|
|
59
|
+
}, fg('linking-platform-create-field-error-association') ? {
|
|
60
|
+
isRequired: isRequired,
|
|
61
|
+
'aria-errormessage': ariaErrorMessage,
|
|
62
|
+
'aria-describedby': describedById
|
|
63
|
+
} : {})), fg('linking-platform-create-field-error-association') ? jsx("div", {
|
|
64
|
+
id: describedById
|
|
65
|
+
}, !hasError && validationHelpText && jsx(Message, {
|
|
66
|
+
testId: "".concat(testId, "-helper-message")
|
|
67
|
+
}, validationHelpText), jsx("div", {
|
|
68
|
+
"aria-live": "polite"
|
|
69
|
+
}, showErrorMessage && jsx(Message, {
|
|
70
|
+
id: errorMessageId,
|
|
71
|
+
appearance: "error",
|
|
72
|
+
testId: "".concat(testId, "-error-message")
|
|
73
|
+
}, submitError || error))) : jsx(Fragment, null, !hasError && validationHelpText && jsx(HelperMessage, {
|
|
52
74
|
testId: "".concat(testId, "-helper-message")
|
|
53
75
|
}, validationHelpText), hasError && isInvalid && jsx(ErrorMessage, {
|
|
54
76
|
testId: "".concat(testId, "-error-message")
|
|
55
|
-
}, submitError || error));
|
|
77
|
+
}, submitError || error)));
|
|
56
78
|
});
|
|
57
79
|
}
|
|
@@ -3,7 +3,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
5
|
var _excluded = ["id", "name", "label", "isRequired", "validators", "validationHelpText", "testId", "defaultOption", "loadOptions"],
|
|
6
|
-
_excluded2 = ["fieldId"];
|
|
6
|
+
_excluded2 = ["fieldId", "isRequired"];
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
/**
|
|
9
9
|
* @jsxRuntime classic
|
|
@@ -16,6 +16,7 @@ import { jsx } from '@emotion/react';
|
|
|
16
16
|
import debounce from 'debounce-promise';
|
|
17
17
|
import { useForm } from 'react-final-form';
|
|
18
18
|
import { useIntl } from 'react-intl-next';
|
|
19
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
19
20
|
import { AsyncSelect as AkAsyncSelect } from '@atlaskit/select';
|
|
20
21
|
import messages from '../../../common/messages';
|
|
21
22
|
import { useLinkCreateCallback } from '../../../controllers/callback-context';
|
|
@@ -173,7 +174,18 @@ export function AsyncSelect(_ref) {
|
|
|
173
174
|
testId: testId
|
|
174
175
|
}, function (_ref4) {
|
|
175
176
|
var fieldId = _ref4.fieldId,
|
|
177
|
+
isRequired = _ref4.isRequired,
|
|
176
178
|
fieldProps = _objectWithoutProperties(_ref4, _excluded2);
|
|
179
|
+
if (fg('linking-platform-create-field-error-association')) {
|
|
180
|
+
return jsx(AkAsyncSelect, _extends({
|
|
181
|
+
inputId: fieldId
|
|
182
|
+
}, fieldProps, restProps, {
|
|
183
|
+
required: isRequired,
|
|
184
|
+
loadOptions: debouncedLoadOptions,
|
|
185
|
+
defaultOptions: defaultOptions,
|
|
186
|
+
isLoading: isLoadingDefaultOptions
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
177
189
|
return jsx(AkAsyncSelect, _extends({
|
|
178
190
|
inputId: fieldId
|
|
179
191
|
}, fieldProps, restProps, {
|
|
@@ -35,6 +35,7 @@ export function CreateFormFooter(_ref) {
|
|
|
35
35
|
"data-testid": "".concat(testId, "-footer"),
|
|
36
36
|
css: formFooterWrapperStyles
|
|
37
37
|
}, formErrorMessage && jsx("div", {
|
|
38
|
+
role: "alert",
|
|
38
39
|
css: errorStyles,
|
|
39
40
|
"data-testid": "".concat(testId, "-error")
|
|
40
41
|
}, jsx(ErrorIcon, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
5
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
@@ -18,6 +19,7 @@ import { FORM_ERROR } from 'final-form';
|
|
|
18
19
|
import { Form, FormSpy } from 'react-final-form';
|
|
19
20
|
import { useIntl } from 'react-intl-next';
|
|
20
21
|
import { RequiredAsterisk } from '@atlaskit/form';
|
|
22
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
23
|
import { Box } from '@atlaskit/primitives';
|
|
22
24
|
import { CREATE_FORM_MAX_WIDTH_IN_PX, LINK_CREATE_FORM_POST_CREATE_FIELD } from '../../common/constants';
|
|
23
25
|
import messages from '../../common/messages';
|
|
@@ -135,12 +137,15 @@ export var CreateForm = function CreateForm(_ref) {
|
|
|
135
137
|
}, function (_ref5) {
|
|
136
138
|
var submitError = _ref5.submitError,
|
|
137
139
|
formProps = _objectWithoutProperties(_ref5, _excluded);
|
|
138
|
-
return jsx("form", {
|
|
140
|
+
return jsx("form", _extends({
|
|
139
141
|
onSubmit: formProps.handleSubmit,
|
|
140
|
-
name: "link-create-form"
|
|
142
|
+
name: "link-create-form"
|
|
143
|
+
}, fg('linking-platform-create-field-error-association') ? {
|
|
144
|
+
noValidate: true
|
|
145
|
+
} : {}, {
|
|
141
146
|
"data-testid": testId,
|
|
142
147
|
css: formStyles
|
|
143
|
-
}, jsx(FormSpy, {
|
|
148
|
+
}), jsx(FormSpy, {
|
|
144
149
|
subscription: {
|
|
145
150
|
modified: true
|
|
146
151
|
},
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["id", "name", "label", "isRequired", "validators", "validationHelpText", "testId"],
|
|
5
|
-
_excluded2 = ["fieldId"],
|
|
5
|
+
_excluded2 = ["fieldId", "isRequired"],
|
|
6
6
|
_excluded3 = ["children"],
|
|
7
7
|
_excluded4 = ["children"];
|
|
8
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -15,6 +15,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
15
15
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
16
|
import { jsx } from '@emotion/react';
|
|
17
17
|
import { useIntl } from 'react-intl-next';
|
|
18
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
19
|
import { Inline } from '@atlaskit/primitives';
|
|
19
20
|
import AkSelect, { components } from '@atlaskit/select';
|
|
20
21
|
import { layers } from '@atlaskit/theme/constants';
|
|
@@ -49,7 +50,14 @@ export function Select(_ref) {
|
|
|
49
50
|
testId: testId
|
|
50
51
|
}, function (_ref2) {
|
|
51
52
|
var fieldId = _ref2.fieldId,
|
|
53
|
+
isRequired = _ref2.isRequired,
|
|
52
54
|
fieldProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
55
|
+
if (fg('linking-platform-create-field-error-association')) {
|
|
56
|
+
return jsx(AkSelect, _extends({
|
|
57
|
+
required: isRequired,
|
|
58
|
+
inputId: fieldId
|
|
59
|
+
}, fieldProps, restProps));
|
|
60
|
+
}
|
|
53
61
|
return jsx(AkSelect, _extends({
|
|
54
62
|
inputId: fieldId
|
|
55
63
|
}, fieldProps, restProps));
|
|
@@ -8,6 +8,7 @@ var _excluded = ["id", "name", "label", "isRequired", "validators", "validationH
|
|
|
8
8
|
*/
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
10
|
import { jsx } from '@emotion/react';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import AkTextfield from '@atlaskit/textfield';
|
|
12
13
|
import { CreateField } from '../../../controllers/create-field';
|
|
13
14
|
export var TEST_ID = 'link-create-text-field';
|
|
@@ -40,6 +41,11 @@ export function TextField(_ref) {
|
|
|
40
41
|
}, function (_ref2) {
|
|
41
42
|
var fieldId = _ref2.fieldId,
|
|
42
43
|
fieldProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
44
|
+
if (fg('linking-platform-create-field-error-association')) {
|
|
45
|
+
return jsx(AkTextfield, _extends({
|
|
46
|
+
id: fieldId
|
|
47
|
+
}, fieldProps, restProps));
|
|
48
|
+
}
|
|
43
49
|
return jsx(AkTextfield, _extends({
|
|
44
50
|
id: fieldId
|
|
45
51
|
}, fieldProps, restProps, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["fieldId"];
|
|
3
|
+
var _excluded = ["fieldId", "isRequired"];
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
/**
|
|
@@ -37,6 +37,7 @@ export function UserPicker(_ref) {
|
|
|
37
37
|
validators: validators
|
|
38
38
|
}, function (_ref2) {
|
|
39
39
|
var fieldId = _ref2.fieldId,
|
|
40
|
+
isRequired = _ref2.isRequired,
|
|
40
41
|
fieldProps = _objectWithoutProperties(_ref2, _excluded);
|
|
41
42
|
return jsx(SmartUserPicker, {
|
|
42
43
|
defaultValue: defaultValue ? _objectSpread(_objectSpread({}, defaultValue), {}, {
|
|
@@ -55,7 +56,8 @@ export function UserPicker(_ref) {
|
|
|
55
56
|
debounceTime: DEFAULT_DEBOUNCE_TIME,
|
|
56
57
|
prefetch: true,
|
|
57
58
|
isClearable: false,
|
|
58
|
-
width: UserPickerWidth
|
|
59
|
+
width: UserPickerWidth,
|
|
60
|
+
required: isRequired
|
|
59
61
|
});
|
|
60
62
|
});
|
|
61
63
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type ReactNode } from 'react';
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
type MessageAppearance = 'default' | 'error' | 'valid';
|
|
8
|
+
type MessageProps = {
|
|
9
|
+
id?: string;
|
|
10
|
+
appearance?: MessageAppearance;
|
|
11
|
+
testId?: string;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export declare const Message: ({ children, appearance, id, testId }: MessageProps) => jsx.JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
1
|
import { jsx } from '@emotion/react';
|
|
6
2
|
import { type CreateFieldProps } from './types';
|
|
7
3
|
export declare function CreateField({ id, name, label, isRequired, validators, validationHelpText, testId, children, }: CreateFieldProps): jsx.JSX.Element;
|
|
@@ -4,6 +4,11 @@ import { type Validator } from '../../common/types';
|
|
|
4
4
|
type FieldProps = FieldInputProps<any, HTMLElement> & {
|
|
5
5
|
fieldId: string;
|
|
6
6
|
isInvalid: boolean;
|
|
7
|
+
isRequired?: boolean;
|
|
8
|
+
/** ID to reference an error message for the field */
|
|
9
|
+
'aria-errormessage'?: string;
|
|
10
|
+
/** ID to refer to description for field */
|
|
11
|
+
'aria-describedby'?: string;
|
|
7
12
|
};
|
|
8
13
|
export type CreateFieldProps = {
|
|
9
14
|
id?: string;
|
|
@@ -15,7 +15,7 @@ export declare const TEST_ID = "link-create-select";
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function Select<T = OptionType>({ id, name, label, isRequired, validators, validationHelpText, testId, ...restProps }: SelectProps<T>): jsx.JSX.Element;
|
|
17
17
|
export type SiteSelectProps = {
|
|
18
|
-
testId
|
|
18
|
+
testId?: string;
|
|
19
19
|
options?: SitePickerOptionType[];
|
|
20
20
|
name?: string;
|
|
21
21
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type ReactNode } from 'react';
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
type MessageAppearance = 'default' | 'error' | 'valid';
|
|
8
|
+
type MessageProps = {
|
|
9
|
+
id?: string;
|
|
10
|
+
appearance?: MessageAppearance;
|
|
11
|
+
testId?: string;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export declare const Message: ({ children, appearance, id, testId }: MessageProps) => jsx.JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
1
|
import { jsx } from '@emotion/react';
|
|
6
2
|
import { type CreateFieldProps } from './types';
|
|
7
3
|
export declare function CreateField({ id, name, label, isRequired, validators, validationHelpText, testId, children, }: CreateFieldProps): jsx.JSX.Element;
|
|
@@ -4,6 +4,11 @@ import { type Validator } from '../../common/types';
|
|
|
4
4
|
type FieldProps = FieldInputProps<any, HTMLElement> & {
|
|
5
5
|
fieldId: string;
|
|
6
6
|
isInvalid: boolean;
|
|
7
|
+
isRequired?: boolean;
|
|
8
|
+
/** ID to reference an error message for the field */
|
|
9
|
+
'aria-errormessage'?: string;
|
|
10
|
+
/** ID to refer to description for field */
|
|
11
|
+
'aria-describedby'?: string;
|
|
7
12
|
};
|
|
8
13
|
export type CreateFieldProps = {
|
|
9
14
|
id?: string;
|
|
@@ -15,7 +15,7 @@ export declare const TEST_ID = "link-create-select";
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function Select<T = OptionType>({ id, name, label, isRequired, validators, validationHelpText, testId, ...restProps }: SelectProps<T>): jsx.JSX.Element;
|
|
17
17
|
export type SiteSelectProps = {
|
|
18
|
-
testId
|
|
18
|
+
testId?: string;
|
|
19
19
|
options?: SitePickerOptionType[];
|
|
20
20
|
name?: string;
|
|
21
21
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-create",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.6",
|
|
4
4
|
"description": "The driver component of meta creation flow",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -9,11 +9,6 @@
|
|
|
9
9
|
},
|
|
10
10
|
"atlassian": {
|
|
11
11
|
"team": "Linking Platform",
|
|
12
|
-
"inPublicMirror": false,
|
|
13
|
-
"releaseModel": "continuous",
|
|
14
|
-
"productPushConsumption": [
|
|
15
|
-
"jira"
|
|
16
|
-
],
|
|
17
12
|
"website": {
|
|
18
13
|
"name": "LinkCreate"
|
|
19
14
|
},
|
|
@@ -40,24 +35,24 @@
|
|
|
40
35
|
},
|
|
41
36
|
"dependencies": {
|
|
42
37
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
43
|
-
"@atlaskit/atlassian-context": "^0.0.
|
|
38
|
+
"@atlaskit/atlassian-context": "^0.0.1",
|
|
44
39
|
"@atlaskit/button": "^20.1.0",
|
|
45
40
|
"@atlaskit/empty-state": "^7.11.0",
|
|
46
41
|
"@atlaskit/form": "^10.5.0",
|
|
47
|
-
"@atlaskit/icon": "^22.
|
|
48
|
-
"@atlaskit/icon-file-type": "^6.
|
|
42
|
+
"@atlaskit/icon": "^22.15.0",
|
|
43
|
+
"@atlaskit/icon-file-type": "^6.5.0",
|
|
49
44
|
"@atlaskit/intl-messages-provider": "^1.0.2",
|
|
50
45
|
"@atlaskit/layering": "^0.4.0",
|
|
51
46
|
"@atlaskit/linking-common": "^5.11.0",
|
|
52
47
|
"@atlaskit/modal-dialog": "^12.15.0",
|
|
53
48
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
54
|
-
"@atlaskit/primitives": "^12.
|
|
49
|
+
"@atlaskit/primitives": "^12.1.0",
|
|
55
50
|
"@atlaskit/select": "^17.15.0",
|
|
56
51
|
"@atlaskit/smart-user-picker": "^6.10.0",
|
|
57
52
|
"@atlaskit/spinner": "^16.3.0",
|
|
58
53
|
"@atlaskit/textfield": "^6.5.0",
|
|
59
54
|
"@atlaskit/theme": "^13.0.0",
|
|
60
|
-
"@atlaskit/tokens": "^1.
|
|
55
|
+
"@atlaskit/tokens": "^1.59.0",
|
|
61
56
|
"@babel/runtime": "^7.0.0",
|
|
62
57
|
"@emotion/react": "^11.7.1",
|
|
63
58
|
"@emotion/styled": "^11.0.0",
|
|
@@ -70,11 +65,12 @@
|
|
|
70
65
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
71
66
|
},
|
|
72
67
|
"devDependencies": {
|
|
68
|
+
"@af/accessibility-testing": "*",
|
|
73
69
|
"@af/integration-testing": "*",
|
|
74
70
|
"@af/visual-regression": "*",
|
|
75
71
|
"@atlaskit/drawer": "^7.14.0",
|
|
76
|
-
"@atlaskit/link-test-helpers": "^7.
|
|
77
|
-
"@atlaskit/popup": "^1.
|
|
72
|
+
"@atlaskit/link-test-helpers": "^7.5.0",
|
|
73
|
+
"@atlaskit/popup": "^1.24.0",
|
|
78
74
|
"@atlaskit/visual-regression": "*",
|
|
79
75
|
"@atlassian/feature-flags-test-utils": "*",
|
|
80
76
|
"@testing-library/react": "^12.1.5",
|
|
@@ -128,6 +124,9 @@
|
|
|
128
124
|
"platform-feature-flags": {
|
|
129
125
|
"linking-platform-link-create-nest-exit-warning": {
|
|
130
126
|
"type": "boolean"
|
|
127
|
+
},
|
|
128
|
+
"linking-platform-create-field-error-association": {
|
|
129
|
+
"type": "boolean"
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
132
|
}
|