@atlaskit/editor-plugin-type-ahead 12.0.6 → 12.0.7
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 +8 -0
- package/dist/cjs/ui/TypeAheadList.js +11 -0
- package/dist/cjs/ui/hooks/build-sectioned-result.js +3 -0
- package/dist/es2019/ui/TypeAheadList.js +12 -1
- package/dist/es2019/ui/hooks/build-sectioned-result.js +3 -0
- package/dist/esm/ui/TypeAheadList.js +12 -1
- package/dist/esm/ui/hooks/build-sectioned-result.js +3 -0
- package/dist/types/types/index.d.ts +2 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 12.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`cf7797df5ff1e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cf7797df5ff1e) -
|
|
8
|
+
[ux] Add a Labs lozenge to the agent mention typeahead section.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 12.0.6
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -377,6 +377,7 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
|
377
377
|
});
|
|
378
378
|
}, [items]);
|
|
379
379
|
var config = triggerHandler === null || triggerHandler === void 0 || (_triggerHandler$getMo = triggerHandler.getMoreOptionsButtonConfig) === null || _triggerHandler$getMo === void 0 ? void 0 : _triggerHandler$getMo.call(triggerHandler, intl);
|
|
380
|
+
var shouldRenderSectionLozenge = (0, _expVal.expVal)('platform_editor_agent_mentions', 'isEnabled', false);
|
|
380
381
|
var handleClick = function handleClick() {
|
|
381
382
|
if (onMoreOptionsClicked) {
|
|
382
383
|
onMoreOptionsClicked();
|
|
@@ -401,6 +402,7 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
|
401
402
|
if (!currentRow) {
|
|
402
403
|
return null;
|
|
403
404
|
}
|
|
405
|
+
var sectionLozenge = currentRow.type === 'section' && shouldRenderSectionLozenge ? currentRow.section.lozenge : null;
|
|
404
406
|
return (0, _react2.jsx)(_CellMeasurer.CellMeasurer, {
|
|
405
407
|
key: key,
|
|
406
408
|
cache: cache,
|
|
@@ -425,11 +427,20 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
|
425
427
|
}, currentRow.type === 'section' ? (0, _react2.jsx)(_compiled.Box, {
|
|
426
428
|
paddingInline: "space.150",
|
|
427
429
|
paddingBlock: "space.050"
|
|
430
|
+
}, sectionLozenge ? (0, _react2.jsx)(_compiled.Inline, {
|
|
431
|
+
as: "span",
|
|
432
|
+
space: "space.075",
|
|
433
|
+
alignBlock: "center"
|
|
428
434
|
}, (0, _react2.jsx)(_compiled.Text, {
|
|
429
435
|
as: "span",
|
|
430
436
|
size: "small",
|
|
431
437
|
color: "color.text.subtle",
|
|
432
438
|
weight: "medium"
|
|
439
|
+
}, currentRow.section.title), sectionLozenge) : (0, _react2.jsx)(_compiled.Text, {
|
|
440
|
+
as: "span",
|
|
441
|
+
size: "small",
|
|
442
|
+
color: "color.text.subtle",
|
|
443
|
+
weight: "medium"
|
|
433
444
|
}, currentRow.section.title)) : (0, _react2.jsx)(_TypeAheadListItem.TypeAheadListItem, {
|
|
434
445
|
key: items[currentRow.itemIndex].title,
|
|
435
446
|
item: items[currentRow.itemIndex],
|
|
@@ -111,6 +111,9 @@ var buildSectionedResult = exports.buildSectionedResult = function buildSectione
|
|
|
111
111
|
startIndex: startIndex,
|
|
112
112
|
title: _section.title
|
|
113
113
|
};
|
|
114
|
+
if (_section.lozenge !== undefined) {
|
|
115
|
+
resolvedSection.lozenge = _section.lozenge;
|
|
116
|
+
}
|
|
114
117
|
if (_section.sectionTitleDisplay) {
|
|
115
118
|
resolvedSection.sectionTitleDisplay = _section.sectionTitleDisplay;
|
|
116
119
|
}
|
|
@@ -15,7 +15,7 @@ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/
|
|
|
15
15
|
import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
|
|
16
16
|
import { AssistiveText } from '@atlaskit/editor-common/ui';
|
|
17
17
|
import { MenuGroup } from '@atlaskit/menu';
|
|
18
|
-
import {
|
|
18
|
+
import { Box, Inline, Text } from '@atlaskit/primitives/compiled';
|
|
19
19
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
20
20
|
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
21
21
|
import { closeTypeAhead } from '../pm-plugins/commands/close-type-ahead';
|
|
@@ -350,6 +350,7 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
350
350
|
return items.findIndex(item => item.isDisabledOffline !== true);
|
|
351
351
|
}, [items]);
|
|
352
352
|
const config = triggerHandler === null || triggerHandler === void 0 ? void 0 : (_triggerHandler$getMo = triggerHandler.getMoreOptionsButtonConfig) === null || _triggerHandler$getMo === void 0 ? void 0 : _triggerHandler$getMo.call(triggerHandler, intl);
|
|
353
|
+
const shouldRenderSectionLozenge = expVal('platform_editor_agent_mentions', 'isEnabled', false);
|
|
353
354
|
const handleClick = () => {
|
|
354
355
|
if (onMoreOptionsClicked) {
|
|
355
356
|
onMoreOptionsClicked();
|
|
@@ -376,6 +377,7 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
376
377
|
if (!currentRow) {
|
|
377
378
|
return null;
|
|
378
379
|
}
|
|
380
|
+
const sectionLozenge = currentRow.type === 'section' && shouldRenderSectionLozenge ? currentRow.section.lozenge : null;
|
|
379
381
|
return jsx(CellMeasurer, {
|
|
380
382
|
key: key,
|
|
381
383
|
cache: cache,
|
|
@@ -398,11 +400,20 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
398
400
|
}, currentRow.type === 'section' ? jsx(Box, {
|
|
399
401
|
paddingInline: "space.150",
|
|
400
402
|
paddingBlock: "space.050"
|
|
403
|
+
}, sectionLozenge ? jsx(Inline, {
|
|
404
|
+
as: "span",
|
|
405
|
+
space: "space.075",
|
|
406
|
+
alignBlock: "center"
|
|
401
407
|
}, jsx(Text, {
|
|
402
408
|
as: "span",
|
|
403
409
|
size: "small",
|
|
404
410
|
color: "color.text.subtle",
|
|
405
411
|
weight: "medium"
|
|
412
|
+
}, currentRow.section.title), sectionLozenge) : jsx(Text, {
|
|
413
|
+
as: "span",
|
|
414
|
+
size: "small",
|
|
415
|
+
color: "color.text.subtle",
|
|
416
|
+
weight: "medium"
|
|
406
417
|
}, currentRow.section.title)) : jsx(TypeAheadListItem, {
|
|
407
418
|
key: items[currentRow.itemIndex].title,
|
|
408
419
|
item: items[currentRow.itemIndex],
|
|
@@ -68,6 +68,9 @@ export const buildSectionedResult = ({
|
|
|
68
68
|
startIndex,
|
|
69
69
|
title: section.title
|
|
70
70
|
};
|
|
71
|
+
if (section.lozenge !== undefined) {
|
|
72
|
+
resolvedSection.lozenge = section.lozenge;
|
|
73
|
+
}
|
|
71
74
|
if (section.sectionTitleDisplay) {
|
|
72
75
|
resolvedSection.sectionTitleDisplay = section.sectionTitleDisplay;
|
|
73
76
|
}
|
|
@@ -17,7 +17,7 @@ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/
|
|
|
17
17
|
import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
|
|
18
18
|
import { AssistiveText } from '@atlaskit/editor-common/ui';
|
|
19
19
|
import { MenuGroup } from '@atlaskit/menu';
|
|
20
|
-
import {
|
|
20
|
+
import { Box, Inline, Text } from '@atlaskit/primitives/compiled';
|
|
21
21
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
22
22
|
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
23
23
|
import { closeTypeAhead } from '../pm-plugins/commands/close-type-ahead';
|
|
@@ -368,6 +368,7 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
368
368
|
});
|
|
369
369
|
}, [items]);
|
|
370
370
|
var config = triggerHandler === null || triggerHandler === void 0 || (_triggerHandler$getMo = triggerHandler.getMoreOptionsButtonConfig) === null || _triggerHandler$getMo === void 0 ? void 0 : _triggerHandler$getMo.call(triggerHandler, intl);
|
|
371
|
+
var shouldRenderSectionLozenge = expVal('platform_editor_agent_mentions', 'isEnabled', false);
|
|
371
372
|
var handleClick = function handleClick() {
|
|
372
373
|
if (onMoreOptionsClicked) {
|
|
373
374
|
onMoreOptionsClicked();
|
|
@@ -392,6 +393,7 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
392
393
|
if (!currentRow) {
|
|
393
394
|
return null;
|
|
394
395
|
}
|
|
396
|
+
var sectionLozenge = currentRow.type === 'section' && shouldRenderSectionLozenge ? currentRow.section.lozenge : null;
|
|
395
397
|
return jsx(CellMeasurer, {
|
|
396
398
|
key: key,
|
|
397
399
|
cache: cache,
|
|
@@ -416,11 +418,20 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
416
418
|
}, currentRow.type === 'section' ? jsx(Box, {
|
|
417
419
|
paddingInline: "space.150",
|
|
418
420
|
paddingBlock: "space.050"
|
|
421
|
+
}, sectionLozenge ? jsx(Inline, {
|
|
422
|
+
as: "span",
|
|
423
|
+
space: "space.075",
|
|
424
|
+
alignBlock: "center"
|
|
419
425
|
}, jsx(Text, {
|
|
420
426
|
as: "span",
|
|
421
427
|
size: "small",
|
|
422
428
|
color: "color.text.subtle",
|
|
423
429
|
weight: "medium"
|
|
430
|
+
}, currentRow.section.title), sectionLozenge) : jsx(Text, {
|
|
431
|
+
as: "span",
|
|
432
|
+
size: "small",
|
|
433
|
+
color: "color.text.subtle",
|
|
434
|
+
weight: "medium"
|
|
424
435
|
}, currentRow.section.title)) : jsx(TypeAheadListItem, {
|
|
425
436
|
key: items[currentRow.itemIndex].title,
|
|
426
437
|
item: items[currentRow.itemIndex],
|
|
@@ -104,6 +104,9 @@ export var buildSectionedResult = function buildSectionedResult(_ref) {
|
|
|
104
104
|
startIndex: startIndex,
|
|
105
105
|
title: _section.title
|
|
106
106
|
};
|
|
107
|
+
if (_section.lozenge !== undefined) {
|
|
108
|
+
resolvedSection.lozenge = _section.lozenge;
|
|
109
|
+
}
|
|
107
110
|
if (_section.sectionTitleDisplay) {
|
|
108
111
|
resolvedSection.sectionTitleDisplay = _section.sectionTitleDisplay;
|
|
109
112
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
3
4
|
import type { TypeAheadHandler, TypeAheadItem, TypeAheadStats, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
|
|
@@ -47,6 +48,7 @@ export type TypeAheadPluginState = {
|
|
|
47
48
|
export type TypeAheadResolvedSection = {
|
|
48
49
|
endIndex: number;
|
|
49
50
|
id: string;
|
|
51
|
+
lozenge?: ReactNode;
|
|
50
52
|
/**
|
|
51
53
|
* Section title display rules copied from the section definition and optional runtime updates.
|
|
52
54
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.7",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@atlaskit/primitives": "^20.0.0",
|
|
37
37
|
"@atlaskit/prosemirror-history": "^1.0.0",
|
|
38
38
|
"@atlaskit/prosemirror-input-rules": "^4.0.0",
|
|
39
|
-
"@atlaskit/tmp-editor-statsig": "^109.
|
|
39
|
+
"@atlaskit/tmp-editor-statsig": "^109.2.0",
|
|
40
40
|
"@atlaskit/tokens": "^14.0.0",
|
|
41
41
|
"@atlaskit/visually-hidden": "^4.0.0",
|
|
42
42
|
"@babel/runtime": "^7.0.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"w3c-keyname": "^2.1.8"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@atlaskit/editor-common": "^116.
|
|
51
|
+
"@atlaskit/editor-common": "^116.10.0",
|
|
52
52
|
"react": "^18.2.0",
|
|
53
53
|
"react-dom": "^18.2.0",
|
|
54
54
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@types/react-virtualized": "^9.18.12",
|
|
59
59
|
"react": "^18.2.0",
|
|
60
60
|
"react-dom": "^18.2.0",
|
|
61
|
-
"react-intl": "^
|
|
61
|
+
"react-intl": "^7.0.0",
|
|
62
62
|
"wait-for-expect": "^1.2.0"
|
|
63
63
|
},
|
|
64
64
|
"techstack": {
|