@atlaskit/jql-editor 5.0.3 → 5.0.5
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/analytics/util.js +1 -1
- package/dist/cjs/common/constants.js +2 -1
- package/dist/cjs/common/styled.js +1 -1
- package/dist/cjs/plugins/autocomplete/components/autocomplete-option/styled.js +1 -1
- package/dist/cjs/ui/jql-editor-footer-content/jql-messages/errors/index.js +10 -4
- package/dist/cjs/ui/jql-editor-layout/styled.js +1 -1
- package/dist/cjs/ui/jql-editor-view/index.js +6 -2
- package/dist/es2019/analytics/util.js +1 -1
- package/dist/es2019/common/constants.js +1 -0
- package/dist/es2019/common/styled.js +1 -1
- package/dist/es2019/plugins/autocomplete/components/autocomplete-option/styled.js +1 -1
- package/dist/es2019/ui/jql-editor-footer-content/jql-messages/errors/index.js +9 -5
- package/dist/es2019/ui/jql-editor-layout/styled.js +2 -2
- package/dist/es2019/ui/jql-editor-view/index.js +5 -3
- package/dist/esm/analytics/util.js +1 -1
- package/dist/esm/common/constants.js +1 -0
- package/dist/esm/common/styled.js +1 -1
- package/dist/esm/plugins/autocomplete/components/autocomplete-option/styled.js +1 -1
- package/dist/esm/ui/jql-editor-footer-content/jql-messages/errors/index.js +11 -5
- package/dist/esm/ui/jql-editor-layout/styled.js +1 -1
- package/dist/esm/ui/jql-editor-view/index.js +7 -3
- package/dist/types/common/constants.d.ts +1 -0
- package/dist/types-ts4.5/common/constants.d.ts +1 -0
- package/package.json +10 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/jql-editor
|
|
2
2
|
|
|
3
|
+
## 5.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#124108](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/124108)
|
|
8
|
+
[`33144b1ee7e12`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/33144b1ee7e12) -
|
|
9
|
+
Fix accessibility issue in error messages section
|
|
10
|
+
|
|
11
|
+
## 5.0.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 5.0.3
|
|
4
18
|
|
|
5
19
|
### 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.0.
|
|
9
|
+
return (0, _jqlEditorCommon.useJqlPackageAnalytics)(analyticsSource, "@atlaskit/jql-editor", "5.0.5", _jqlEditorCommon.ANALYTICS_CHANNEL);
|
|
10
10
|
};
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SYNTAX_HELP_DESCRIPTION_ID = exports.JQL_EDITOR_MAIN_ID = exports.JQL_EDITOR_INPUT_ID = exports.JQL_EDITOR_HELP_CONTENT_ID = exports.JQL_EDITOR_AUTOCOMPLETE_ID = void 0;
|
|
6
|
+
exports.SYNTAX_HELP_DESCRIPTION_ID = exports.JQL_EDITOR_VALIDATION_ID = exports.JQL_EDITOR_MAIN_ID = exports.JQL_EDITOR_INPUT_ID = exports.JQL_EDITOR_HELP_CONTENT_ID = exports.JQL_EDITOR_AUTOCOMPLETE_ID = void 0;
|
|
7
7
|
var JQL_EDITOR_MAIN_ID = exports.JQL_EDITOR_MAIN_ID = 'jql-editor-main';
|
|
8
8
|
var JQL_EDITOR_AUTOCOMPLETE_ID = exports.JQL_EDITOR_AUTOCOMPLETE_ID = 'jql-editor-autocomplete';
|
|
9
9
|
var JQL_EDITOR_INPUT_ID = exports.JQL_EDITOR_INPUT_ID = 'jql-editor-input';
|
|
10
10
|
var JQL_EDITOR_HELP_CONTENT_ID = exports.JQL_EDITOR_HELP_CONTENT_ID = 'jql-editor-help-content';
|
|
11
|
+
var JQL_EDITOR_VALIDATION_ID = exports.JQL_EDITOR_VALIDATION_ID = 'jql-editor-validation';
|
|
11
12
|
var SYNTAX_HELP_DESCRIPTION_ID = exports.SYNTAX_HELP_DESCRIPTION_ID = 'syntax-help-description';
|
|
@@ -26,5 +26,5 @@ var hiddenMixin = exports.hiddenMixin = (0, _react.css)({
|
|
|
26
26
|
|
|
27
27
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
28
28
|
var TooltipContent = exports.TooltipContent = _styled.default.div({
|
|
29
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu,
|
|
29
|
+
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)"
|
|
30
30
|
});
|
|
@@ -11,7 +11,7 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
11
11
|
|
|
12
12
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
13
13
|
var TooltipContent = exports.TooltipContent = _styled.default.div({
|
|
14
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu,
|
|
14
|
+
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)"
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
@@ -13,6 +13,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _reactMagneticDi = require("react-magnetic-di");
|
|
14
14
|
var _form = require("@atlaskit/form");
|
|
15
15
|
var _jqlAst = require("@atlaskit/jql-ast");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _constants = require("../../../../common/constants");
|
|
17
18
|
var _messages = require("../../../../common/messages");
|
|
18
19
|
var _useEditorTheme = require("../../../../hooks/use-editor-theme");
|
|
@@ -82,14 +83,19 @@ var ErrorMessages = exports.ErrorMessages = function ErrorMessages() {
|
|
|
82
83
|
var _useScopedId = (0, _state.useScopedId)(_constants.JQL_EDITOR_INPUT_ID),
|
|
83
84
|
_useScopedId2 = (0, _slicedToArray2.default)(_useScopedId, 1),
|
|
84
85
|
editorId = _useScopedId2[0];
|
|
86
|
+
var _useScopedId3 = (0, _state.useScopedId)(_constants.JQL_EDITOR_VALIDATION_ID),
|
|
87
|
+
_useScopedId4 = (0, _slicedToArray2.default)(_useScopedId3, 1),
|
|
88
|
+
validationId = _useScopedId4[0];
|
|
85
89
|
var errorMessage = useFormattedErrorMessage();
|
|
86
|
-
var testId = 'jql-editor-validation';
|
|
87
90
|
var _useCustomErrorCompon = (0, _state.useCustomErrorComponent)(),
|
|
88
91
|
_useCustomErrorCompon2 = (0, _slicedToArray2.default)(_useCustomErrorCompon, 1),
|
|
89
92
|
CustomErrorComponent = _useCustomErrorCompon2[0];
|
|
90
93
|
var childrenToRender = errorMessage != null ? /*#__PURE__*/_react.default.createElement(_format.MessageContainer, null, /*#__PURE__*/_react.default.createElement(_form.ErrorMessage, {
|
|
91
|
-
testId:
|
|
92
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
94
|
+
testId: _constants.JQL_EDITOR_VALIDATION_ID
|
|
95
|
+
}, (0, _platformFeatureFlags.fg)('jql_editor_a11y') ? /*#__PURE__*/_react.default.createElement("span", {
|
|
96
|
+
role: "alert",
|
|
97
|
+
id: validationId
|
|
98
|
+
}, errorMessage) : /*#__PURE__*/_react.default.createElement("span", {
|
|
93
99
|
role: "alert",
|
|
94
100
|
"aria-describedby": editorId
|
|
95
101
|
}, errorMessage))) : null;
|
|
@@ -97,7 +103,7 @@ var ErrorMessages = exports.ErrorMessages = function ErrorMessages() {
|
|
|
97
103
|
// Only render CustomErrorComponent if there is an errorMessage
|
|
98
104
|
if (errorMessage != null && CustomErrorComponent) {
|
|
99
105
|
return /*#__PURE__*/_react.default.createElement(CustomComponentDecoratedWithEditorTheme, {
|
|
100
|
-
testId:
|
|
106
|
+
testId: _constants.JQL_EDITOR_VALIDATION_ID,
|
|
101
107
|
editorId: editorId,
|
|
102
108
|
Component: CustomErrorComponent
|
|
103
109
|
}, childrenToRender);
|
|
@@ -32,7 +32,7 @@ var fadeOut = (0, _react.keyframes)({
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
// eslint-disable-next-line @atlaskit/design-system/no-styled-tagged-template-expression, @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
35
|
-
var EditorMain = exports.EditorMain = _styled.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t/* CSS reset */\n\tfont-family: ", ";\n\tfont-size: 14px;\n\tflex-grow: 1;\n\n\t/* These styles and animations are derived from @atlaskit/tooltip */\n\n\t.", " {\n\t\tbackground-color: ", ";\n\t\tcolor: ", ";\n\t\tborder-radius: ", ";\n\t\tbox-sizing: border-box;\n\t\tfont: ", ";\n\t\tline-height: 1.3;\n\t\tmax-width: 240px;\n\t\tpadding: ", " ", ";\n\t\tword-wrap: break-word;\n\t\toverflow-wrap: break-word;\n\t\tz-index: ", ";\n\t\tpointer-events: none;\n\t\tposition: absolute;\n\t\tvisibility: hidden;\n\n\t\t/* Horizontally center and vertically position above the target element */\n\t\ttransform: translate(-50%, calc(-100% - ", "));\n\n\t\t&.", " {\n\t\t\tanimation: ", " 350ms cubic-bezier(0.15, 1, 0.3, 1);\n\t\t\tvisibility: visible;\n\t\t}\n\n\t\t&.", " {\n\t\t\tanimation: ", " 350ms cubic-bezier(0.15, 1, 0.3, 1);\n\t\t}\n\t}\n"])), "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu,
|
|
35
|
+
var EditorMain = exports.EditorMain = _styled.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t/* CSS reset */\n\tfont-family: ", ";\n\tfont-size: 14px;\n\tflex-grow: 1;\n\n\t/* These styles and animations are derived from @atlaskit/tooltip */\n\n\t.", " {\n\t\tbackground-color: ", ";\n\t\tcolor: ", ";\n\t\tborder-radius: ", ";\n\t\tbox-sizing: border-box;\n\t\tfont: ", ";\n\t\tline-height: 1.3;\n\t\tmax-width: 240px;\n\t\tpadding: ", " ", ";\n\t\tword-wrap: break-word;\n\t\toverflow-wrap: break-word;\n\t\tz-index: ", ";\n\t\tpointer-events: none;\n\t\tposition: absolute;\n\t\tvisibility: hidden;\n\n\t\t/* Horizontally center and vertically position above the target element */\n\t\ttransform: translate(-50%, calc(-100% - ", "));\n\n\t\t&.", " {\n\t\t\tanimation: ", " 350ms cubic-bezier(0.15, 1, 0.3, 1);\n\t\t\tvisibility: visible;\n\t\t}\n\n\t\t&.", " {\n\t\t\tanimation: ", " 350ms cubic-bezier(0.15, 1, 0.3, 1);\n\t\t}\n\t}\n"])), "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)", _constants2.TOOLTIP_CLASSNAME, "var(--ds-background-neutral-bold, ".concat(_colors.N800, ")"), "var(--ds-text-inverse, ".concat(_colors.N0, ")"), "var(--ds-border-radius-100, 3px)", "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)", "var(--ds-space-025, 2px)", "var(--ds-space-075, 6px)", _constants.layers.tooltip(), "var(--ds-space-200, 16px)", _constants2.TOOLTIP_ENTER_CLASSNAME, fadeIn, _constants2.TOOLTIP_EXIT_CLASSNAME, fadeOut);
|
|
36
36
|
|
|
37
37
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
38
38
|
var EditorFooter = exports.EditorFooter = _styled.default.div({
|
|
@@ -10,6 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _constants = require("../../common/constants");
|
|
14
15
|
var _useEditorTheme = require("../../hooks/use-editor-theme");
|
|
15
16
|
var _useEditorViewIsInvalid = require("../../hooks/use-editor-view-is-invalid");
|
|
@@ -51,6 +52,9 @@ var JQLEditorView = function JQLEditorView(_ref) {
|
|
|
51
52
|
var _useScopedId7 = (0, _state.useScopedId)(_constants.JQL_EDITOR_HELP_CONTENT_ID),
|
|
52
53
|
_useScopedId8 = (0, _slicedToArray2.default)(_useScopedId7, 1),
|
|
53
54
|
helpContentId = _useScopedId8[0];
|
|
55
|
+
var _useScopedId9 = (0, _state.useScopedId)(_constants.JQL_EDITOR_VALIDATION_ID),
|
|
56
|
+
_useScopedId10 = (0, _slicedToArray2.default)(_useScopedId9, 1),
|
|
57
|
+
validationId = _useScopedId10[0];
|
|
54
58
|
var _useIntl = (0, _state.useIntl)(),
|
|
55
59
|
_useIntl2 = (0, _slicedToArray2.default)(_useIntl, 1),
|
|
56
60
|
intl = _useIntl2[0];
|
|
@@ -120,13 +124,13 @@ var JQLEditorView = function JQLEditorView(_ref) {
|
|
|
120
124
|
'aria-label': intl.formatMessage(_messages.messages.inputLabel),
|
|
121
125
|
'aria-controls': autocompleteId,
|
|
122
126
|
'aria-owns': autocompleteId,
|
|
123
|
-
'aria-describedby': helpContentId
|
|
127
|
+
'aria-describedby': (0, _platformFeatureFlags.fg)('jql_editor_a11y') ? editorViewIsInvalid ? validationId : helpContentId : helpContentId
|
|
124
128
|
}, selectedOptionId && {
|
|
125
129
|
'aria-activedescendant': selectedOptionId
|
|
126
130
|
}), editorViewIsInvalid && {
|
|
127
131
|
'aria-invalid': 'true'
|
|
128
132
|
});
|
|
129
|
-
}, [editorId, isAutocompleteOpen, intl, autocompleteId, helpContentId, selectedOptionId
|
|
133
|
+
}, [editorId, isAutocompleteOpen, intl, autocompleteId, editorViewIsInvalid, validationId, helpContentId, selectedOptionId]);
|
|
130
134
|
|
|
131
135
|
// Update attributes on our editor view whenever they have changed
|
|
132
136
|
(0, _react.useEffect)(function () {
|
|
@@ -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.0.
|
|
3
|
+
return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.0.5", ANALYTICS_CHANNEL);
|
|
4
4
|
};
|
|
@@ -2,4 +2,5 @@ export const JQL_EDITOR_MAIN_ID = 'jql-editor-main';
|
|
|
2
2
|
export const JQL_EDITOR_AUTOCOMPLETE_ID = 'jql-editor-autocomplete';
|
|
3
3
|
export const JQL_EDITOR_INPUT_ID = 'jql-editor-input';
|
|
4
4
|
export const JQL_EDITOR_HELP_CONTENT_ID = 'jql-editor-help-content';
|
|
5
|
+
export const JQL_EDITOR_VALIDATION_ID = 'jql-editor-validation';
|
|
5
6
|
export const SYNTAX_HELP_DESCRIPTION_ID = 'syntax-help-description';
|
|
@@ -17,5 +17,5 @@ export const hiddenMixin = css({
|
|
|
17
17
|
|
|
18
18
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
19
19
|
export const TooltipContent = styled.div({
|
|
20
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu,
|
|
20
|
+
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)"
|
|
21
21
|
});
|
|
@@ -3,7 +3,7 @@ import styled from '@emotion/styled';
|
|
|
3
3
|
import { N100, N20, N50, N800 } from '@atlaskit/theme/colors';
|
|
4
4
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
5
5
|
export const TooltipContent = styled.div({
|
|
6
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu,
|
|
6
|
+
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)"
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
@@ -3,7 +3,8 @@ import React, { useEffect } from 'react';
|
|
|
3
3
|
import { di } from 'react-magnetic-di';
|
|
4
4
|
import { ErrorMessage } from '@atlaskit/form';
|
|
5
5
|
import { JQLSyntaxError } from '@atlaskit/jql-ast';
|
|
6
|
-
import {
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { JQL_EDITOR_INPUT_ID, JQL_EDITOR_VALIDATION_ID } from '../../../../common/constants';
|
|
7
8
|
import { commonMessages } from '../../../../common/messages';
|
|
8
9
|
import { useEditorThemeContext } from '../../../../hooks/use-editor-theme';
|
|
9
10
|
import { useEditorViewIsInvalid } from '../../../../hooks/use-editor-view-is-invalid';
|
|
@@ -67,12 +68,15 @@ const CustomComponentDecoratedWithEditorTheme = props => {
|
|
|
67
68
|
};
|
|
68
69
|
export const ErrorMessages = () => {
|
|
69
70
|
const [editorId] = useScopedId(JQL_EDITOR_INPUT_ID);
|
|
71
|
+
const [validationId] = useScopedId(JQL_EDITOR_VALIDATION_ID);
|
|
70
72
|
const errorMessage = useFormattedErrorMessage();
|
|
71
|
-
const testId = 'jql-editor-validation';
|
|
72
73
|
const [CustomErrorComponent] = useCustomErrorComponent();
|
|
73
74
|
const childrenToRender = errorMessage != null ? /*#__PURE__*/React.createElement(MessageContainer, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
74
|
-
testId:
|
|
75
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
75
|
+
testId: JQL_EDITOR_VALIDATION_ID
|
|
76
|
+
}, fg('jql_editor_a11y') ? /*#__PURE__*/React.createElement("span", {
|
|
77
|
+
role: "alert",
|
|
78
|
+
id: validationId
|
|
79
|
+
}, errorMessage) : /*#__PURE__*/React.createElement("span", {
|
|
76
80
|
role: "alert",
|
|
77
81
|
"aria-describedby": editorId
|
|
78
82
|
}, errorMessage))) : null;
|
|
@@ -80,7 +84,7 @@ export const ErrorMessages = () => {
|
|
|
80
84
|
// Only render CustomErrorComponent if there is an errorMessage
|
|
81
85
|
if (errorMessage != null && CustomErrorComponent) {
|
|
82
86
|
return /*#__PURE__*/React.createElement(CustomComponentDecoratedWithEditorTheme, {
|
|
83
|
-
testId:
|
|
87
|
+
testId: JQL_EDITOR_VALIDATION_ID,
|
|
84
88
|
editorId: editorId,
|
|
85
89
|
Component: CustomErrorComponent
|
|
86
90
|
}, childrenToRender);
|
|
@@ -26,7 +26,7 @@ const fadeOut = keyframes({
|
|
|
26
26
|
// eslint-disable-next-line @atlaskit/design-system/no-styled-tagged-template-expression, @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
27
27
|
export const EditorMain = styled.div`
|
|
28
28
|
/* CSS reset */
|
|
29
|
-
font-family: ${"var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu,
|
|
29
|
+
font-family: ${"var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)"};
|
|
30
30
|
font-size: 14px;
|
|
31
31
|
flex-grow: 1;
|
|
32
32
|
|
|
@@ -37,7 +37,7 @@ export const EditorMain = styled.div`
|
|
|
37
37
|
color: ${`var(--ds-text-inverse, ${N0})`};
|
|
38
38
|
border-radius: ${"var(--ds-border-radius-100, 3px)"};
|
|
39
39
|
box-sizing: border-box;
|
|
40
|
-
font: ${"var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu,
|
|
40
|
+
font: ${"var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)"};
|
|
41
41
|
line-height: 1.3;
|
|
42
42
|
max-width: 240px;
|
|
43
43
|
padding: ${"var(--ds-space-025, 2px)"} ${"var(--ds-space-075, 6px)"};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
2
2
|
import throttle from 'lodash/throttle';
|
|
3
|
-
import {
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { JQL_EDITOR_AUTOCOMPLETE_ID, JQL_EDITOR_HELP_CONTENT_ID, JQL_EDITOR_INPUT_ID, JQL_EDITOR_MAIN_ID, JQL_EDITOR_VALIDATION_ID } from '../../common/constants';
|
|
4
5
|
import { useEditorThemeContext } from '../../hooks/use-editor-theme';
|
|
5
6
|
import { useEditorViewIsInvalid } from '../../hooks/use-editor-view-is-invalid';
|
|
6
7
|
import { useAutocomplete, useAutocompleteIsOpen, useEditorView, useEditorViewHasFocus, useIntl, useLineNumbersVisible, useScopedId, useStoreActions } from '../../state';
|
|
@@ -30,6 +31,7 @@ const JQLEditorView = ({
|
|
|
30
31
|
const [autocompleteId] = useScopedId(JQL_EDITOR_AUTOCOMPLETE_ID);
|
|
31
32
|
const [editorId] = useScopedId(JQL_EDITOR_INPUT_ID);
|
|
32
33
|
const [helpContentId] = useScopedId(JQL_EDITOR_HELP_CONTENT_ID);
|
|
34
|
+
const [validationId] = useScopedId(JQL_EDITOR_VALIDATION_ID);
|
|
33
35
|
const [intl] = useIntl();
|
|
34
36
|
const portalActions = usePortalActionsContext();
|
|
35
37
|
const [, {
|
|
@@ -89,7 +91,7 @@ const JQLEditorView = ({
|
|
|
89
91
|
'aria-label': intl.formatMessage(messages.inputLabel),
|
|
90
92
|
'aria-controls': autocompleteId,
|
|
91
93
|
'aria-owns': autocompleteId,
|
|
92
|
-
'aria-describedby': helpContentId,
|
|
94
|
+
'aria-describedby': fg('jql_editor_a11y') ? editorViewIsInvalid ? validationId : helpContentId : helpContentId,
|
|
93
95
|
...(selectedOptionId && {
|
|
94
96
|
'aria-activedescendant': selectedOptionId
|
|
95
97
|
}),
|
|
@@ -97,7 +99,7 @@ const JQLEditorView = ({
|
|
|
97
99
|
'aria-invalid': 'true'
|
|
98
100
|
})
|
|
99
101
|
};
|
|
100
|
-
}, [editorId, isAutocompleteOpen, intl, autocompleteId, helpContentId, selectedOptionId
|
|
102
|
+
}, [editorId, isAutocompleteOpen, intl, autocompleteId, editorViewIsInvalid, validationId, helpContentId, selectedOptionId]);
|
|
101
103
|
|
|
102
104
|
// Update attributes on our editor view whenever they have changed
|
|
103
105
|
useEffect(() => {
|
|
@@ -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.0.
|
|
3
|
+
return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.0.5", ANALYTICS_CHANNEL);
|
|
4
4
|
};
|
|
@@ -2,4 +2,5 @@ export var JQL_EDITOR_MAIN_ID = 'jql-editor-main';
|
|
|
2
2
|
export var JQL_EDITOR_AUTOCOMPLETE_ID = 'jql-editor-autocomplete';
|
|
3
3
|
export var JQL_EDITOR_INPUT_ID = 'jql-editor-input';
|
|
4
4
|
export var JQL_EDITOR_HELP_CONTENT_ID = 'jql-editor-help-content';
|
|
5
|
+
export var JQL_EDITOR_VALIDATION_ID = 'jql-editor-validation';
|
|
5
6
|
export var SYNTAX_HELP_DESCRIPTION_ID = 'syntax-help-description';
|
|
@@ -17,5 +17,5 @@ export var hiddenMixin = css({
|
|
|
17
17
|
|
|
18
18
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
19
19
|
export var TooltipContent = styled.div({
|
|
20
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu,
|
|
20
|
+
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)"
|
|
21
21
|
});
|
|
@@ -3,7 +3,7 @@ import styled from '@emotion/styled';
|
|
|
3
3
|
import { N100, N20, N50, N800 } from '@atlaskit/theme/colors';
|
|
4
4
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
5
5
|
export var TooltipContent = styled.div({
|
|
6
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu,
|
|
6
|
+
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)"
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
@@ -6,7 +6,8 @@ import React, { useEffect } from 'react';
|
|
|
6
6
|
import { di } from 'react-magnetic-di';
|
|
7
7
|
import { ErrorMessage } from '@atlaskit/form';
|
|
8
8
|
import { JQLSyntaxError } from '@atlaskit/jql-ast';
|
|
9
|
-
import {
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
+
import { JQL_EDITOR_INPUT_ID, JQL_EDITOR_VALIDATION_ID } from '../../../../common/constants';
|
|
10
11
|
import { commonMessages } from '../../../../common/messages';
|
|
11
12
|
import { useEditorThemeContext } from '../../../../hooks/use-editor-theme';
|
|
12
13
|
import { useEditorViewIsInvalid } from '../../../../hooks/use-editor-view-is-invalid';
|
|
@@ -72,14 +73,19 @@ export var ErrorMessages = function ErrorMessages() {
|
|
|
72
73
|
var _useScopedId = useScopedId(JQL_EDITOR_INPUT_ID),
|
|
73
74
|
_useScopedId2 = _slicedToArray(_useScopedId, 1),
|
|
74
75
|
editorId = _useScopedId2[0];
|
|
76
|
+
var _useScopedId3 = useScopedId(JQL_EDITOR_VALIDATION_ID),
|
|
77
|
+
_useScopedId4 = _slicedToArray(_useScopedId3, 1),
|
|
78
|
+
validationId = _useScopedId4[0];
|
|
75
79
|
var errorMessage = useFormattedErrorMessage();
|
|
76
|
-
var testId = 'jql-editor-validation';
|
|
77
80
|
var _useCustomErrorCompon = useCustomErrorComponent(),
|
|
78
81
|
_useCustomErrorCompon2 = _slicedToArray(_useCustomErrorCompon, 1),
|
|
79
82
|
CustomErrorComponent = _useCustomErrorCompon2[0];
|
|
80
83
|
var childrenToRender = errorMessage != null ? /*#__PURE__*/React.createElement(MessageContainer, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
81
|
-
testId:
|
|
82
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
84
|
+
testId: JQL_EDITOR_VALIDATION_ID
|
|
85
|
+
}, fg('jql_editor_a11y') ? /*#__PURE__*/React.createElement("span", {
|
|
86
|
+
role: "alert",
|
|
87
|
+
id: validationId
|
|
88
|
+
}, errorMessage) : /*#__PURE__*/React.createElement("span", {
|
|
83
89
|
role: "alert",
|
|
84
90
|
"aria-describedby": editorId
|
|
85
91
|
}, errorMessage))) : null;
|
|
@@ -87,7 +93,7 @@ export var ErrorMessages = function ErrorMessages() {
|
|
|
87
93
|
// Only render CustomErrorComponent if there is an errorMessage
|
|
88
94
|
if (errorMessage != null && CustomErrorComponent) {
|
|
89
95
|
return /*#__PURE__*/React.createElement(CustomComponentDecoratedWithEditorTheme, {
|
|
90
|
-
testId:
|
|
96
|
+
testId: JQL_EDITOR_VALIDATION_ID,
|
|
91
97
|
editorId: editorId,
|
|
92
98
|
Component: CustomErrorComponent
|
|
93
99
|
}, childrenToRender);
|
|
@@ -26,7 +26,7 @@ var fadeOut = keyframes({
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
// eslint-disable-next-line @atlaskit/design-system/no-styled-tagged-template-expression, @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
29
|
-
export var EditorMain = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t/* CSS reset */\n\tfont-family: ", ";\n\tfont-size: 14px;\n\tflex-grow: 1;\n\n\t/* These styles and animations are derived from @atlaskit/tooltip */\n\n\t.", " {\n\t\tbackground-color: ", ";\n\t\tcolor: ", ";\n\t\tborder-radius: ", ";\n\t\tbox-sizing: border-box;\n\t\tfont: ", ";\n\t\tline-height: 1.3;\n\t\tmax-width: 240px;\n\t\tpadding: ", " ", ";\n\t\tword-wrap: break-word;\n\t\toverflow-wrap: break-word;\n\t\tz-index: ", ";\n\t\tpointer-events: none;\n\t\tposition: absolute;\n\t\tvisibility: hidden;\n\n\t\t/* Horizontally center and vertically position above the target element */\n\t\ttransform: translate(-50%, calc(-100% - ", "));\n\n\t\t&.", " {\n\t\t\tanimation: ", " 350ms cubic-bezier(0.15, 1, 0.3, 1);\n\t\t\tvisibility: visible;\n\t\t}\n\n\t\t&.", " {\n\t\t\tanimation: ", " 350ms cubic-bezier(0.15, 1, 0.3, 1);\n\t\t}\n\t}\n"])), "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu,
|
|
29
|
+
export var EditorMain = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t/* CSS reset */\n\tfont-family: ", ";\n\tfont-size: 14px;\n\tflex-grow: 1;\n\n\t/* These styles and animations are derived from @atlaskit/tooltip */\n\n\t.", " {\n\t\tbackground-color: ", ";\n\t\tcolor: ", ";\n\t\tborder-radius: ", ";\n\t\tbox-sizing: border-box;\n\t\tfont: ", ";\n\t\tline-height: 1.3;\n\t\tmax-width: 240px;\n\t\tpadding: ", " ", ";\n\t\tword-wrap: break-word;\n\t\toverflow-wrap: break-word;\n\t\tz-index: ", ";\n\t\tpointer-events: none;\n\t\tposition: absolute;\n\t\tvisibility: hidden;\n\n\t\t/* Horizontally center and vertically position above the target element */\n\t\ttransform: translate(-50%, calc(-100% - ", "));\n\n\t\t&.", " {\n\t\t\tanimation: ", " 350ms cubic-bezier(0.15, 1, 0.3, 1);\n\t\t\tvisibility: visible;\n\t\t}\n\n\t\t&.", " {\n\t\t\tanimation: ", " 350ms cubic-bezier(0.15, 1, 0.3, 1);\n\t\t}\n\t}\n"])), "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)", TOOLTIP_CLASSNAME, "var(--ds-background-neutral-bold, ".concat(N800, ")"), "var(--ds-text-inverse, ".concat(N0, ")"), "var(--ds-border-radius-100, 3px)", "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)", "var(--ds-space-025, 2px)", "var(--ds-space-075, 6px)", layers.tooltip(), "var(--ds-space-200, 16px)", TOOLTIP_ENTER_CLASSNAME, fadeIn, TOOLTIP_EXIT_CLASSNAME, fadeOut);
|
|
30
30
|
|
|
31
31
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
32
32
|
export var EditorFooter = styled.div({
|
|
@@ -4,7 +4,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
4
4
|
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; }
|
|
5
5
|
import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
6
6
|
import throttle from 'lodash/throttle';
|
|
7
|
-
import {
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { JQL_EDITOR_AUTOCOMPLETE_ID, JQL_EDITOR_HELP_CONTENT_ID, JQL_EDITOR_INPUT_ID, JQL_EDITOR_MAIN_ID, JQL_EDITOR_VALIDATION_ID } from '../../common/constants';
|
|
8
9
|
import { useEditorThemeContext } from '../../hooks/use-editor-theme';
|
|
9
10
|
import { useEditorViewIsInvalid } from '../../hooks/use-editor-view-is-invalid';
|
|
10
11
|
import { useAutocomplete, useAutocompleteIsOpen, useEditorView, useEditorViewHasFocus, useIntl, useLineNumbersVisible, useScopedId, useStoreActions } from '../../state';
|
|
@@ -43,6 +44,9 @@ var JQLEditorView = function JQLEditorView(_ref) {
|
|
|
43
44
|
var _useScopedId7 = useScopedId(JQL_EDITOR_HELP_CONTENT_ID),
|
|
44
45
|
_useScopedId8 = _slicedToArray(_useScopedId7, 1),
|
|
45
46
|
helpContentId = _useScopedId8[0];
|
|
47
|
+
var _useScopedId9 = useScopedId(JQL_EDITOR_VALIDATION_ID),
|
|
48
|
+
_useScopedId10 = _slicedToArray(_useScopedId9, 1),
|
|
49
|
+
validationId = _useScopedId10[0];
|
|
46
50
|
var _useIntl = useIntl(),
|
|
47
51
|
_useIntl2 = _slicedToArray(_useIntl, 1),
|
|
48
52
|
intl = _useIntl2[0];
|
|
@@ -112,13 +116,13 @@ var JQLEditorView = function JQLEditorView(_ref) {
|
|
|
112
116
|
'aria-label': intl.formatMessage(messages.inputLabel),
|
|
113
117
|
'aria-controls': autocompleteId,
|
|
114
118
|
'aria-owns': autocompleteId,
|
|
115
|
-
'aria-describedby': helpContentId
|
|
119
|
+
'aria-describedby': fg('jql_editor_a11y') ? editorViewIsInvalid ? validationId : helpContentId : helpContentId
|
|
116
120
|
}, selectedOptionId && {
|
|
117
121
|
'aria-activedescendant': selectedOptionId
|
|
118
122
|
}), editorViewIsInvalid && {
|
|
119
123
|
'aria-invalid': 'true'
|
|
120
124
|
});
|
|
121
|
-
}, [editorId, isAutocompleteOpen, intl, autocompleteId, helpContentId, selectedOptionId
|
|
125
|
+
}, [editorId, isAutocompleteOpen, intl, autocompleteId, editorViewIsInvalid, validationId, helpContentId, selectedOptionId]);
|
|
122
126
|
|
|
123
127
|
// Update attributes on our editor view whenever they have changed
|
|
124
128
|
useEffect(function () {
|
|
@@ -2,4 +2,5 @@ export declare const JQL_EDITOR_MAIN_ID = "jql-editor-main";
|
|
|
2
2
|
export declare const JQL_EDITOR_AUTOCOMPLETE_ID = "jql-editor-autocomplete";
|
|
3
3
|
export declare const JQL_EDITOR_INPUT_ID = "jql-editor-input";
|
|
4
4
|
export declare const JQL_EDITOR_HELP_CONTENT_ID = "jql-editor-help-content";
|
|
5
|
+
export declare const JQL_EDITOR_VALIDATION_ID = "jql-editor-validation";
|
|
5
6
|
export declare const SYNTAX_HELP_DESCRIPTION_ID = "syntax-help-description";
|
|
@@ -2,4 +2,5 @@ export declare const JQL_EDITOR_MAIN_ID = "jql-editor-main";
|
|
|
2
2
|
export declare const JQL_EDITOR_AUTOCOMPLETE_ID = "jql-editor-autocomplete";
|
|
3
3
|
export declare const JQL_EDITOR_INPUT_ID = "jql-editor-input";
|
|
4
4
|
export declare const JQL_EDITOR_HELP_CONTENT_ID = "jql-editor-help-content";
|
|
5
|
+
export declare const JQL_EDITOR_VALIDATION_ID = "jql-editor-validation";
|
|
5
6
|
export declare const SYNTAX_HELP_DESCRIPTION_ID = "syntax-help-description";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/jql-editor",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
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",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
53
53
|
"@atlaskit/primitives": "^14.1.0",
|
|
54
54
|
"@atlaskit/spinner": "^18.0.0",
|
|
55
|
-
"@atlaskit/theme": "^
|
|
56
|
-
"@atlaskit/tokens": "^4.
|
|
55
|
+
"@atlaskit/theme": "^18.0.0",
|
|
56
|
+
"@atlaskit/tokens": "^4.3.0",
|
|
57
57
|
"@atlaskit/tooltip": "^20.0.0",
|
|
58
58
|
"@babel/runtime": "^7.0.0",
|
|
59
59
|
"@emotion/react": "^11.7.1",
|
|
@@ -75,11 +75,11 @@
|
|
|
75
75
|
"react-dom": "^18.2.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@af/integration-testing": "
|
|
79
|
-
"@atlaskit/docs": "
|
|
78
|
+
"@af/integration-testing": "^0.5.0",
|
|
79
|
+
"@atlaskit/docs": "^10.0.0",
|
|
80
80
|
"@atlaskit/jql-editor-autocomplete-rest": "^3.0.0",
|
|
81
|
-
"@atlaskit/visual-regression": "
|
|
82
|
-
"@atlassian/feature-flags-test-utils": "0.3.
|
|
81
|
+
"@atlaskit/visual-regression": "^0.10.0",
|
|
82
|
+
"@atlassian/feature-flags-test-utils": "^0.3.0",
|
|
83
83
|
"@storybook/addon-actions": "^6.4.0",
|
|
84
84
|
"@storybook/addon-knobs": "^6.4.0",
|
|
85
85
|
"@testing-library/jest-dom": "^6.4.5",
|
|
@@ -133,6 +133,9 @@
|
|
|
133
133
|
},
|
|
134
134
|
"add_nin_press_interactions": {
|
|
135
135
|
"type": "boolean"
|
|
136
|
+
},
|
|
137
|
+
"jql_editor_a11y": {
|
|
138
|
+
"type": "boolean"
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
141
|
}
|