@atlaskit/jql-editor 5.1.2 → 5.2.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 +16 -0
- package/dist/cjs/analytics/util.js +1 -1
- package/dist/cjs/ui/jql-editor-controls-content/syntax-help/index.js +2 -1
- package/dist/cjs/ui/jql-editor-footer-content/jql-editor-help/index.js +3 -3
- package/dist/cjs/ui/jql-editor-footer-content/jql-messages/errors/index.js +17 -85
- package/dist/cjs/ui/jql-editor-footer-content/jql-messages/format/index.js +6 -20
- package/dist/cjs/ui/jql-editor-footer-content/jql-messages/infos/index.js +2 -2
- package/dist/cjs/ui/jql-editor-footer-content/jql-messages/warnings/index.js +2 -2
- package/dist/cjs/ui/jql-editor-layout/index.js +2 -2
- package/dist/es2019/analytics/util.js +1 -1
- package/dist/es2019/ui/jql-editor-controls-content/syntax-help/index.js +2 -1
- package/dist/es2019/ui/jql-editor-footer-content/jql-editor-help/index.js +1 -1
- package/dist/es2019/ui/jql-editor-footer-content/jql-messages/errors/index.js +12 -77
- package/dist/es2019/ui/jql-editor-footer-content/jql-messages/format/index.js +6 -18
- package/dist/es2019/ui/jql-editor-footer-content/jql-messages/infos/index.js +1 -1
- package/dist/es2019/ui/jql-editor-footer-content/jql-messages/warnings/index.js +1 -1
- package/dist/es2019/ui/jql-editor-layout/index.js +1 -1
- package/dist/esm/analytics/util.js +1 -1
- package/dist/esm/ui/jql-editor-controls-content/syntax-help/index.js +2 -1
- package/dist/esm/ui/jql-editor-footer-content/jql-editor-help/index.js +1 -1
- package/dist/esm/ui/jql-editor-footer-content/jql-messages/errors/index.js +18 -85
- package/dist/esm/ui/jql-editor-footer-content/jql-messages/format/index.js +6 -20
- package/dist/esm/ui/jql-editor-footer-content/jql-messages/infos/index.js +1 -1
- package/dist/esm/ui/jql-editor-footer-content/jql-messages/warnings/index.js +1 -1
- package/dist/esm/ui/jql-editor-layout/index.js +1 -1
- package/dist/types/state/types.d.ts +2 -2
- package/dist/types-ts4.5/state/types.d.ts +2 -2
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/jql-editor
|
|
2
2
|
|
|
3
|
+
## 5.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#144736](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/144736)
|
|
8
|
+
[`ff74b78729adb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ff74b78729adb) -
|
|
9
|
+
Internal change to move to Compiled CSS-in-JS styling.
|
|
10
|
+
|
|
11
|
+
## 5.2.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#140363](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/140363)
|
|
16
|
+
[`46ddb88edd38f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/46ddb88edd38f) -
|
|
17
|
+
Cleanup FG gravityai-2553-fix-jql-debugger-flicker [GRAVITYAI-2751]
|
|
18
|
+
|
|
3
19
|
## 5.1.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useJqlEditorAnalytics = void 0;
|
|
7
7
|
var _jqlEditorCommon = require("@atlaskit/jql-editor-common");
|
|
8
8
|
var useJqlEditorAnalytics = exports.useJqlEditorAnalytics = function useJqlEditorAnalytics(analyticsSource) {
|
|
9
|
-
return (0, _jqlEditorCommon.useJqlPackageAnalytics)(analyticsSource, "@atlaskit/jql-editor", "5.1
|
|
9
|
+
return (0, _jqlEditorCommon.useJqlPackageAnalytics)(analyticsSource, "@atlaskit/jql-editor", "5.2.1", _jqlEditorCommon.ANALYTICS_CHANNEL);
|
|
10
10
|
};
|
|
@@ -53,7 +53,8 @@ var SyntaxHelp = exports.SyntaxHelp = function SyntaxHelp() {
|
|
|
53
53
|
content: /*#__PURE__*/_react.default.createElement(_styled.TooltipContent, null, label)
|
|
54
54
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
55
55
|
,
|
|
56
|
-
tag: _tooltipTag.TooltipTag
|
|
56
|
+
tag: _tooltipTag.TooltipTag,
|
|
57
|
+
isScreenReaderAnnouncementDisabled: true
|
|
57
58
|
}, /*#__PURE__*/_react.default.createElement(_baseSyntaxHelp.BaseSyntaxHelp, {
|
|
58
59
|
describedby: descriptionId,
|
|
59
60
|
label: label,
|
|
@@ -8,7 +8,7 @@ exports.JQLEditorHelp = void 0;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _form = require("@atlaskit/form");
|
|
11
|
-
var
|
|
11
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
12
12
|
var _constants = require("../../../common/constants");
|
|
13
13
|
var _useEditorTheme = require("../../../hooks/use-editor-theme");
|
|
14
14
|
var _state = require("../../../state");
|
|
@@ -26,7 +26,7 @@ var JQLEditorHelp = exports.JQLEditorHelp = function JQLEditorHelp() {
|
|
|
26
26
|
var _useScopedId = (0, _state.useScopedId)(_constants.JQL_EDITOR_HELP_CONTENT_ID),
|
|
27
27
|
_useScopedId2 = (0, _slicedToArray2.default)(_useScopedId, 1),
|
|
28
28
|
helpContentId = _useScopedId2[0];
|
|
29
|
-
var SearchMessage = /*#__PURE__*/_react.default.createElement(
|
|
29
|
+
var SearchMessage = /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
30
30
|
size: "UNSAFE_small",
|
|
31
31
|
color: "inherit"
|
|
32
32
|
}, formatMessage(_messages.messages.searchCommand, {
|
|
@@ -34,7 +34,7 @@ var JQLEditorHelp = exports.JQLEditorHelp = function JQLEditorHelp() {
|
|
|
34
34
|
return /*#__PURE__*/_react.default.createElement("b", null, text);
|
|
35
35
|
}
|
|
36
36
|
}));
|
|
37
|
-
var NewLineMessage = /*#__PURE__*/_react.default.createElement(
|
|
37
|
+
var NewLineMessage = /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
38
38
|
size: "UNSAFE_small",
|
|
39
39
|
color: "inherit"
|
|
40
40
|
}, formatMessage(isSearch ? _messages.messages.newLineCommand : _messages.messages.fieldNewLineCommand, {
|
|
@@ -24,7 +24,11 @@ var _messages2 = require("./messages");
|
|
|
24
24
|
var _excluded = ["Component"];
|
|
25
25
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
26
26
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* This function maps client side validation errors and external messages into a unified format
|
|
29
|
+
* This is so that the output of this function can then be processed in a unified manner by different renderers
|
|
30
|
+
*/
|
|
31
|
+
var useErrorMessages = function useErrorMessages() {
|
|
28
32
|
var _useIntl = (0, _state.useIntl)(),
|
|
29
33
|
_useIntl2 = (0, _slicedToArray2.default)(_useIntl, 1),
|
|
30
34
|
formatMessage = _useIntl2[0].formatMessage;
|
|
@@ -46,53 +50,6 @@ var useFormattedErrorMessage = function useFormattedErrorMessage() {
|
|
|
46
50
|
return null;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
// Prioritise client over external errors
|
|
50
|
-
if (jqlError instanceof _jqlAst.JQLSyntaxError) {
|
|
51
|
-
return "".concat(jqlError.message, " ").concat(formatMessage(_messages2.messages.jqlErrorPosition, {
|
|
52
|
-
lineNumber: jqlError.line,
|
|
53
|
-
charPosition: jqlError.charPositionInLine + 1
|
|
54
|
-
}));
|
|
55
|
-
} else if (externalErrors.length > 0) {
|
|
56
|
-
return /*#__PURE__*/_react.default.createElement(_format.FormatMessages, {
|
|
57
|
-
messages: externalErrors
|
|
58
|
-
});
|
|
59
|
-
} else if (jqlError !== null) {
|
|
60
|
-
return formatMessage(_messages.commonMessages.unknownError);
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* This function maps client side validation errors and external messages into a unified format
|
|
67
|
-
* This is so that the output of this function can then be processed in a unified manner by different renderers
|
|
68
|
-
*
|
|
69
|
-
* ------ REMOVE THE FOLLOWING COMMENTS WITH THE FG CLEANUP OF gravityai-2553-fix-jql-debugger-flicker -----
|
|
70
|
-
* Cloned from useFormattedErrorMessage. Differences are:
|
|
71
|
-
* - return type is ExternalMessage[] instead of ReactNode
|
|
72
|
-
* - Stripped rendering logic away (i.e. FormatMessages) to make the implementation modular
|
|
73
|
-
*/
|
|
74
|
-
var useErrorMessages = function useErrorMessages() {
|
|
75
|
-
var _useIntl3 = (0, _state.useIntl)(),
|
|
76
|
-
_useIntl4 = (0, _slicedToArray2.default)(_useIntl3, 1),
|
|
77
|
-
formatMessage = _useIntl4[0].formatMessage;
|
|
78
|
-
var _useJqlError3 = (0, _state.useJqlError)(),
|
|
79
|
-
_useJqlError4 = (0, _slicedToArray2.default)(_useJqlError3, 1),
|
|
80
|
-
jqlError = _useJqlError4[0];
|
|
81
|
-
var _useExternalMessages3 = (0, _state.useExternalMessages)(),
|
|
82
|
-
_useExternalMessages4 = (0, _slicedToArray2.default)(_useExternalMessages3, 1),
|
|
83
|
-
externalErrors = _useExternalMessages4[0].errors;
|
|
84
|
-
var _useStoreActions3 = (0, _state.useStoreActions)(),
|
|
85
|
-
_useStoreActions4 = (0, _slicedToArray2.default)(_useStoreActions3, 2),
|
|
86
|
-
externalErrorMessageViewed = _useStoreActions4[1].externalErrorMessageViewed;
|
|
87
|
-
var editorViewIsInvalid = (0, _useEditorViewIsInvalid.useEditorViewIsInvalid)();
|
|
88
|
-
(0, _react.useEffect)(function () {
|
|
89
|
-
// Emit a UI event whenever external errors has changed
|
|
90
|
-
externalErrorMessageViewed();
|
|
91
|
-
}, [externalErrorMessageViewed, externalErrors]);
|
|
92
|
-
if (!editorViewIsInvalid) {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
53
|
/**
|
|
97
54
|
* Transform a string message to take the form of an ExternalMessage,
|
|
98
55
|
* so that we can reduce a bunch of conditionals when processing the output of useErrorMessages
|
|
@@ -145,57 +102,32 @@ var ErrorMessages = exports.ErrorMessages = function ErrorMessages() {
|
|
|
145
102
|
var _useScopedId3 = (0, _state.useScopedId)(_constants.JQL_EDITOR_VALIDATION_ID),
|
|
146
103
|
_useScopedId4 = (0, _slicedToArray2.default)(_useScopedId3, 1),
|
|
147
104
|
validationId = _useScopedId4[0];
|
|
148
|
-
|
|
149
|
-
var errorMessages = (0, _platformFeatureFlags.fg)('gravityai-2553-fix-jql-debugger-flicker') ? useErrorMessages() : null;
|
|
150
|
-
var errorMessage = !(0, _platformFeatureFlags.fg)('gravityai-2553-fix-jql-debugger-flicker') ?
|
|
151
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
152
|
-
useFormattedErrorMessage() : null;
|
|
105
|
+
var errorMessages = useErrorMessages();
|
|
153
106
|
var _useCustomErrorCompon = (0, _state.useCustomErrorComponent)(),
|
|
154
107
|
_useCustomErrorCompon2 = (0, _slicedToArray2.default)(_useCustomErrorCompon, 1),
|
|
155
108
|
CustomErrorComponent = _useCustomErrorCompon2[0];
|
|
156
|
-
|
|
157
|
-
var _childrenToRender = errorMessages != null ? /*#__PURE__*/_react.default.createElement(_format.MessageContainer, null, /*#__PURE__*/_react.default.createElement(_form.ErrorMessage, {
|
|
158
|
-
testId: _constants.JQL_EDITOR_VALIDATION_ID
|
|
159
|
-
}, (0, _platformFeatureFlags.fg)('jql_editor_a11y') ? /*#__PURE__*/_react.default.createElement("span", {
|
|
160
|
-
role: "alert",
|
|
161
|
-
id: validationId
|
|
162
|
-
}, /*#__PURE__*/_react.default.createElement(_format.FormatMessages, {
|
|
163
|
-
messages: errorMessages
|
|
164
|
-
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
165
|
-
role: "alert",
|
|
166
|
-
"aria-describedby": editorId
|
|
167
|
-
}, /*#__PURE__*/_react.default.createElement(_format.FormatMessages, {
|
|
168
|
-
messages: errorMessages
|
|
169
|
-
})))) : null;
|
|
170
|
-
|
|
171
|
-
// Only render CustomErrorComponent if there is an errorMessage
|
|
172
|
-
if (errorMessages != null && CustomErrorComponent) {
|
|
173
|
-
return /*#__PURE__*/_react.default.createElement(CustomComponentDecoratedWithEditorTheme, {
|
|
174
|
-
testId: _constants.JQL_EDITOR_VALIDATION_ID,
|
|
175
|
-
editorId: editorId,
|
|
176
|
-
validationId: validationId,
|
|
177
|
-
Component: CustomErrorComponent,
|
|
178
|
-
errorMessages: (0, _format.extractMessageNodes)(errorMessages)
|
|
179
|
-
}, _childrenToRender);
|
|
180
|
-
}
|
|
181
|
-
return _childrenToRender;
|
|
182
|
-
}
|
|
183
|
-
var childrenToRender = errorMessage != null ? /*#__PURE__*/_react.default.createElement(_format.MessageContainer, null, /*#__PURE__*/_react.default.createElement(_form.ErrorMessage, {
|
|
109
|
+
var childrenToRender = errorMessages != null ? /*#__PURE__*/_react.default.createElement(_format.MessageContainer, null, /*#__PURE__*/_react.default.createElement(_form.ErrorMessage, {
|
|
184
110
|
testId: _constants.JQL_EDITOR_VALIDATION_ID
|
|
185
111
|
}, (0, _platformFeatureFlags.fg)('jql_editor_a11y') ? /*#__PURE__*/_react.default.createElement("span", {
|
|
186
112
|
role: "alert",
|
|
187
113
|
id: validationId
|
|
188
|
-
},
|
|
114
|
+
}, /*#__PURE__*/_react.default.createElement(_format.FormatMessages, {
|
|
115
|
+
messages: errorMessages
|
|
116
|
+
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
189
117
|
role: "alert",
|
|
190
118
|
"aria-describedby": editorId
|
|
191
|
-
},
|
|
119
|
+
}, /*#__PURE__*/_react.default.createElement(_format.FormatMessages, {
|
|
120
|
+
messages: errorMessages
|
|
121
|
+
})))) : null;
|
|
192
122
|
|
|
193
123
|
// Only render CustomErrorComponent if there is an errorMessage
|
|
194
|
-
if (
|
|
124
|
+
if (errorMessages != null && CustomErrorComponent) {
|
|
195
125
|
return /*#__PURE__*/_react.default.createElement(CustomComponentDecoratedWithEditorTheme, {
|
|
196
126
|
testId: _constants.JQL_EDITOR_VALIDATION_ID,
|
|
197
127
|
editorId: editorId,
|
|
198
|
-
|
|
128
|
+
validationId: validationId,
|
|
129
|
+
Component: CustomErrorComponent,
|
|
130
|
+
errorMessages: (0, _format.extractMessageNodes)(errorMessages)
|
|
199
131
|
}, childrenToRender);
|
|
200
132
|
}
|
|
201
133
|
return childrenToRender;
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.extractMessageNodes = exports.MessageContainer = exports.FormatMessages = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var _useEditorTheme = require("../../../../hooks/use-editor-theme");
|
|
11
10
|
var _styled = require("./styled");
|
|
12
11
|
// Max number messages we want to show
|
|
@@ -21,30 +20,17 @@ var MessageContainer = exports.MessageContainer = function MessageContainer(_ref
|
|
|
21
20
|
};
|
|
22
21
|
var FormatMessages = exports.FormatMessages = function FormatMessages(_ref2) {
|
|
23
22
|
var messages = _ref2.messages;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (messageNodes.length === 0) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
if (messageNodes.length === 1) {
|
|
30
|
-
return /*#__PURE__*/_react.default.createElement("span", null, messageNodes[0]);
|
|
31
|
-
}
|
|
32
|
-
return /*#__PURE__*/_react.default.createElement(_styled.MessageList, null, messageNodes.map(function (m, i) {
|
|
33
|
-
return /*#__PURE__*/_react.default.createElement("li", {
|
|
34
|
-
key: i
|
|
35
|
-
}, m);
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
if (messages.length === 0) {
|
|
23
|
+
var messageNodes = extractMessageNodes(messages);
|
|
24
|
+
if (messageNodes.length === 0) {
|
|
39
25
|
return null;
|
|
40
26
|
}
|
|
41
|
-
if (
|
|
42
|
-
return /*#__PURE__*/_react.default.createElement("span", null,
|
|
27
|
+
if (messageNodes.length === 1) {
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement("span", null, messageNodes[0]);
|
|
43
29
|
}
|
|
44
|
-
return /*#__PURE__*/_react.default.createElement(_styled.MessageList, null,
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_styled.MessageList, null, messageNodes.map(function (m, i) {
|
|
45
31
|
return /*#__PURE__*/_react.default.createElement("li", {
|
|
46
32
|
key: i
|
|
47
|
-
}, m
|
|
33
|
+
}, m);
|
|
48
34
|
}));
|
|
49
35
|
};
|
|
50
36
|
|
|
@@ -12,7 +12,7 @@ var _reactMagneticDi = require("react-magnetic-di");
|
|
|
12
12
|
var _form = require("@atlaskit/form");
|
|
13
13
|
var _info = _interopRequireDefault(require("@atlaskit/icon/glyph/info"));
|
|
14
14
|
var _information = _interopRequireDefault(require("@atlaskit/icon/utility/information"));
|
|
15
|
-
var
|
|
15
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
16
16
|
var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
|
|
17
17
|
var _useEditorViewHasInfos = require("../../../../hooks/use-editor-view-has-infos");
|
|
18
18
|
var _state = require("../../../../state");
|
|
@@ -35,7 +35,7 @@ var InfoMessages = exports.InfoMessages = function InfoMessages() {
|
|
|
35
35
|
var infoMessage = useFormattedInfoMessage();
|
|
36
36
|
return infoMessage != null ? /*#__PURE__*/_react.default.createElement(_format.MessageContainer, null, /*#__PURE__*/_react.default.createElement(_form.HelperMessage, {
|
|
37
37
|
testId: "jql-editor-info-message"
|
|
38
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
38
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
39
39
|
as: "span",
|
|
40
40
|
paddingInlineEnd: "space.050"
|
|
41
41
|
}, /*#__PURE__*/_react.default.createElement(_information.default, {
|
|
@@ -13,7 +13,7 @@ var _reactMagneticDi = require("react-magnetic-di");
|
|
|
13
13
|
var _form = require("@atlaskit/form");
|
|
14
14
|
var _warning = _interopRequireDefault(require("@atlaskit/icon/glyph/warning"));
|
|
15
15
|
var _warning2 = _interopRequireDefault(require("@atlaskit/icon/utility/warning"));
|
|
16
|
-
var
|
|
16
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
17
17
|
var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
|
|
18
18
|
var _useEditorViewHasWarnings = require("../../../../hooks/use-editor-view-has-warnings");
|
|
19
19
|
var _state = require("../../../../state");
|
|
@@ -104,7 +104,7 @@ var WarningMessages = exports.WarningMessages = function WarningMessages() {
|
|
|
104
104
|
var warningMessage = useFormattedWarningMessage();
|
|
105
105
|
return warningMessage != null ? /*#__PURE__*/_react.default.createElement(_format.MessageContainer, null, /*#__PURE__*/_react.default.createElement(_form.HelperMessage, {
|
|
106
106
|
testId: "jql-editor-warning-message"
|
|
107
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
107
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
108
108
|
as: "span",
|
|
109
109
|
paddingInlineEnd: "space.050"
|
|
110
110
|
}, /*#__PURE__*/_react.default.createElement(_warning2.default, {
|
|
@@ -8,7 +8,7 @@ exports.default = exports.JQLEditorReadOnly = void 0;
|
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
-
var
|
|
11
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
12
12
|
var _useEditorTheme = require("../../hooks/use-editor-theme");
|
|
13
13
|
var _splitTextByNewLine = require("../../utils/split-text-by-new-line");
|
|
14
14
|
var _readOnlyControlsContent = require("../jql-editor-controls-content/read-only-controls-content");
|
|
@@ -91,7 +91,7 @@ var JQLEditorReadOnlyWithoutTheme = function JQLEditorReadOnlyWithoutTheme(_ref)
|
|
|
91
91
|
"aria-controls": "dummy-jql-editor-auto-complete-id",
|
|
92
92
|
"aria-label": "JQL query"
|
|
93
93
|
}, blocks.map(function (block, index) {
|
|
94
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
95
95
|
as: "p",
|
|
96
96
|
key: index
|
|
97
97
|
}, block);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ANALYTICS_CHANNEL, useJqlPackageAnalytics } from '@atlaskit/jql-editor-common';
|
|
2
2
|
export const useJqlEditorAnalytics = analyticsSource => {
|
|
3
|
-
return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.1
|
|
3
|
+
return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.2.1", ANALYTICS_CHANNEL);
|
|
4
4
|
};
|
|
@@ -35,7 +35,8 @@ export const SyntaxHelp = () => {
|
|
|
35
35
|
content: /*#__PURE__*/React.createElement(TooltipContent, null, label)
|
|
36
36
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
37
37
|
,
|
|
38
|
-
tag: TooltipTag
|
|
38
|
+
tag: TooltipTag,
|
|
39
|
+
isScreenReaderAnnouncementDisabled: true
|
|
39
40
|
}, /*#__PURE__*/React.createElement(BaseSyntaxHelp, {
|
|
40
41
|
describedby: descriptionId,
|
|
41
42
|
label: label,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { HelperMessage } from '@atlaskit/form';
|
|
3
|
-
import { Text } from '@atlaskit/primitives';
|
|
3
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
4
4
|
import { JQL_EDITOR_HELP_CONTENT_ID } from '../../../common/constants';
|
|
5
5
|
import { useEditorThemeContext } from '../../../hooks/use-editor-theme';
|
|
6
6
|
import { useEditorViewHasFocus, useIntl, useScopedId } from '../../../state';
|
|
@@ -11,50 +11,10 @@ import { useEditorViewIsInvalid } from '../../../../hooks/use-editor-view-is-inv
|
|
|
11
11
|
import { useCustomErrorComponent, useExternalMessages, useIntl, useJqlError, useScopedId, useStoreActions } from '../../../../state';
|
|
12
12
|
import { extractMessageNodes, FormatMessages, MessageContainer } from '../format';
|
|
13
13
|
import { messages } from './messages';
|
|
14
|
-
const useFormattedErrorMessage = () => {
|
|
15
|
-
const [{
|
|
16
|
-
formatMessage
|
|
17
|
-
}] = useIntl();
|
|
18
|
-
const [jqlError] = useJqlError();
|
|
19
|
-
const [{
|
|
20
|
-
errors: externalErrors
|
|
21
|
-
}] = useExternalMessages();
|
|
22
|
-
const [, {
|
|
23
|
-
externalErrorMessageViewed
|
|
24
|
-
}] = useStoreActions();
|
|
25
|
-
const editorViewIsInvalid = useEditorViewIsInvalid();
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
// Emit a UI event whenever external errors has changed
|
|
28
|
-
externalErrorMessageViewed();
|
|
29
|
-
}, [externalErrorMessageViewed, externalErrors]);
|
|
30
|
-
if (!editorViewIsInvalid) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Prioritise client over external errors
|
|
35
|
-
if (jqlError instanceof JQLSyntaxError) {
|
|
36
|
-
return `${jqlError.message} ${formatMessage(messages.jqlErrorPosition, {
|
|
37
|
-
lineNumber: jqlError.line,
|
|
38
|
-
charPosition: jqlError.charPositionInLine + 1
|
|
39
|
-
})}`;
|
|
40
|
-
} else if (externalErrors.length > 0) {
|
|
41
|
-
return /*#__PURE__*/React.createElement(FormatMessages, {
|
|
42
|
-
messages: externalErrors
|
|
43
|
-
});
|
|
44
|
-
} else if (jqlError !== null) {
|
|
45
|
-
return formatMessage(commonMessages.unknownError);
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
};
|
|
49
14
|
|
|
50
15
|
/**
|
|
51
16
|
* This function maps client side validation errors and external messages into a unified format
|
|
52
17
|
* This is so that the output of this function can then be processed in a unified manner by different renderers
|
|
53
|
-
*
|
|
54
|
-
* ------ REMOVE THE FOLLOWING COMMENTS WITH THE FG CLEANUP OF gravityai-2553-fix-jql-debugger-flicker -----
|
|
55
|
-
* Cloned from useFormattedErrorMessage. Differences are:
|
|
56
|
-
* - return type is ExternalMessage[] instead of ReactNode
|
|
57
|
-
* - Stripped rendering logic away (i.e. FormatMessages) to make the implementation modular
|
|
58
18
|
*/
|
|
59
19
|
const useErrorMessages = () => {
|
|
60
20
|
const [{
|
|
@@ -124,55 +84,30 @@ const CustomComponentDecoratedWithEditorTheme = props => {
|
|
|
124
84
|
export const ErrorMessages = () => {
|
|
125
85
|
const [editorId] = useScopedId(JQL_EDITOR_INPUT_ID);
|
|
126
86
|
const [validationId] = useScopedId(JQL_EDITOR_VALIDATION_ID);
|
|
127
|
-
|
|
128
|
-
const errorMessages = fg('gravityai-2553-fix-jql-debugger-flicker') ? useErrorMessages() : null;
|
|
129
|
-
const errorMessage = !fg('gravityai-2553-fix-jql-debugger-flicker') ?
|
|
130
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
131
|
-
useFormattedErrorMessage() : null;
|
|
87
|
+
const errorMessages = useErrorMessages();
|
|
132
88
|
const [CustomErrorComponent] = useCustomErrorComponent();
|
|
133
|
-
|
|
134
|
-
const childrenToRender = errorMessages != null ? /*#__PURE__*/React.createElement(MessageContainer, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
135
|
-
testId: JQL_EDITOR_VALIDATION_ID
|
|
136
|
-
}, fg('jql_editor_a11y') ? /*#__PURE__*/React.createElement("span", {
|
|
137
|
-
role: "alert",
|
|
138
|
-
id: validationId
|
|
139
|
-
}, /*#__PURE__*/React.createElement(FormatMessages, {
|
|
140
|
-
messages: errorMessages
|
|
141
|
-
})) : /*#__PURE__*/React.createElement("span", {
|
|
142
|
-
role: "alert",
|
|
143
|
-
"aria-describedby": editorId
|
|
144
|
-
}, /*#__PURE__*/React.createElement(FormatMessages, {
|
|
145
|
-
messages: errorMessages
|
|
146
|
-
})))) : null;
|
|
147
|
-
|
|
148
|
-
// Only render CustomErrorComponent if there is an errorMessage
|
|
149
|
-
if (errorMessages != null && CustomErrorComponent) {
|
|
150
|
-
return /*#__PURE__*/React.createElement(CustomComponentDecoratedWithEditorTheme, {
|
|
151
|
-
testId: JQL_EDITOR_VALIDATION_ID,
|
|
152
|
-
editorId: editorId,
|
|
153
|
-
validationId: validationId,
|
|
154
|
-
Component: CustomErrorComponent,
|
|
155
|
-
errorMessages: extractMessageNodes(errorMessages)
|
|
156
|
-
}, childrenToRender);
|
|
157
|
-
}
|
|
158
|
-
return childrenToRender;
|
|
159
|
-
}
|
|
160
|
-
const childrenToRender = errorMessage != null ? /*#__PURE__*/React.createElement(MessageContainer, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
89
|
+
const childrenToRender = errorMessages != null ? /*#__PURE__*/React.createElement(MessageContainer, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
161
90
|
testId: JQL_EDITOR_VALIDATION_ID
|
|
162
91
|
}, fg('jql_editor_a11y') ? /*#__PURE__*/React.createElement("span", {
|
|
163
92
|
role: "alert",
|
|
164
93
|
id: validationId
|
|
165
|
-
},
|
|
94
|
+
}, /*#__PURE__*/React.createElement(FormatMessages, {
|
|
95
|
+
messages: errorMessages
|
|
96
|
+
})) : /*#__PURE__*/React.createElement("span", {
|
|
166
97
|
role: "alert",
|
|
167
98
|
"aria-describedby": editorId
|
|
168
|
-
},
|
|
99
|
+
}, /*#__PURE__*/React.createElement(FormatMessages, {
|
|
100
|
+
messages: errorMessages
|
|
101
|
+
})))) : null;
|
|
169
102
|
|
|
170
103
|
// Only render CustomErrorComponent if there is an errorMessage
|
|
171
|
-
if (
|
|
104
|
+
if (errorMessages != null && CustomErrorComponent) {
|
|
172
105
|
return /*#__PURE__*/React.createElement(CustomComponentDecoratedWithEditorTheme, {
|
|
173
106
|
testId: JQL_EDITOR_VALIDATION_ID,
|
|
174
107
|
editorId: editorId,
|
|
175
|
-
|
|
108
|
+
validationId: validationId,
|
|
109
|
+
Component: CustomErrorComponent,
|
|
110
|
+
errorMessages: extractMessageNodes(errorMessages)
|
|
176
111
|
}, childrenToRender);
|
|
177
112
|
}
|
|
178
113
|
return childrenToRender;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { useEditorThemeContext } from '../../../../hooks/use-editor-theme';
|
|
4
3
|
import { MessageContainer as MessageContainerStyled, MessageList } from './styled';
|
|
5
4
|
|
|
@@ -18,27 +17,16 @@ export const MessageContainer = ({
|
|
|
18
17
|
export const FormatMessages = ({
|
|
19
18
|
messages
|
|
20
19
|
}) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (messageNodes.length === 0) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
if (messageNodes.length === 1) {
|
|
27
|
-
return /*#__PURE__*/React.createElement("span", null, messageNodes[0]);
|
|
28
|
-
}
|
|
29
|
-
return /*#__PURE__*/React.createElement(MessageList, null, messageNodes.map((m, i) => /*#__PURE__*/React.createElement("li", {
|
|
30
|
-
key: i
|
|
31
|
-
}, m)));
|
|
32
|
-
}
|
|
33
|
-
if (messages.length === 0) {
|
|
20
|
+
const messageNodes = extractMessageNodes(messages);
|
|
21
|
+
if (messageNodes.length === 0) {
|
|
34
22
|
return null;
|
|
35
23
|
}
|
|
36
|
-
if (
|
|
37
|
-
return /*#__PURE__*/React.createElement("span", null,
|
|
24
|
+
if (messageNodes.length === 1) {
|
|
25
|
+
return /*#__PURE__*/React.createElement("span", null, messageNodes[0]);
|
|
38
26
|
}
|
|
39
|
-
return /*#__PURE__*/React.createElement(MessageList, null,
|
|
27
|
+
return /*#__PURE__*/React.createElement(MessageList, null, messageNodes.map((m, i) => /*#__PURE__*/React.createElement("li", {
|
|
40
28
|
key: i
|
|
41
|
-
}, m
|
|
29
|
+
}, m)));
|
|
42
30
|
};
|
|
43
31
|
|
|
44
32
|
/**
|
|
@@ -3,7 +3,7 @@ import { di } from 'react-magnetic-di';
|
|
|
3
3
|
import { HelperMessage } from '@atlaskit/form';
|
|
4
4
|
import LegacyInfoIcon from '@atlaskit/icon/glyph/info';
|
|
5
5
|
import InfoIcon from '@atlaskit/icon/utility/information';
|
|
6
|
-
import { Box } from '@atlaskit/primitives';
|
|
6
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
7
7
|
import * as colors from '@atlaskit/theme/colors';
|
|
8
8
|
import { useEditorViewHasInfos } from '../../../../hooks/use-editor-view-has-infos';
|
|
9
9
|
import { useExternalMessages } from '../../../../state';
|
|
@@ -3,7 +3,7 @@ import { di } from 'react-magnetic-di';
|
|
|
3
3
|
import { HelperMessage } from '@atlaskit/form';
|
|
4
4
|
import LegacyWarningIcon from '@atlaskit/icon/glyph/warning';
|
|
5
5
|
import WarningIcon from '@atlaskit/icon/utility/warning';
|
|
6
|
-
import { Box } from '@atlaskit/primitives';
|
|
6
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
7
7
|
import * as colors from '@atlaskit/theme/colors';
|
|
8
8
|
import { useEditorViewHasWarnings } from '../../../../hooks/use-editor-view-has-warnings';
|
|
9
9
|
import { useExternalMessages, useHydratedDeprecations, useIntl } from '../../../../state';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
-
import { Box } from '@atlaskit/primitives';
|
|
3
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
4
4
|
import { EditorThemeContext, useEditorTheme, useEditorThemeContext } from '../../hooks/use-editor-theme';
|
|
5
5
|
import { splitTextByNewLine } from '../../utils/split-text-by-new-line';
|
|
6
6
|
// eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ANALYTICS_CHANNEL, useJqlPackageAnalytics } from '@atlaskit/jql-editor-common';
|
|
2
2
|
export var useJqlEditorAnalytics = function useJqlEditorAnalytics(analyticsSource) {
|
|
3
|
-
return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.1
|
|
3
|
+
return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.2.1", ANALYTICS_CHANNEL);
|
|
4
4
|
};
|
|
@@ -41,7 +41,8 @@ export var SyntaxHelp = function SyntaxHelp() {
|
|
|
41
41
|
content: /*#__PURE__*/React.createElement(TooltipContent, null, label)
|
|
42
42
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
43
43
|
,
|
|
44
|
-
tag: TooltipTag
|
|
44
|
+
tag: TooltipTag,
|
|
45
|
+
isScreenReaderAnnouncementDisabled: true
|
|
45
46
|
}, /*#__PURE__*/React.createElement(BaseSyntaxHelp, {
|
|
46
47
|
describedby: descriptionId,
|
|
47
48
|
label: label,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { HelperMessage } from '@atlaskit/form';
|
|
4
|
-
import { Text } from '@atlaskit/primitives';
|
|
4
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
5
5
|
import { JQL_EDITOR_HELP_CONTENT_ID } from '../../../common/constants';
|
|
6
6
|
import { useEditorThemeContext } from '../../../hooks/use-editor-theme';
|
|
7
7
|
import { useEditorViewHasFocus, useIntl, useScopedId } from '../../../state';
|
|
@@ -14,7 +14,12 @@ import { useEditorViewIsInvalid } from '../../../../hooks/use-editor-view-is-inv
|
|
|
14
14
|
import { useCustomErrorComponent, useExternalMessages, useIntl, useJqlError, useScopedId, useStoreActions } from '../../../../state';
|
|
15
15
|
import { extractMessageNodes, FormatMessages, MessageContainer } from '../format';
|
|
16
16
|
import { messages } from './messages';
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* This function maps client side validation errors and external messages into a unified format
|
|
20
|
+
* This is so that the output of this function can then be processed in a unified manner by different renderers
|
|
21
|
+
*/
|
|
22
|
+
var useErrorMessages = function useErrorMessages() {
|
|
18
23
|
var _useIntl = useIntl(),
|
|
19
24
|
_useIntl2 = _slicedToArray(_useIntl, 1),
|
|
20
25
|
formatMessage = _useIntl2[0].formatMessage;
|
|
@@ -36,53 +41,6 @@ var useFormattedErrorMessage = function useFormattedErrorMessage() {
|
|
|
36
41
|
return null;
|
|
37
42
|
}
|
|
38
43
|
|
|
39
|
-
// Prioritise client over external errors
|
|
40
|
-
if (jqlError instanceof JQLSyntaxError) {
|
|
41
|
-
return "".concat(jqlError.message, " ").concat(formatMessage(messages.jqlErrorPosition, {
|
|
42
|
-
lineNumber: jqlError.line,
|
|
43
|
-
charPosition: jqlError.charPositionInLine + 1
|
|
44
|
-
}));
|
|
45
|
-
} else if (externalErrors.length > 0) {
|
|
46
|
-
return /*#__PURE__*/React.createElement(FormatMessages, {
|
|
47
|
-
messages: externalErrors
|
|
48
|
-
});
|
|
49
|
-
} else if (jqlError !== null) {
|
|
50
|
-
return formatMessage(commonMessages.unknownError);
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* This function maps client side validation errors and external messages into a unified format
|
|
57
|
-
* This is so that the output of this function can then be processed in a unified manner by different renderers
|
|
58
|
-
*
|
|
59
|
-
* ------ REMOVE THE FOLLOWING COMMENTS WITH THE FG CLEANUP OF gravityai-2553-fix-jql-debugger-flicker -----
|
|
60
|
-
* Cloned from useFormattedErrorMessage. Differences are:
|
|
61
|
-
* - return type is ExternalMessage[] instead of ReactNode
|
|
62
|
-
* - Stripped rendering logic away (i.e. FormatMessages) to make the implementation modular
|
|
63
|
-
*/
|
|
64
|
-
var useErrorMessages = function useErrorMessages() {
|
|
65
|
-
var _useIntl3 = useIntl(),
|
|
66
|
-
_useIntl4 = _slicedToArray(_useIntl3, 1),
|
|
67
|
-
formatMessage = _useIntl4[0].formatMessage;
|
|
68
|
-
var _useJqlError3 = useJqlError(),
|
|
69
|
-
_useJqlError4 = _slicedToArray(_useJqlError3, 1),
|
|
70
|
-
jqlError = _useJqlError4[0];
|
|
71
|
-
var _useExternalMessages3 = useExternalMessages(),
|
|
72
|
-
_useExternalMessages4 = _slicedToArray(_useExternalMessages3, 1),
|
|
73
|
-
externalErrors = _useExternalMessages4[0].errors;
|
|
74
|
-
var _useStoreActions3 = useStoreActions(),
|
|
75
|
-
_useStoreActions4 = _slicedToArray(_useStoreActions3, 2),
|
|
76
|
-
externalErrorMessageViewed = _useStoreActions4[1].externalErrorMessageViewed;
|
|
77
|
-
var editorViewIsInvalid = useEditorViewIsInvalid();
|
|
78
|
-
useEffect(function () {
|
|
79
|
-
// Emit a UI event whenever external errors has changed
|
|
80
|
-
externalErrorMessageViewed();
|
|
81
|
-
}, [externalErrorMessageViewed, externalErrors]);
|
|
82
|
-
if (!editorViewIsInvalid) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
44
|
/**
|
|
87
45
|
* Transform a string message to take the form of an ExternalMessage,
|
|
88
46
|
* so that we can reduce a bunch of conditionals when processing the output of useErrorMessages
|
|
@@ -135,57 +93,32 @@ export var ErrorMessages = function ErrorMessages() {
|
|
|
135
93
|
var _useScopedId3 = useScopedId(JQL_EDITOR_VALIDATION_ID),
|
|
136
94
|
_useScopedId4 = _slicedToArray(_useScopedId3, 1),
|
|
137
95
|
validationId = _useScopedId4[0];
|
|
138
|
-
|
|
139
|
-
var errorMessages = fg('gravityai-2553-fix-jql-debugger-flicker') ? useErrorMessages() : null;
|
|
140
|
-
var errorMessage = !fg('gravityai-2553-fix-jql-debugger-flicker') ?
|
|
141
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
142
|
-
useFormattedErrorMessage() : null;
|
|
96
|
+
var errorMessages = useErrorMessages();
|
|
143
97
|
var _useCustomErrorCompon = useCustomErrorComponent(),
|
|
144
98
|
_useCustomErrorCompon2 = _slicedToArray(_useCustomErrorCompon, 1),
|
|
145
99
|
CustomErrorComponent = _useCustomErrorCompon2[0];
|
|
146
|
-
|
|
147
|
-
var _childrenToRender = errorMessages != null ? /*#__PURE__*/React.createElement(MessageContainer, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
148
|
-
testId: JQL_EDITOR_VALIDATION_ID
|
|
149
|
-
}, fg('jql_editor_a11y') ? /*#__PURE__*/React.createElement("span", {
|
|
150
|
-
role: "alert",
|
|
151
|
-
id: validationId
|
|
152
|
-
}, /*#__PURE__*/React.createElement(FormatMessages, {
|
|
153
|
-
messages: errorMessages
|
|
154
|
-
})) : /*#__PURE__*/React.createElement("span", {
|
|
155
|
-
role: "alert",
|
|
156
|
-
"aria-describedby": editorId
|
|
157
|
-
}, /*#__PURE__*/React.createElement(FormatMessages, {
|
|
158
|
-
messages: errorMessages
|
|
159
|
-
})))) : null;
|
|
160
|
-
|
|
161
|
-
// Only render CustomErrorComponent if there is an errorMessage
|
|
162
|
-
if (errorMessages != null && CustomErrorComponent) {
|
|
163
|
-
return /*#__PURE__*/React.createElement(CustomComponentDecoratedWithEditorTheme, {
|
|
164
|
-
testId: JQL_EDITOR_VALIDATION_ID,
|
|
165
|
-
editorId: editorId,
|
|
166
|
-
validationId: validationId,
|
|
167
|
-
Component: CustomErrorComponent,
|
|
168
|
-
errorMessages: extractMessageNodes(errorMessages)
|
|
169
|
-
}, _childrenToRender);
|
|
170
|
-
}
|
|
171
|
-
return _childrenToRender;
|
|
172
|
-
}
|
|
173
|
-
var childrenToRender = errorMessage != null ? /*#__PURE__*/React.createElement(MessageContainer, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
100
|
+
var childrenToRender = errorMessages != null ? /*#__PURE__*/React.createElement(MessageContainer, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
174
101
|
testId: JQL_EDITOR_VALIDATION_ID
|
|
175
102
|
}, fg('jql_editor_a11y') ? /*#__PURE__*/React.createElement("span", {
|
|
176
103
|
role: "alert",
|
|
177
104
|
id: validationId
|
|
178
|
-
},
|
|
105
|
+
}, /*#__PURE__*/React.createElement(FormatMessages, {
|
|
106
|
+
messages: errorMessages
|
|
107
|
+
})) : /*#__PURE__*/React.createElement("span", {
|
|
179
108
|
role: "alert",
|
|
180
109
|
"aria-describedby": editorId
|
|
181
|
-
},
|
|
110
|
+
}, /*#__PURE__*/React.createElement(FormatMessages, {
|
|
111
|
+
messages: errorMessages
|
|
112
|
+
})))) : null;
|
|
182
113
|
|
|
183
114
|
// Only render CustomErrorComponent if there is an errorMessage
|
|
184
|
-
if (
|
|
115
|
+
if (errorMessages != null && CustomErrorComponent) {
|
|
185
116
|
return /*#__PURE__*/React.createElement(CustomComponentDecoratedWithEditorTheme, {
|
|
186
117
|
testId: JQL_EDITOR_VALIDATION_ID,
|
|
187
118
|
editorId: editorId,
|
|
188
|
-
|
|
119
|
+
validationId: validationId,
|
|
120
|
+
Component: CustomErrorComponent,
|
|
121
|
+
errorMessages: extractMessageNodes(errorMessages)
|
|
189
122
|
}, childrenToRender);
|
|
190
123
|
}
|
|
191
124
|
return childrenToRender;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { useEditorThemeContext } from '../../../../hooks/use-editor-theme';
|
|
4
3
|
import { MessageContainer as MessageContainerStyled, MessageList } from './styled';
|
|
5
4
|
|
|
@@ -15,30 +14,17 @@ export var MessageContainer = function MessageContainer(_ref) {
|
|
|
15
14
|
};
|
|
16
15
|
export var FormatMessages = function FormatMessages(_ref2) {
|
|
17
16
|
var messages = _ref2.messages;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (messageNodes.length === 0) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
if (messageNodes.length === 1) {
|
|
24
|
-
return /*#__PURE__*/React.createElement("span", null, messageNodes[0]);
|
|
25
|
-
}
|
|
26
|
-
return /*#__PURE__*/React.createElement(MessageList, null, messageNodes.map(function (m, i) {
|
|
27
|
-
return /*#__PURE__*/React.createElement("li", {
|
|
28
|
-
key: i
|
|
29
|
-
}, m);
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
if (messages.length === 0) {
|
|
17
|
+
var messageNodes = extractMessageNodes(messages);
|
|
18
|
+
if (messageNodes.length === 0) {
|
|
33
19
|
return null;
|
|
34
20
|
}
|
|
35
|
-
if (
|
|
36
|
-
return /*#__PURE__*/React.createElement("span", null,
|
|
21
|
+
if (messageNodes.length === 1) {
|
|
22
|
+
return /*#__PURE__*/React.createElement("span", null, messageNodes[0]);
|
|
37
23
|
}
|
|
38
|
-
return /*#__PURE__*/React.createElement(MessageList, null,
|
|
24
|
+
return /*#__PURE__*/React.createElement(MessageList, null, messageNodes.map(function (m, i) {
|
|
39
25
|
return /*#__PURE__*/React.createElement("li", {
|
|
40
26
|
key: i
|
|
41
|
-
}, m
|
|
27
|
+
}, m);
|
|
42
28
|
}));
|
|
43
29
|
};
|
|
44
30
|
|
|
@@ -4,7 +4,7 @@ import { di } from 'react-magnetic-di';
|
|
|
4
4
|
import { HelperMessage } from '@atlaskit/form';
|
|
5
5
|
import LegacyInfoIcon from '@atlaskit/icon/glyph/info';
|
|
6
6
|
import InfoIcon from '@atlaskit/icon/utility/information';
|
|
7
|
-
import { Box } from '@atlaskit/primitives';
|
|
7
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
8
8
|
import * as colors from '@atlaskit/theme/colors';
|
|
9
9
|
import { useEditorViewHasInfos } from '../../../../hooks/use-editor-view-has-infos';
|
|
10
10
|
import { useExternalMessages } from '../../../../state';
|
|
@@ -5,7 +5,7 @@ import { di } from 'react-magnetic-di';
|
|
|
5
5
|
import { HelperMessage } from '@atlaskit/form';
|
|
6
6
|
import LegacyWarningIcon from '@atlaskit/icon/glyph/warning';
|
|
7
7
|
import WarningIcon from '@atlaskit/icon/utility/warning';
|
|
8
|
-
import { Box } from '@atlaskit/primitives';
|
|
8
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
9
9
|
import * as colors from '@atlaskit/theme/colors';
|
|
10
10
|
import { useEditorViewHasWarnings } from '../../../../hooks/use-editor-view-has-warnings';
|
|
11
11
|
import { useExternalMessages, useHydratedDeprecations, useIntl } from '../../../../state';
|
|
@@ -2,7 +2,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
2
2
|
var _excluded = ["isSearch", "isCompact"];
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
-
import { Box } from '@atlaskit/primitives';
|
|
5
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
6
|
import { EditorThemeContext, useEditorTheme, useEditorThemeContext } from '../../hooks/use-editor-theme';
|
|
7
7
|
import { splitTextByNewLine } from '../../utils/split-text-by-new-line';
|
|
8
8
|
// eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
|
|
@@ -69,8 +69,8 @@ export type CustomErrorComponent = React.ComponentType<PropsWithChildren<{
|
|
|
69
69
|
testId: string;
|
|
70
70
|
editorTheme: EditorTheme;
|
|
71
71
|
editorId: string;
|
|
72
|
-
errorMessages
|
|
73
|
-
validationId
|
|
72
|
+
errorMessages: React.ReactElement[];
|
|
73
|
+
validationId: string;
|
|
74
74
|
}>>;
|
|
75
75
|
export type CustomErrorMessageProps = Omit<React.ComponentProps<CustomErrorComponent>, 'editorTheme'> & {
|
|
76
76
|
Component: CustomErrorComponent;
|
|
@@ -69,8 +69,8 @@ export type CustomErrorComponent = React.ComponentType<PropsWithChildren<{
|
|
|
69
69
|
testId: string;
|
|
70
70
|
editorTheme: EditorTheme;
|
|
71
71
|
editorId: string;
|
|
72
|
-
errorMessages
|
|
73
|
-
validationId
|
|
72
|
+
errorMessages: React.ReactElement[];
|
|
73
|
+
validationId: string;
|
|
74
74
|
}>>;
|
|
75
75
|
export type CustomErrorMessageProps = Omit<React.ComponentProps<CustomErrorComponent>, 'editorTheme'> & {
|
|
76
76
|
Component: CustomErrorComponent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/jql-editor",
|
|
3
|
-
"version": "5.1
|
|
3
|
+
"version": "5.2.1",
|
|
4
4
|
"description": "This package allows consumers to render an advanced JQL editor component to enable autocomplete-assisted authoring and validation of JQL queries.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"@atlaskit/button": "^23.0.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
45
45
|
"@atlaskit/form": "^12.0.0",
|
|
46
|
-
"@atlaskit/icon": "^25.
|
|
46
|
+
"@atlaskit/icon": "^25.6.0",
|
|
47
47
|
"@atlaskit/jql-ast": "^3.3.0",
|
|
48
48
|
"@atlaskit/jql-autocomplete": "^2.0.0",
|
|
49
49
|
"@atlaskit/jql-editor-common": "^3.0.0",
|
|
50
50
|
"@atlaskit/jql-parser": "^2.0.0",
|
|
51
51
|
"@atlaskit/legacy-custom-icons": "^0.22.0",
|
|
52
52
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
53
|
-
"@atlaskit/primitives": "^14.
|
|
53
|
+
"@atlaskit/primitives": "^14.4.0",
|
|
54
54
|
"@atlaskit/spinner": "^18.0.0",
|
|
55
55
|
"@atlaskit/theme": "^18.0.0",
|
|
56
|
-
"@atlaskit/tokens": "^4.
|
|
56
|
+
"@atlaskit/tokens": "^4.8.0",
|
|
57
57
|
"@atlaskit/tooltip": "^20.0.0",
|
|
58
58
|
"@babel/runtime": "^7.0.0",
|
|
59
59
|
"@emotion/react": "^11.7.1",
|
|
@@ -136,9 +136,6 @@
|
|
|
136
136
|
},
|
|
137
137
|
"jql_editor_a11y": {
|
|
138
138
|
"type": "boolean"
|
|
139
|
-
},
|
|
140
|
-
"gravityai-2553-fix-jql-debugger-flicker": {
|
|
141
|
-
"type": "boolean"
|
|
142
139
|
}
|
|
143
140
|
}
|
|
144
141
|
}
|