@atlaskit/jql-editor 5.5.1 → 5.5.3

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/analytics/util.js +1 -1
  3. package/dist/es2019/analytics/util.js +1 -1
  4. package/dist/esm/analytics/util.js +1 -1
  5. package/dist/types/analytics/listener/types.d.ts +2 -2
  6. package/dist/types/hooks/use-editor-theme/index.d.ts +6 -6
  7. package/dist/types/plugins/autocomplete/components/autocomplete-dropdown/index.d.ts +2 -2
  8. package/dist/types/plugins/autocomplete/components/autocomplete-option/index.d.ts +1 -1
  9. package/dist/types/plugins/autocomplete/components/autocomplete-option/styled.d.ts +1 -1
  10. package/dist/types/plugins/autocomplete/components/types.d.ts +5 -5
  11. package/dist/types/plugins/rich-inline-nodes/nodes/types.d.ts +1 -1
  12. package/dist/types/plugins/rich-inline-nodes/nodes/user/index.d.ts +1 -1
  13. package/dist/types/plugins/rich-inline-nodes/nodes/user/styled.d.ts +1 -1
  14. package/dist/types/plugins/rich-inline-nodes/util/react-node-view.d.ts +1 -1
  15. package/dist/types/plugins/types.d.ts +4 -4
  16. package/dist/types/plugins/validation-tooltip/view.d.ts +1 -1
  17. package/dist/types/state/types.d.ts +89 -89
  18. package/dist/types/ui/error-boundary/index.d.ts +8 -8
  19. package/dist/types/ui/jql-editor/types.d.ts +44 -44
  20. package/dist/types/ui/jql-editor-controls-content/base-expand-toggle/index.d.ts +1 -1
  21. package/dist/types/ui/jql-editor-layout/index.d.ts +17 -17
  22. package/dist/types/ui/jql-editor-layout/styled.d.ts +3 -3
  23. package/dist/types/ui/jql-editor-portal-provider/types.d.ts +5 -5
  24. package/dist/types-ts4.5/analytics/listener/types.d.ts +2 -2
  25. package/dist/types-ts4.5/hooks/use-editor-theme/index.d.ts +6 -6
  26. package/dist/types-ts4.5/plugins/autocomplete/components/autocomplete-dropdown/index.d.ts +2 -2
  27. package/dist/types-ts4.5/plugins/autocomplete/components/autocomplete-option/index.d.ts +1 -1
  28. package/dist/types-ts4.5/plugins/autocomplete/components/autocomplete-option/styled.d.ts +1 -1
  29. package/dist/types-ts4.5/plugins/autocomplete/components/types.d.ts +5 -5
  30. package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/types.d.ts +1 -1
  31. package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/user/index.d.ts +1 -1
  32. package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/user/styled.d.ts +1 -1
  33. package/dist/types-ts4.5/plugins/rich-inline-nodes/util/react-node-view.d.ts +1 -1
  34. package/dist/types-ts4.5/plugins/types.d.ts +4 -4
  35. package/dist/types-ts4.5/plugins/validation-tooltip/view.d.ts +1 -1
  36. package/dist/types-ts4.5/state/types.d.ts +89 -89
  37. package/dist/types-ts4.5/ui/error-boundary/index.d.ts +8 -8
  38. package/dist/types-ts4.5/ui/jql-editor/types.d.ts +44 -44
  39. package/dist/types-ts4.5/ui/jql-editor-controls-content/base-expand-toggle/index.d.ts +1 -1
  40. package/dist/types-ts4.5/ui/jql-editor-layout/index.d.ts +17 -17
  41. package/dist/types-ts4.5/ui/jql-editor-layout/styled.d.ts +3 -3
  42. package/dist/types-ts4.5/ui/jql-editor-portal-provider/types.d.ts +5 -5
  43. package/package.json +6 -7
@@ -13,8 +13,8 @@ export type ContextAwareTokenSuggestions = TokenSuggestions & {
13
13
  context?: JQLRuleContext;
14
14
  };
15
15
  export type ContextAwareJQLSuggestions = {
16
- tokens: ContextAwareTokenSuggestions;
17
16
  rules: JQLRuleSuggestions;
17
+ tokens: ContextAwareTokenSuggestions;
18
18
  };
19
19
  /**
20
20
  * Analytic attributes emitted whenever external JQL errors are viewed in the UI.
@@ -32,44 +32,44 @@ export type ExternalErrorAttributes = {
32
32
  */
33
33
  export type ExternalError = {
34
34
  /**
35
- * Type of the message.
35
+ * Optional identifying error type when a syntax error has occurred. This should be one of the types defined in the
36
+ * `JqlSyntaxQueryErrorExtension` node of the Atlassian GraphQL schema.
36
37
  */
37
- type: 'error';
38
+ errorType?: string;
38
39
  /**
39
40
  * Message to display.
40
41
  */
41
42
  message: ReactNode;
42
43
  /**
43
- * Optional identifying error type when a syntax error has occurred. This should be one of the types defined in the
44
- * `JqlSyntaxQueryErrorExtension` node of the Atlassian GraphQL schema.
44
+ * Type of the message.
45
45
  */
46
- errorType?: string;
46
+ type: 'error';
47
47
  };
48
48
  export type ExternalWarning = {
49
+ /**
50
+ * Message to display.
51
+ */
52
+ message: ReactNode;
49
53
  /**
50
54
  * Type of the message.
51
55
  */
52
56
  type: 'warning';
57
+ };
58
+ export type ExternalInfo = {
53
59
  /**
54
60
  * Message to display.
55
61
  */
56
62
  message: ReactNode;
57
- };
58
- export type ExternalInfo = {
59
63
  /**
60
64
  * Type of the message.
61
65
  */
62
66
  type: 'info';
63
- /**
64
- * Message to display.
65
- */
66
- message: ReactNode;
67
67
  };
68
68
  export type CustomErrorComponent = React.ComponentType<PropsWithChildren<{
69
- testId: string;
70
- editorTheme: EditorTheme;
71
69
  editorId: string;
70
+ editorTheme: EditorTheme;
72
71
  errorMessages: React.ReactElement[];
72
+ testId: string;
73
73
  validationId: string;
74
74
  }>>;
75
75
  export type CustomErrorMessageProps = Omit<React.ComponentProps<CustomErrorComponent>, 'editorTheme'> & {
@@ -81,77 +81,81 @@ export type CustomComponents = {
81
81
  export type ExternalMessage = ExternalError | ExternalWarning | ExternalInfo;
82
82
  export type ExternalMessagesNormalized = {
83
83
  errors: ExternalError[];
84
- warnings: ExternalWarning[];
85
84
  infos: ExternalInfo[];
85
+ warnings: ExternalWarning[];
86
86
  };
87
87
  export type AutocompletePosition = {
88
- top: number;
89
88
  left: number;
89
+ top: number;
90
90
  };
91
91
  export type OptionsKey = keyof Omit<AutocompleteOptionGroup, 'tokens'>;
92
92
  export type AutocompleteState = {
93
93
  /**
94
- * ID of the currently selected autocomplete option, or `undefined` if no option is selected.
95
- */
96
- selectedOptionId: string | undefined;
97
- /**
98
- * Forces autocomplete to stay closed on next update, which is the desired behavior when:
99
- * - we select an autocomplete option
100
- * - we navigate the query with arrow keys
94
+ * Subscription for a debounced autocomplete analytics event. This allows the event to be cancelled upon a new request.
101
95
  */
102
- shouldStayClosedOnNextUpdate: boolean;
96
+ analyticsSubscription: Subscription | null;
103
97
  /**
104
- * Manages current autocomplete visibility state, derived from `shouldStayClosedOnNextUpdate`.
98
+ * Reference to the autocomplete container DOM element.
105
99
  */
106
- shouldStayClosed: boolean;
100
+ container: HTMLElement | null;
107
101
  /**
108
102
  * Determines if autocomplete options are currently being loaded.
109
103
  */
110
104
  loading: boolean;
105
+ /**
106
+ * Provides information about autocomplete offset parent's size and its position relative to the viewport.
107
+ * This is used to calculate autocomplete dropdown position.
108
+ */
109
+ offsetParentRect: DOMRectReadOnly | undefined;
111
110
  /**
112
111
  * Autocomplete options returned by autocomplete provider functions.
113
112
  */
114
113
  options: AutocompleteOptionGroup;
115
114
  /**
116
- * Autocomplete provider is an Observable based API. This references any in-flight subscription so we can cancel it
117
- * upon a new request.
115
+ * Computed replace position start for the current set of autocomplete options.
116
+ * We use this position to derive autocomplete dropdown coordinates.
118
117
  */
119
- subscription: Subscription | null;
118
+ replacePositionStart: number;
120
119
  /**
121
- * Subscription for a debounced autocomplete analytics event. This allows the event to be cancelled upon a new request.
120
+ * ID of the currently selected autocomplete option, or `undefined` if no option is selected.
122
121
  */
123
- analyticsSubscription: Subscription | null;
122
+ selectedOptionId: string | undefined;
124
123
  /**
125
- * Reference to the autocomplete container DOM element.
124
+ * Manages current autocomplete visibility state, derived from `shouldStayClosedOnNextUpdate`.
126
125
  */
127
- container: HTMLElement | null;
126
+ shouldStayClosed: boolean;
128
127
  /**
129
- * Provides information about autocomplete offset parent's size and its position relative to the viewport.
130
- * This is used to calculate autocomplete dropdown position.
128
+ * Forces autocomplete to stay closed on next update, which is the desired behavior when:
129
+ * - we select an autocomplete option
130
+ * - we navigate the query with arrow keys
131
131
  */
132
- offsetParentRect: DOMRectReadOnly | undefined;
132
+ shouldStayClosedOnNextUpdate: boolean;
133
133
  /**
134
- * Computed replace position start for the current set of autocomplete options.
135
- * We use this position to derive autocomplete dropdown coordinates.
134
+ * Autocomplete provider is an Observable based API. This references any in-flight subscription so we can cancel it
135
+ * upon a new request.
136
136
  */
137
- replacePositionStart: number;
137
+ subscription: Subscription | null;
138
138
  };
139
139
  export type HydratedValuesMap = {
140
140
  [fieldName: string]: Map<string, HydratedValue>;
141
141
  };
142
142
  export type State = {
143
143
  /**
144
- * The controlled query prop passed to the container.
144
+ * State managed by the autocomplete plugin.
145
145
  */
146
- controlledQuery: string;
146
+ autocomplete: AutocompleteState;
147
147
  /**
148
- * The current query string in the JQL editor.
148
+ * Provider object to fetch autocomplete data.
149
149
  */
150
- query: string;
150
+ autocompleteProvider: AutocompleteProvider;
151
151
  /**
152
- * Custom messages to display.
152
+ * The controlled query prop passed to the container.
153
153
  */
154
- externalMessages: ExternalMessage[];
154
+ controlledQuery: string;
155
+ /**
156
+ * Custom components to take over the rendering of certain parts of the jql editor
157
+ */
158
+ customComponents?: CustomComponents;
155
159
  /**
156
160
  * The current Prosemirror editor state.
157
161
  */
@@ -160,68 +164,60 @@ export type State = {
160
164
  * The Prosemirror editor view mounted to the DOM, or `undefined` if the view has not been initialised.
161
165
  */
162
166
  editorView: EditorView | undefined;
163
- /**
164
- * Flag to enable the searching indicator when a JQL search is in progress.
165
- */
166
- isSearching: boolean | undefined;
167
- /**
168
- * Mutable reference to a react-intl object.
169
- */
170
- intlRef: MutableRefObject<IntlShape>;
171
- /**
172
- * Provider object to fetch autocomplete data.
173
- */
174
- autocompleteProvider: AutocompleteProvider;
175
- /**
176
- * Prefix to use when computing id's for DOM elements (to allow multiple editors rendered on the same page).
177
- */
178
- idPrefix: string;
179
167
  /**
180
168
  * ID of the timeout used before setting `editorViewHasFocus=false`. This gives an opportunity for the timeout to be
181
169
  * cleared if another element within the context receives focus.
182
170
  */
183
171
  editorViewBlurTimeout: number | null;
184
172
  /**
185
- * Flag to determine whether the editor view (or autocomplete dropdown) currently has focus.
173
+ * Reference to the editor view container (scrollable element that contains line numbers and editor view).
186
174
  */
187
- editorViewHasFocus: boolean;
175
+ editorViewContainer: HTMLElement | undefined;
188
176
  /**
189
- * Flag to determine whether line numbers should be shown in the editor.
177
+ * Provides information about editor view container size and its position relative to the viewport.
178
+ * Can be used to position portals in relation to the editor, ensure they don't exceed its dimensions, etc.
190
179
  */
191
- lineNumbersVisible: boolean;
180
+ editorViewContainerRect: DOMRectReadOnly | undefined;
192
181
  /**
193
- * The first JQL parse error of the last submitted query, or {@code null} if there were no errors.
182
+ * Number of pixels that the editor view container is currently scrolled vertically (Y axis).
194
183
  */
195
- jqlError: JQLParseError | null;
184
+ editorViewContainerScroll: number;
196
185
  /**
197
- * State managed by the autocomplete plugin.
186
+ * Flag to determine whether the editor view (or autocomplete dropdown) currently has focus.
198
187
  */
199
- autocomplete: AutocompleteState;
188
+ editorViewHasFocus: boolean;
200
189
  /**
201
190
  * Whether rich inline nodes feature should be enabled.
202
191
  */
203
192
  enableRichInlineNodes: boolean;
193
+ /**
194
+ * Custom messages to display.
195
+ */
196
+ externalMessages: ExternalMessage[];
204
197
  /**
205
198
  * Map of hydrated values.
206
199
  */
207
200
  hydratedValues: HydratedValuesMap;
208
201
  /**
209
- * Reference to the ResizeObserver object used to process size changes within the editor.
202
+ * Prefix to use when computing id's for DOM elements (to allow multiple editors rendered on the same page).
210
203
  */
211
- resizeObserver: ResizeObserver | undefined;
204
+ idPrefix: string;
212
205
  /**
213
- * Reference to the editor view container (scrollable element that contains line numbers and editor view).
206
+ * Mutable reference to a react-intl object.
214
207
  */
215
- editorViewContainer: HTMLElement | undefined;
208
+ intlRef: MutableRefObject<IntlShape>;
216
209
  /**
217
- * Provides information about editor view container size and its position relative to the viewport.
218
- * Can be used to position portals in relation to the editor, ensure they don't exceed its dimensions, etc.
210
+ * Flag to enable the searching indicator when a JQL search is in progress.
219
211
  */
220
- editorViewContainerRect: DOMRectReadOnly | undefined;
212
+ isSearching: boolean | undefined;
221
213
  /**
222
- * Number of pixels that the editor view container is currently scrolled vertically (Y axis).
214
+ * The first JQL parse error of the last submitted query, or {@code null} if there were no errors.
223
215
  */
224
- editorViewContainerScroll: number;
216
+ jqlError: JQLParseError | null;
217
+ /**
218
+ * Flag to determine whether line numbers should be shown in the editor.
219
+ */
220
+ lineNumbersVisible: boolean;
225
221
  /**
226
222
  * Called when we want to debug a particular error or action that has occurred within the editor. The message may
227
223
  * contain PII, and as such consumers should treat as a privacy unsafe error.
@@ -235,27 +231,31 @@ export type State = {
235
231
  */
236
232
  onSyntaxHelp?: (e: MouseEvent<HTMLElement>) => boolean;
237
233
  /**
238
- * Custom components to take over the rendering of certain parts of the jql editor
234
+ * The current query string in the JQL editor.
239
235
  */
240
- customComponents?: CustomComponents;
236
+ query: string;
237
+ /**
238
+ * Reference to the ResizeObserver object used to process size changes within the editor.
239
+ */
240
+ resizeObserver: ResizeObserver | undefined;
241
241
  };
242
242
  export type DebugMessageEventAttribute = string | number | boolean | void | null;
243
243
  export type Props = {
244
- query: string;
244
+ autocompleteProvider: AutocompleteProvider;
245
+ createAndFireAnalyticsEvent: (payload: JqlEditorAnalyticsEvent) => void;
246
+ customComponents?: CustomComponents;
247
+ enableRichInlineNodes: boolean;
245
248
  externalMessages: ExternalMessage[];
246
- isSearching: boolean | undefined;
247
249
  intlRef: MutableRefObject<IntlShape>;
248
- createAndFireAnalyticsEvent: (payload: JqlEditorAnalyticsEvent) => void;
249
- onEditorMounted?: () => void;
250
+ isSearching: boolean | undefined;
250
251
  onDebugUnsafeMessage?: (message: string, event: {
251
252
  [key: string]: DebugMessageEventAttribute;
252
253
  }) => void;
254
+ onEditorMounted?: () => void;
255
+ onFocus?: (e: FocusEvent<HTMLElement>) => void;
253
256
  onHydrate?: (query: string) => Promise<HydratedValues>;
254
- onUpdate?: (query: string, jast: Jast) => void;
255
257
  onSearch?: (query: string, jast: Jast) => void;
256
- autocompleteProvider: AutocompleteProvider;
257
- enableRichInlineNodes: boolean;
258
258
  onSyntaxHelp?: (e: MouseEvent<HTMLElement>) => boolean;
259
- onFocus?: (e: FocusEvent<HTMLElement>) => void;
260
- customComponents?: CustomComponents;
259
+ onUpdate?: (query: string, jast: Jast) => void;
260
+ query: string;
261
261
  };
@@ -2,24 +2,24 @@ import React, { type ComponentClass, type FunctionComponent } from 'react';
2
2
  import { type JQLEditorUIProps } from '../jql-editor/types';
3
3
  type WithErrorBoundaryProps = {
4
4
  /**
5
- * Called if an unexpected error is thrown while rendering the editor.
5
+ * To adjust size of the editor
6
+ * `false` matches AK's default field styling
7
+ * `true` matches AK's compact field styling, used for search purposes
6
8
  */
7
- onRenderError?: (error: Error) => void;
9
+ isCompact?: boolean;
8
10
  /**
9
- * The query to render in the editor.
11
+ * Called if an unexpected error is thrown while rendering the editor.
10
12
  */
11
- query: string;
13
+ onRenderError?: (error: Error) => void;
12
14
  /**
13
15
  * Called every time the search command is given in the editor with the current query value and respective Jast object.
14
16
  * If not passed, hides the search button/other search related functionality, allowing this to be usable as a form field.
15
17
  */
16
18
  onSearch?: JQLEditorUIProps['onSearch'];
17
19
  /**
18
- * To adjust size of the editor
19
- * `false` matches AK's default field styling
20
- * `true` matches AK's compact field styling, used for search purposes
20
+ * The query to render in the editor.
21
21
  */
22
- isCompact?: boolean;
22
+ query: string;
23
23
  };
24
24
  export declare const withErrorBoundary: <Props extends WithErrorBoundaryProps>(WrappedComponent: FunctionComponent<Props> | ComponentClass<Props>) => (props: Props) => React.JSX.Element;
25
25
  export {};
@@ -3,18 +3,18 @@ import { type Jast } from '@atlaskit/jql-ast';
3
3
  import { type AutocompleteProvider } from '../../plugins/autocomplete/types';
4
4
  import { type CustomComponents, type ExternalMessage } from '../../state/types';
5
5
  export type HydratedUser = {
6
- type: 'user';
6
+ avatarUrl: string;
7
7
  id: string;
8
8
  name: string;
9
- avatarUrl: string;
9
+ type: 'user';
10
10
  };
11
11
  export type HydratedDeprecatedField = {
12
- type: 'deprecated-field';
12
+ deprecatedSearcherKey: string;
13
13
  /**
14
14
  * The jqlTerm of the field.
15
15
  */
16
16
  id: string;
17
- deprecatedSearcherKey: string;
17
+ type: 'deprecated-field';
18
18
  };
19
19
  export type HydratedValue = HydratedUser | HydratedDeprecatedField;
20
20
  export type HydratedValues = {
@@ -26,38 +26,41 @@ export type JQLEditorUIProps = {
26
26
  */
27
27
  analyticsSource: string;
28
28
  /**
29
- * The query to render in the editor.
30
- */
31
- query: string;
32
- /**
33
- * Custom messages to display.
29
+ * Provider object to fetch autocomplete data.
34
30
  */
35
- messages?: ExternalMessage[];
31
+ autocompleteProvider: AutocompleteProvider;
36
32
  /**
37
- * Flag to enable the searching indicator when a JQL search is in progress.
33
+ * Custom components to take over the rendering of certain parts of JQL editor
38
34
  */
39
- isSearching?: boolean;
35
+ customComponents?: CustomComponents;
40
36
  /**
41
- * Called when the JQL editor has been initialised.
37
+ * Enables rich inline nodes feature, which will replace user identifiers with a lozenge containing name and avatar.
38
+ * Note that you must specify an `onHydrate` prop which will return user data for a given query in order to see the
39
+ * following behaviour:
40
+ * - Loading of user avatars
41
+ * - Rendering of user lozenges on component initialisation
42
+ * - Rendering of user lozenges on paste
42
43
  */
43
- onEditorMounted?: () => void;
44
+ enableRichInlineNodes?: boolean;
44
45
  /**
45
- * Called every time the editor needs to hydrate values for the current query.
46
+ * Ref callback to force the focus event
46
47
  */
47
- onHydrate?: (query: string) => Promise<HydratedValues>;
48
+ inputRef?: Ref<{
49
+ focus: () => void;
50
+ }>;
48
51
  /**
49
- * Called every time the editor is updated with the current query value and respective Jast object.
52
+ * `false` matches the Atlaskit default field styling
53
+ * `true` matches the Atlaskit compact field styling, generally used for search purposes.
50
54
  */
51
- onUpdate?: (query: string, jast: Jast) => void;
55
+ isCompact?: boolean;
52
56
  /**
53
- * Called every time the search command is given in the editor with the current query value and respective Jast object.
54
- * If not passed, hides the search button/other search related functionality, allowing this to be usable as a form field.
57
+ * Flag to enable the searching indicator when a JQL search is in progress.
55
58
  */
56
- onSearch?: (query: string, jast: Jast) => void;
59
+ isSearching?: boolean;
57
60
  /**
58
- * Called if an unexpected error is thrown while rendering the editor.
61
+ * Custom messages to display.
59
62
  */
60
- onRenderError?: (error: Error) => void;
63
+ messages?: ExternalMessage[];
61
64
  /**
62
65
  * Called when we want to debug a particular error or action that has occurred within the editor. The message may
63
66
  * contain PII, and as such consumers should treat as a privacy unsafe error.
@@ -66,40 +69,37 @@ export type JQLEditorUIProps = {
66
69
  [key: string]: string | number | boolean | void | null;
67
70
  }) => void;
68
71
  /**
69
- * Called when the syntax help button is clicked. Consumers can return `true` to signify that this event has been
70
- * handled which will prevent default behaviour of the help button, i.e. `e.preventDefault()`.
72
+ * Called when the JQL editor has been initialised.
71
73
  */
72
- onSyntaxHelp?: (e: MouseEvent<HTMLElement>) => boolean;
74
+ onEditorMounted?: () => void;
73
75
  /**
74
76
  * Called when the editor input is focused.
75
77
  */
76
78
  onFocus?: (e: FocusEvent<HTMLElement>) => void;
77
79
  /**
78
- * Provider object to fetch autocomplete data.
80
+ * Called every time the editor needs to hydrate values for the current query.
79
81
  */
80
- autocompleteProvider: AutocompleteProvider;
82
+ onHydrate?: (query: string) => Promise<HydratedValues>;
81
83
  /**
82
- * Enables rich inline nodes feature, which will replace user identifiers with a lozenge containing name and avatar.
83
- * Note that you must specify an `onHydrate` prop which will return user data for a given query in order to see the
84
- * following behaviour:
85
- * - Loading of user avatars
86
- * - Rendering of user lozenges on component initialisation
87
- * - Rendering of user lozenges on paste
84
+ * Called if an unexpected error is thrown while rendering the editor.
88
85
  */
89
- enableRichInlineNodes?: boolean;
86
+ onRenderError?: (error: Error) => void;
90
87
  /**
91
- * `false` matches the Atlaskit default field styling
92
- * `true` matches the Atlaskit compact field styling, generally used for search purposes.
88
+ * Called every time the search command is given in the editor with the current query value and respective Jast object.
89
+ * If not passed, hides the search button/other search related functionality, allowing this to be usable as a form field.
93
90
  */
94
- isCompact?: boolean;
91
+ onSearch?: (query: string, jast: Jast) => void;
95
92
  /**
96
- * Ref callback to force the focus event
93
+ * Called when the syntax help button is clicked. Consumers can return `true` to signify that this event has been
94
+ * handled which will prevent default behaviour of the help button, i.e. `e.preventDefault()`.
97
95
  */
98
- inputRef?: Ref<{
99
- focus: () => void;
100
- }>;
96
+ onSyntaxHelp?: (e: MouseEvent<HTMLElement>) => boolean;
101
97
  /**
102
- * Custom components to take over the rendering of certain parts of JQL editor
98
+ * Called every time the editor is updated with the current query value and respective Jast object.
103
99
  */
104
- customComponents?: CustomComponents;
100
+ onUpdate?: (query: string, jast: Jast) => void;
101
+ /**
102
+ * The query to render in the editor.
103
+ */
104
+ query: string;
105
105
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  type Props = {
3
- expanded: boolean;
4
3
  editorId: string;
4
+ expanded: boolean;
5
5
  isDisabled?: boolean;
6
6
  label: string;
7
7
  onClick: () => void;
@@ -1,25 +1,25 @@
1
1
  import React, { type FocusEvent, type ReactNode } from 'react';
2
2
  type Props = {
3
- /**
4
- * React node to render within the footer.
5
- */
6
- EditorFooterContent: ReactNode;
7
3
  /**
8
4
  * React node to render within the editor controls group.
9
5
  */
10
6
  EditorControlsContent: ReactNode;
11
7
  /**
12
- * Flag to determine whether the editor view (or autocomplete dropdown) currently has focus.
8
+ * React node to render within the footer.
13
9
  */
14
- editorViewHasFocus: boolean;
10
+ EditorFooterContent: ReactNode;
15
11
  /**
16
- * Flag to determine whether line numbers should be shown in the editor.
12
+ * Flag to determine whether the editor view (or autocomplete dropdown) currently has focus.
17
13
  */
18
- lineNumbersVisible: boolean;
14
+ editorViewHasFocus: boolean;
19
15
  /**
20
16
  * Flag to determine if there were any JQL parse errors in the last submitted query.
21
17
  */
22
18
  editorViewIsInvalid: boolean;
19
+ /**
20
+ * Flag to determine whether line numbers should be shown in the editor.
21
+ */
22
+ lineNumbersVisible: boolean;
23
23
  /**
24
24
  * ID to assign to the main wrapper of the editor.
25
25
  */
@@ -28,6 +28,10 @@ type Props = {
28
28
  * Ref callback to the main wrapper of the editor.
29
29
  */
30
30
  onEditorMainRef?: (editorMain: HTMLElement | null) => void;
31
+ /**
32
+ * Callback when the editor view is blurred.
33
+ */
34
+ onEditorViewBlur?: () => void;
31
35
  /**
32
36
  * Ref callback to the editor view container element.
33
37
  */
@@ -36,18 +40,14 @@ type Props = {
36
40
  * Callback when the editor view is scrolled.
37
41
  */
38
42
  onEditorViewContainerScroll?: (event: React.UIEvent<HTMLElement>) => void;
39
- /**
40
- * Ref callback to the editor view element which the Prosemirror editor will be bound to.
41
- */
42
- onEditorViewRef?: (editorView: HTMLElement | null) => void;
43
- /**
44
- * Callback when the editor view is blurred.
45
- */
46
- onEditorViewBlur?: () => void;
47
43
  /**
48
44
  * Callback when the editor view is focused.
49
45
  */
50
46
  onEditorViewFocus?: (event: FocusEvent<HTMLElement>) => void;
47
+ /**
48
+ * Ref callback to the editor view element which the Prosemirror editor will be bound to.
49
+ */
50
+ onEditorViewRef?: (editorView: HTMLElement | null) => void;
51
51
  /**
52
52
  * Callback when the editor view receives a CSS transition end event.
53
53
  */
@@ -58,7 +58,7 @@ type ReadOnlyProps = {
58
58
  query: string;
59
59
  };
60
60
  export declare const JQLEditorReadOnly: ({ isSearch, isCompact, ...props }: ReadOnlyProps & {
61
- isSearch?: boolean;
62
61
  isCompact?: boolean;
62
+ isSearch?: boolean;
63
63
  }) => React.JSX.Element;
64
64
  export default JQLEditorLayout;
@@ -35,8 +35,8 @@ export declare const EditorView: import("@emotion/styled").StyledComponent<{
35
35
  } & {
36
36
  defaultMaxRows: number;
37
37
  expandedRows: number;
38
- lineNumbersVisible: boolean;
39
38
  isCompact: boolean;
39
+ lineNumbersVisible: boolean;
40
40
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
41
41
  export declare const ReadOnlyEditorView: import("@emotion/styled").StyledComponent<{
42
42
  theme?: import("@emotion/react").Theme;
@@ -44,8 +44,8 @@ export declare const ReadOnlyEditorView: import("@emotion/styled").StyledCompone
44
44
  } & {
45
45
  defaultMaxRows: number;
46
46
  expandedRows: number;
47
- lineNumbersVisible: boolean;
48
47
  isCompact: boolean;
48
+ lineNumbersVisible: boolean;
49
49
  } & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
50
50
  theme?: import("@emotion/react").Theme;
51
51
  }, {}, {}>;
@@ -53,8 +53,8 @@ export declare const EditorControls: import("@emotion/styled").StyledComponent<{
53
53
  theme?: import("@emotion/react").Theme;
54
54
  as?: React.ElementType;
55
55
  } & {
56
- isSearch: boolean;
57
56
  isCompact: boolean;
57
+ isSearch: boolean;
58
58
  isVisualRefresh?: boolean;
59
59
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
60
60
  export {};
@@ -9,30 +9,30 @@ export type PortalActions = {
9
9
  export type PortalState = {
10
10
  components: {
11
11
  [key: string]: {
12
- portalComponent: ReactNode;
13
12
  container: Container;
13
+ portalComponent: ReactNode;
14
14
  };
15
15
  };
16
16
  containers: PluginContainers;
17
17
  };
18
18
  type CreatePortalAction = {
19
- type: 'createPortal';
20
19
  payload: {
20
+ container: Container;
21
21
  key: string;
22
22
  portalComponent: ReactNode;
23
- container: Container;
24
23
  };
24
+ type: 'createPortal';
25
25
  };
26
26
  type DestroyPortalAction = {
27
- type: 'destroyPortal';
28
27
  payload: string;
28
+ type: 'destroyPortal';
29
29
  };
30
30
  type RegisterPluginContainerAction = {
31
- type: 'registerPluginContainer';
32
31
  payload: {
33
32
  containerKey: PluginContainerKey;
34
33
  element: HTMLElement | null;
35
34
  };
35
+ type: 'registerPluginContainer';
36
36
  };
37
37
  export type PortalAction = CreatePortalAction | DestroyPortalAction | RegisterPluginContainerAction;
38
38
  export {};