@atlaskit/editor-plugin-type-ahead 13.2.1 → 13.2.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.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/pm-plugins/commands/insert-type-ahead-item.js +96 -1
- package/dist/cjs/ui/ContentComponent.js +4 -0
- package/dist/cjs/ui/InputQuery.js +21 -14
- package/dist/cjs/ui/WrapperTypeAhead.js +23 -1
- package/dist/cjs/ui/hooks/use-load-items.js +6 -1
- package/dist/cjs/ui/registered-menu/PassThrough.js +10 -0
- package/dist/cjs/ui/registered-menu/RegisteredTypeAheadMenu.js +146 -0
- package/dist/cjs/ui/registered-menu/TypeAheadContext.js +8 -0
- package/dist/cjs/ui/registered-menu/TypeAheadItemRow.js +27 -0
- package/dist/cjs/ui/registered-menu/TypeAheadProvider.js +8 -0
- package/dist/cjs/ui/registered-menu/buildTypeAheadMenuModel.js +50 -0
- package/dist/cjs/ui/registered-menu/getTypeAheadItemId.js +9 -0
- package/dist/cjs/ui/registered-menu/quick-insert/TypeAheadQuickInsertItem.js +37 -0
- package/dist/cjs/ui/registered-menu/quick-insert/TypeAheadQuickInsertProvider.js +41 -0
- package/dist/cjs/ui/registered-menu/typeAheadMenuTypes.js +5 -0
- package/dist/cjs/ui/registered-menu/typeAheadSurfaces.js +26 -0
- package/dist/cjs/ui/registered-menu/useTypeAheadContext.js +15 -0
- package/dist/es2019/pm-plugins/commands/insert-type-ahead-item.js +97 -0
- package/dist/es2019/ui/ContentComponent.js +4 -0
- package/dist/es2019/ui/InputQuery.js +15 -8
- package/dist/es2019/ui/WrapperTypeAhead.js +23 -1
- package/dist/es2019/ui/hooks/use-load-items.js +6 -2
- package/dist/es2019/ui/registered-menu/PassThrough.js +3 -0
- package/dist/es2019/ui/registered-menu/RegisteredTypeAheadMenu.js +127 -0
- package/dist/es2019/ui/registered-menu/TypeAheadContext.js +2 -0
- package/dist/es2019/ui/registered-menu/TypeAheadItemRow.js +18 -0
- package/dist/es2019/ui/registered-menu/TypeAheadProvider.js +2 -0
- package/dist/es2019/ui/registered-menu/buildTypeAheadMenuModel.js +24 -0
- package/dist/es2019/ui/registered-menu/getTypeAheadItemId.js +1 -0
- package/dist/es2019/ui/registered-menu/quick-insert/TypeAheadQuickInsertItem.js +25 -0
- package/dist/es2019/ui/registered-menu/quick-insert/TypeAheadQuickInsertProvider.js +33 -0
- package/dist/es2019/ui/registered-menu/typeAheadMenuTypes.js +1 -0
- package/dist/es2019/ui/registered-menu/typeAheadSurfaces.js +20 -0
- package/dist/es2019/ui/registered-menu/useTypeAheadContext.js +9 -0
- package/dist/esm/pm-plugins/commands/insert-type-ahead-item.js +95 -0
- package/dist/esm/ui/ContentComponent.js +4 -0
- package/dist/esm/ui/InputQuery.js +21 -14
- package/dist/esm/ui/WrapperTypeAhead.js +23 -1
- package/dist/esm/ui/hooks/use-load-items.js +6 -1
- package/dist/esm/ui/registered-menu/PassThrough.js +4 -0
- package/dist/esm/ui/registered-menu/RegisteredTypeAheadMenu.js +137 -0
- package/dist/esm/ui/registered-menu/TypeAheadContext.js +2 -0
- package/dist/esm/ui/registered-menu/TypeAheadItemRow.js +19 -0
- package/dist/esm/ui/registered-menu/TypeAheadProvider.js +2 -0
- package/dist/esm/ui/registered-menu/buildTypeAheadMenuModel.js +44 -0
- package/dist/esm/ui/registered-menu/getTypeAheadItemId.js +3 -0
- package/dist/esm/ui/registered-menu/quick-insert/TypeAheadQuickInsertItem.js +28 -0
- package/dist/esm/ui/registered-menu/quick-insert/TypeAheadQuickInsertProvider.js +33 -0
- package/dist/esm/ui/registered-menu/typeAheadMenuTypes.js +1 -0
- package/dist/esm/ui/registered-menu/typeAheadSurfaces.js +20 -0
- package/dist/esm/ui/registered-menu/useTypeAheadContext.js +9 -0
- package/dist/types/pm-plugins/commands/insert-type-ahead-item.d.ts +7 -0
- package/dist/types/typeAheadPluginType.d.ts +3 -1
- package/dist/types/ui/InputQuery.d.ts +10 -2
- package/dist/types/ui/hooks/use-load-items.d.ts +1 -1
- package/dist/types/ui/registered-menu/PassThrough.d.ts +2 -0
- package/dist/types/ui/registered-menu/RegisteredTypeAheadMenu.d.ts +30 -0
- package/dist/types/ui/registered-menu/TypeAheadContext.d.ts +14 -0
- package/dist/types/ui/registered-menu/TypeAheadItemRow.d.ts +11 -0
- package/dist/types/ui/registered-menu/TypeAheadProvider.d.ts +3 -0
- package/dist/types/ui/registered-menu/buildTypeAheadMenuModel.d.ts +7 -0
- package/dist/types/ui/registered-menu/getTypeAheadItemId.d.ts +1 -0
- package/dist/types/ui/registered-menu/quick-insert/TypeAheadQuickInsertItem.d.ts +3 -0
- package/dist/types/ui/registered-menu/quick-insert/TypeAheadQuickInsertProvider.d.ts +2 -0
- package/dist/types/ui/registered-menu/typeAheadMenuTypes.d.ts +9 -0
- package/dist/types/ui/registered-menu/typeAheadSurfaces.d.ts +17 -0
- package/dist/types/ui/registered-menu/useTypeAheadContext.d.ts +2 -0
- package/package.json +8 -4
|
@@ -9,6 +9,7 @@ import type { TypeAheadItem } from '@atlaskit/editor-common/types';
|
|
|
9
9
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import { CloseSelectionOptions } from '../pm-plugins/constants';
|
|
11
11
|
type InputQueryProps = {
|
|
12
|
+
activeDescendantId?: string;
|
|
12
13
|
cancel: (props: {
|
|
13
14
|
addPrefixTrigger: boolean;
|
|
14
15
|
forceFocusOnEditor: boolean;
|
|
@@ -17,15 +18,22 @@ type InputQueryProps = {
|
|
|
17
18
|
}) => void;
|
|
18
19
|
editorView: EditorView;
|
|
19
20
|
forceFocus: boolean;
|
|
20
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @private
|
|
23
|
+
* @deprecated Pass `optionCount` instead.
|
|
24
|
+
*/
|
|
25
|
+
items?: TypeAheadItem[];
|
|
26
|
+
listId?: string;
|
|
21
27
|
onItemSelect: (mode: SelectItemMode) => void;
|
|
22
28
|
onQueryChange: (query: string) => void;
|
|
23
29
|
onQueryFocus: () => void;
|
|
24
30
|
onUndoRedo?: (inputType: 'historyUndo' | 'historyRedo') => boolean;
|
|
31
|
+
optionCount?: number;
|
|
25
32
|
reopenQuery?: string;
|
|
26
33
|
selectNextItem: () => void;
|
|
27
34
|
selectPreviousItem: () => void;
|
|
35
|
+
shouldKeepOpenOnRegisteredMenu?: boolean;
|
|
28
36
|
triggerQueryPrefix: string;
|
|
29
37
|
};
|
|
30
|
-
export declare const InputQuery: React.MemoExoticComponent<({ triggerQueryPrefix, cancel, onQueryChange, onItemSelect, selectNextItem, selectPreviousItem, forceFocus, reopenQuery, onQueryFocus, onUndoRedo, editorView, items, }: InputQueryProps) => jsx.JSX.Element>;
|
|
38
|
+
export declare const InputQuery: React.MemoExoticComponent<({ activeDescendantId, triggerQueryPrefix, cancel, onQueryChange, onItemSelect, selectNextItem, selectPreviousItem, forceFocus, reopenQuery, onQueryFocus, onUndoRedo, editorView, items, listId, optionCount, shouldKeepOpenOnRegisteredMenu, }: InputQueryProps) => jsx.JSX.Element>;
|
|
31
39
|
export {};
|
|
@@ -2,4 +2,4 @@ import type { IntlShape } from 'react-intl';
|
|
|
2
2
|
import type { ExtractInjectionAPI, TypeAheadHandler, TypeAheadItem } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import type { TypeAheadPlugin } from '../../typeAheadPluginType';
|
|
5
|
-
export declare const useLoadItems: (triggerHandler: TypeAheadHandler, editorView: EditorView, query: string, showViewMore?: boolean, api?: ExtractInjectionAPI<TypeAheadPlugin> | undefined, intl?: IntlShape) => Array<TypeAheadItem>;
|
|
5
|
+
export declare const useLoadItems: (triggerHandler: TypeAheadHandler, editorView: EditorView, query: string, showViewMore?: boolean, api?: ExtractInjectionAPI<TypeAheadPlugin> | undefined, intl?: IntlShape, enabled?: boolean) => Array<TypeAheadItem>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { CloseSelectionOptions } from '../../pm-plugins/constants';
|
|
5
|
+
import type { TypeAheadPlugin } from '../../typeAheadPluginType';
|
|
6
|
+
import type { TypeAheadSurface } from './typeAheadSurfaces';
|
|
7
|
+
type Props = {
|
|
8
|
+
anchorElement: HTMLElement;
|
|
9
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
10
|
+
cancel: (params: {
|
|
11
|
+
addPrefixTrigger: boolean;
|
|
12
|
+
forceFocusOnEditor: boolean;
|
|
13
|
+
setSelectionAt: CloseSelectionOptions;
|
|
14
|
+
text: string;
|
|
15
|
+
}) => void;
|
|
16
|
+
editorView: EditorView;
|
|
17
|
+
forceFocus: boolean;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
onUndoRedo?: (inputType: 'historyUndo' | 'historyRedo') => boolean;
|
|
20
|
+
popupsBoundariesElement?: HTMLElement;
|
|
21
|
+
popupsMountPoint?: HTMLElement;
|
|
22
|
+
popupsScrollableElement?: HTMLElement;
|
|
23
|
+
query: string;
|
|
24
|
+
reopenQuery?: string;
|
|
25
|
+
setQuery: (query: string) => void;
|
|
26
|
+
surface: TypeAheadSurface;
|
|
27
|
+
triggerHandler: TypeAheadHandler;
|
|
28
|
+
};
|
|
29
|
+
export declare const RegisteredTypeAheadMenu: ({ anchorElement, api, cancel, editorView, forceFocus, onClose, onUndoRedo, popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, query, reopenQuery, setQuery, surface, triggerHandler, }: Props) => React.JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Context } from 'react';
|
|
2
|
+
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { ExtractInjectionAPI, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import type { TypeAheadPlugin } from '../../typeAheadPluginType';
|
|
6
|
+
export type TypeAheadContextValue = {
|
|
7
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
8
|
+
editorView: EditorView;
|
|
9
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
query: string;
|
|
12
|
+
triggerHandler: TypeAheadHandler;
|
|
13
|
+
};
|
|
14
|
+
export declare const TypeAheadContext: Context<TypeAheadContextValue | null>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RegisterMenuItem } from '@atlaskit/editor-ui-control-model/types';
|
|
3
|
+
import type { TypeAheadItemComponent } from './typeAheadMenuTypes';
|
|
4
|
+
export declare const TypeAheadItemRow: ({ isSelected, itemIndex, Item, listId, onItemHover, registration, }: {
|
|
5
|
+
isSelected: boolean;
|
|
6
|
+
Item: TypeAheadItemComponent;
|
|
7
|
+
itemIndex: number;
|
|
8
|
+
listId: string;
|
|
9
|
+
onItemHover: (itemIndex: number) => void;
|
|
10
|
+
registration: RegisterMenuItem;
|
|
11
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SurfaceIdentifier } from '@atlaskit/editor-ui-control-model/surface-renderer/types';
|
|
2
|
+
import type { RegisterComponent, RegisterMenuItem } from '@atlaskit/editor-ui-control-model/types';
|
|
3
|
+
export type TypeAheadMenuModel = {
|
|
4
|
+
items: RegisterMenuItem[];
|
|
5
|
+
root: RegisterComponent | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare const buildTypeAheadMenuModel: (components: RegisterComponent[], rootComponent: SurfaceIdentifier) => TypeAheadMenuModel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getTypeAheadItemId: (listId: string, itemIndex: number) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { RegisterMenuItem } from '@atlaskit/editor-ui-control-model/types';
|
|
3
|
+
export type TypeAheadItemRenderProps = {
|
|
4
|
+
id: string;
|
|
5
|
+
isSelected: boolean;
|
|
6
|
+
onMouseMove: () => void;
|
|
7
|
+
registration: RegisterMenuItem;
|
|
8
|
+
};
|
|
9
|
+
export type TypeAheadItemComponent = React.ComponentType<TypeAheadItemRenderProps>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { MessageDescriptor } from 'react-intl';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
5
|
+
import type { TypeAheadItemComponent } from './typeAheadMenuTypes';
|
|
6
|
+
export type TypeAheadSurface = {
|
|
7
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT;
|
|
8
|
+
Item: TypeAheadItemComponent;
|
|
9
|
+
listIdPrefix: string;
|
|
10
|
+
listLabel: MessageDescriptor;
|
|
11
|
+
Provider: React.ComponentType<React.PropsWithChildren>;
|
|
12
|
+
root: {
|
|
13
|
+
key: string;
|
|
14
|
+
type: 'menu';
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare const getTypeAheadSurface: (id?: TypeAheadAvailableNodes) => TypeAheadSurface | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "13.2.
|
|
3
|
+
"version": "13.2.3",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,22 +21,25 @@
|
|
|
21
21
|
],
|
|
22
22
|
"atlaskit:src": "src/index.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@atlaskit/adf-schema": "^56.
|
|
24
|
+
"@atlaskit/adf-schema": "^56.5.0",
|
|
25
25
|
"@atlaskit/editor-plugin-analytics": "^12.1.0",
|
|
26
26
|
"@atlaskit/editor-plugin-connectivity": "^12.1.0",
|
|
27
27
|
"@atlaskit/editor-plugin-context-panel": "^14.1.0",
|
|
28
28
|
"@atlaskit/editor-plugin-metrics": "^13.1.0",
|
|
29
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^6.1.0",
|
|
29
30
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
30
31
|
"@atlaskit/editor-shared-styles": "^4.0.0",
|
|
32
|
+
"@atlaskit/editor-ui-control-model": "^2.4.0",
|
|
31
33
|
"@atlaskit/feature-gate-js-client": "^6.0.0",
|
|
32
34
|
"@atlaskit/heading": "^7.0.0",
|
|
33
35
|
"@atlaskit/insm": "^1.2.0",
|
|
34
36
|
"@atlaskit/menu": "^9.2.0",
|
|
37
|
+
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
35
38
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
36
39
|
"@atlaskit/primitives": "^22.2.0",
|
|
37
40
|
"@atlaskit/prosemirror-history": "^1.1.0",
|
|
38
41
|
"@atlaskit/prosemirror-input-rules": "^4.0.0",
|
|
39
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
42
|
+
"@atlaskit/tmp-editor-statsig": "^137.0.0",
|
|
40
43
|
"@atlaskit/tokens": "^16.3.0",
|
|
41
44
|
"@atlaskit/visually-hidden": "^4.2.0",
|
|
42
45
|
"@babel/runtime": "^7.0.0",
|
|
@@ -48,12 +51,13 @@
|
|
|
48
51
|
"w3c-keyname": "^2.1.8"
|
|
49
52
|
},
|
|
50
53
|
"peerDependencies": {
|
|
51
|
-
"@atlaskit/editor-common": "^116.
|
|
54
|
+
"@atlaskit/editor-common": "^116.51.0",
|
|
52
55
|
"react": "^18.2.0 || ^19.2.0",
|
|
53
56
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
54
57
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
55
58
|
},
|
|
56
59
|
"devDependencies": {
|
|
60
|
+
"@atlassian/testing-library": "^0.11.0",
|
|
57
61
|
"@testing-library/react": "^16.3.0",
|
|
58
62
|
"@types/react-virtualized": "^9.18.12",
|
|
59
63
|
"react": "^19.2.0",
|