@atlaskit/editor-common 74.51.6 → 74.52.0

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 (66) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/insert/index.js +1 -1
  3. package/dist/cjs/lists/analytics.js +10 -10
  4. package/dist/cjs/monitoring/error.js +1 -1
  5. package/dist/cjs/preset/editor-commands.js +36 -4
  6. package/dist/cjs/preset/index.js +6 -0
  7. package/dist/cjs/quick-insert/assets/images.js +28 -54
  8. package/dist/cjs/quick-insert/assets/mention.js +27 -9
  9. package/dist/cjs/quick-insert/index.js +20 -1
  10. package/dist/cjs/quick-insert/utils.js +79 -0
  11. package/dist/cjs/ui/DropList/index.js +1 -1
  12. package/dist/cjs/utils/dedupe.js +37 -0
  13. package/dist/cjs/utils/index.js +7 -0
  14. package/dist/es2019/insert/index.js +1 -1
  15. package/dist/es2019/lists/analytics.js +6 -6
  16. package/dist/es2019/monitoring/error.js +1 -1
  17. package/dist/es2019/preset/editor-commands.js +21 -3
  18. package/dist/es2019/preset/index.js +1 -1
  19. package/dist/es2019/quick-insert/assets/images.js +29 -53
  20. package/dist/es2019/quick-insert/assets/mention.js +28 -8
  21. package/dist/es2019/quick-insert/index.js +2 -1
  22. package/dist/es2019/quick-insert/utils.js +58 -0
  23. package/dist/es2019/ui/DropList/index.js +1 -1
  24. package/dist/es2019/utils/dedupe.js +25 -0
  25. package/dist/es2019/utils/index.js +2 -1
  26. package/dist/esm/insert/index.js +1 -1
  27. package/dist/esm/lists/analytics.js +10 -10
  28. package/dist/esm/monitoring/error.js +1 -1
  29. package/dist/esm/preset/editor-commands.js +33 -4
  30. package/dist/esm/preset/index.js +1 -1
  31. package/dist/esm/quick-insert/assets/images.js +28 -53
  32. package/dist/esm/quick-insert/assets/mention.js +27 -8
  33. package/dist/esm/quick-insert/index.js +2 -1
  34. package/dist/esm/quick-insert/utils.js +69 -0
  35. package/dist/esm/ui/DropList/index.js +1 -1
  36. package/dist/esm/utils/dedupe.js +31 -0
  37. package/dist/esm/utils/index.js +2 -1
  38. package/dist/types/insert/index.d.ts +4 -3
  39. package/dist/types/link/LinkSearch/index.d.ts +4 -4
  40. package/dist/types/link/LinkSearch/withActivityProvider.d.ts +4 -4
  41. package/dist/types/lists/analytics.d.ts +4 -4
  42. package/dist/types/preset/editor-commands.d.ts +8 -0
  43. package/dist/types/preset/index.d.ts +1 -1
  44. package/dist/types/quick-insert/index.d.ts +1 -0
  45. package/dist/types/quick-insert/utils.d.ts +12 -0
  46. package/dist/types/types/editor-command.d.ts +1 -1
  47. package/dist/types/types/index.d.ts +1 -1
  48. package/dist/types/types/quick-insert.d.ts +13 -0
  49. package/dist/types/ui/OverflowShadow/index.d.ts +4 -4
  50. package/dist/types/utils/dedupe.d.ts +1 -0
  51. package/dist/types/utils/index.d.ts +1 -0
  52. package/dist/types-ts4.5/insert/index.d.ts +4 -3
  53. package/dist/types-ts4.5/link/LinkSearch/index.d.ts +4 -4
  54. package/dist/types-ts4.5/link/LinkSearch/withActivityProvider.d.ts +4 -4
  55. package/dist/types-ts4.5/lists/analytics.d.ts +4 -4
  56. package/dist/types-ts4.5/preset/editor-commands.d.ts +8 -0
  57. package/dist/types-ts4.5/preset/index.d.ts +1 -1
  58. package/dist/types-ts4.5/quick-insert/index.d.ts +1 -0
  59. package/dist/types-ts4.5/quick-insert/utils.d.ts +12 -0
  60. package/dist/types-ts4.5/types/editor-command.d.ts +1 -1
  61. package/dist/types-ts4.5/types/index.d.ts +1 -1
  62. package/dist/types-ts4.5/types/quick-insert.d.ts +13 -0
  63. package/dist/types-ts4.5/ui/OverflowShadow/index.d.ts +4 -4
  64. package/dist/types-ts4.5/utils/dedupe.d.ts +1 -0
  65. package/dist/types-ts4.5/utils/index.d.ts +1 -0
  66. package/package.json +3 -3
@@ -1,81 +1,57 @@
1
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
2
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
1
  import React from 'react';
2
+ import { useIconThemed } from '../use-icon-themed';
4
3
  export default function IconImages() {
4
+ const {
5
+ iconThemed
6
+ } = useIconThemed();
5
7
  return /*#__PURE__*/React.createElement("svg", {
6
8
  focusable: "false",
7
9
  "aria-hidden": true,
8
10
  width: 40,
9
11
  height: 40
10
- }, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
11
- x1: "46.315%",
12
- y1: "-31.529%",
13
- x2: "50%",
14
- y2: "100%",
15
- id: "images-a"
16
- }, /*#__PURE__*/React.createElement("stop", {
17
- stopColor: "#FFD500",
18
- offset: "0%"
19
- }), /*#__PURE__*/React.createElement("stop", {
20
- stopColor: "#FFAB00",
21
- offset: "100%"
22
- })), /*#__PURE__*/React.createElement("linearGradient", {
23
- x1: "100.699%",
24
- y1: "50%",
25
- x2: "-14.52%",
26
- y2: "50%",
27
- id: "images-b"
28
- }, /*#__PURE__*/React.createElement("stop", {
29
- stopColor: "#FAFBFC",
30
- offset: "0%"
31
- }), /*#__PURE__*/React.createElement("stop", {
32
- stopColor: "#F4F6F8",
33
- stopOpacity: 0.859,
34
- offset: "12.52%"
35
- }), /*#__PURE__*/React.createElement("stop", {
36
- stopColor: "#E3E6EA",
37
- stopOpacity: 0.402,
38
- offset: "54.65%"
39
- }), /*#__PURE__*/React.createElement("stop", {
40
- stopColor: "#D7DCE1",
41
- stopOpacity: 0.113,
42
- offset: "83.66%"
43
- }), /*#__PURE__*/React.createElement("stop", {
44
- stopColor: "#D3D8DE",
45
- stopOpacity: 0,
46
- offset: "97.03%"
47
- }))), /*#__PURE__*/React.createElement("g", {
12
+ }, /*#__PURE__*/React.createElement("defs", null), /*#__PURE__*/React.createElement("g", {
48
13
  fill: "none",
49
14
  fillRule: "evenodd"
50
15
  }, /*#__PURE__*/React.createElement("path", {
51
- fill: "#FFF",
16
+ fill: iconThemed({
17
+ light: '#FFF',
18
+ dark: '#161A1D'
19
+ }),
52
20
  d: "M0 0h40v40H0z"
53
21
  }), /*#__PURE__*/React.createElement("g", {
54
22
  transform: "translate(4 9)",
55
23
  fillRule: "nonzero"
56
24
  }, /*#__PURE__*/React.createElement("rect", {
57
- fill: "url(#images-a)",
25
+ fill: iconThemed({
26
+ light: '#EBB800',
27
+ dark: '#09326C'
28
+ }),
58
29
  width: 32,
59
30
  height: 24,
60
31
  rx: 1
61
32
  }), /*#__PURE__*/React.createElement("path", {
62
- fill: "#E5E8EC",
33
+ fill: iconThemed({
34
+ light: '#F7F8F9',
35
+ dark: '#161A1D'
36
+ }),
63
37
  d: "M4 4h24v16H4z"
64
38
  }), /*#__PURE__*/React.createElement("path", {
65
- fill: "#0049B0",
39
+ fill: iconThemed({
40
+ light: '#09326C',
41
+ dark: '#09326C'
42
+ }),
66
43
  d: "M6.351 18.062l5.594-6.017 5.594 6.017z"
67
44
  }), /*#__PURE__*/React.createElement("path", {
68
- fill: "#0065FF",
45
+ fill: iconThemed({
46
+ light: '#0065FF',
47
+ dark: '#0055CC'
48
+ }),
69
49
  d: "M9.341 18.062l8.198-8.818 8.198 8.818z"
70
- }), /*#__PURE__*/React.createElement("path", {
71
- d: "M20.484 14.353c-2.618-1.255-5.104-.564-8.519-1.373C9.625 12.426 6.719 11.135 4 8v11.913h20.294c-.321-2.073-1.26-4.337-3.81-5.56z",
72
- fill: "url(#images-b)",
73
- opacity: 0.37,
74
- style: {
75
- mixBlendMode: 'screen'
76
- }
77
50
  }), /*#__PURE__*/React.createElement("ellipse", {
78
- fill: "#FFAB00",
51
+ fill: iconThemed({
52
+ light: '#F88A0D',
53
+ dark: '#B85C00'
54
+ }),
79
55
  cx: 9,
80
56
  cy: 9.028,
81
57
  rx: 2,
@@ -1,7 +1,9 @@
1
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
2
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
1
  import React from 'react';
2
+ import { useIconThemed } from '../use-icon-themed';
4
3
  export default function IconMention() {
4
+ const {
5
+ iconThemed
6
+ } = useIconThemed();
5
7
  return /*#__PURE__*/React.createElement("svg", {
6
8
  focusable: "false",
7
9
  "aria-hidden": true,
@@ -11,34 +13,52 @@ export default function IconMention() {
11
13
  fill: "none",
12
14
  fillRule: "evenodd"
13
15
  }, /*#__PURE__*/React.createElement("path", {
14
- fill: "#FFF",
16
+ fill: iconThemed({
17
+ light: '#FFF',
18
+ dark: '#161A1D'
19
+ }),
15
20
  d: "M0 0h40v40H0z"
16
21
  }), /*#__PURE__*/React.createElement("g", {
17
22
  transform: "translate(6 12)"
18
23
  }, /*#__PURE__*/React.createElement("circle", {
19
- fill: "#2684FF",
24
+ fill: iconThemed({
25
+ light: '#388BFF',
26
+ dark: '#0055CC'
27
+ }),
20
28
  cx: 8,
21
29
  cy: 8,
22
30
  r: 8
23
31
  }), /*#__PURE__*/React.createElement("path", {
24
32
  d: "M12.875 12.767A6.891 6.891 0 018.02 14.75a6.889 6.889 0 01-4.895-2.026V11.9c0-1.049.873-1.9 1.95-1.9h5.85c1.077 0 1.95.851 1.95 1.9v.867zM8 3a2.874 2.874 0 10-.001 5.748 2.874 2.874 0 000-5.748",
25
- fill: "#B3D4FF"
33
+ fill: iconThemed({
34
+ light: '#85B8FF',
35
+ dark: '#388BFF'
36
+ })
26
37
  }), /*#__PURE__*/React.createElement("rect", {
27
- fill: "#A5ADBA",
38
+ fill: iconThemed({
39
+ light: '#A4ACB9',
40
+ dark: '#A4ACB9'
41
+ }),
28
42
  x: 19,
29
43
  y: 3,
30
44
  width: 12,
31
45
  height: 1,
32
46
  rx: 0.5
33
47
  }), /*#__PURE__*/React.createElement("rect", {
34
- fill: "#A5ADBA",
48
+ fill: iconThemed({
49
+ light: '#A4ACB9',
50
+ dark: '#A4ACB9'
51
+ }),
35
52
  x: 19,
36
53
  y: 7,
37
54
  width: 6,
38
55
  height: 1,
39
56
  rx: 0.5
40
57
  }), /*#__PURE__*/React.createElement("rect", {
41
- fill: "#A5ADBA",
58
+ fill: iconThemed({
59
+ light: '#A4ACB9',
60
+ dark: '#A4ACB9'
61
+ }),
42
62
  x: 19,
43
63
  y: 11,
44
64
  width: 8,
@@ -1 +1,2 @@
1
- export { IconAction, IconCode, IconDate, IconDecision, IconDivider, IconEmoji, IconImages, IconLayout, IconLink, IconListNumber, IconList, IconMention, IconPanelError, IconPanelNote, IconPanelSuccess, IconPanelWarning, IconPanel, IconQuote, IconStatus, IconHeading, IconFeedback, IconExpand, IconCustomPanel, IconFallback, IconDatasourceJiraIssue, IconDatasourceAssetsObjects } from './assets';
1
+ export { IconAction, IconCode, IconDate, IconDecision, IconDivider, IconEmoji, IconImages, IconLayout, IconLink, IconListNumber, IconList, IconMention, IconPanelError, IconPanelNote, IconPanelSuccess, IconPanelWarning, IconPanel, IconQuote, IconStatus, IconHeading, IconFeedback, IconExpand, IconCustomPanel, IconFallback, IconDatasourceJiraIssue, IconDatasourceAssetsObjects } from './assets';
2
+ export { memoProcessQuickInsertItems, getQuickInsertSuggestions, find } from './utils';
@@ -0,0 +1,58 @@
1
+ import Fuse from 'fuse.js';
2
+ import memoizeOne from 'memoize-one';
3
+ import { dedupe } from '../utils';
4
+ const processQuickInsertItems = (items, intl) => {
5
+ return items.reduce((acc, item) => {
6
+ if (typeof item === 'function') {
7
+ const quickInsertItems = item(intl);
8
+ return acc.concat(quickInsertItems);
9
+ }
10
+ return acc.concat(item);
11
+ }, []);
12
+ };
13
+ export const memoProcessQuickInsertItems = memoizeOne(processQuickInsertItems);
14
+ const options = {
15
+ threshold: 0.3,
16
+ keys: [{
17
+ name: 'title',
18
+ weight: 0.57
19
+ }, {
20
+ name: 'priority',
21
+ weight: 0.3
22
+ }, {
23
+ name: 'keywords',
24
+ weight: 0.08
25
+ }, {
26
+ name: 'description',
27
+ weight: 0.04
28
+ }, {
29
+ name: 'keyshortcut',
30
+ weight: 0.01
31
+ }]
32
+ };
33
+ export function find(query, items) {
34
+ const fuse = new Fuse(items, options);
35
+ if (query === '') {
36
+ // Copy and sort list by priority
37
+ return items.slice(0).sort((a, b) => (a.priority || Number.POSITIVE_INFINITY) - (b.priority || Number.POSITIVE_INFINITY));
38
+ }
39
+ return fuse.search(query).map(result => result.item);
40
+ }
41
+ export const getQuickInsertSuggestions = ({
42
+ searchOptions,
43
+ lazyDefaultItems = () => [],
44
+ providedItems
45
+ }) => {
46
+ const {
47
+ query,
48
+ category,
49
+ disableDefaultItems,
50
+ featuredItems
51
+ } = searchOptions;
52
+ const defaultItems = disableDefaultItems ? [] : lazyDefaultItems();
53
+ const items = providedItems ? dedupe([...defaultItems, ...providedItems], item => item.title) : defaultItems;
54
+ if (featuredItems) {
55
+ return items.filter(item => item.featured);
56
+ }
57
+ return find(query || '', category === 'all' || !category ? items : items.filter(item => item.categories && item.categories.includes(category)));
58
+ };
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
8
8
  import { borderRadius } from '@atlaskit/theme/constants';
9
9
  import Layer from '../Layer';
10
10
  const packageName = "@atlaskit/editor-common";
11
- const packageVersion = "74.51.6";
11
+ const packageVersion = "74.52.0";
12
12
  const halfFocusRing = 1;
13
13
  const dropOffset = '0, 8';
14
14
  class DropList extends Component {
@@ -0,0 +1,25 @@
1
+ export function dedupe(list = [], iteratee = p => p) {
2
+ /**
3
+ .,
4
+ . _,'f----.._
5
+ |\ ,-'"/ | ,'
6
+ |,_ ,--. /
7
+ /,-. ,'`. (_
8
+ f o| o|__ "`-.
9
+ ,-._.,--'_ `. _.,-`
10
+ `"' ___.,'` j,-'
11
+ `-.__.,--'
12
+ Gotta go fast!
13
+ */
14
+
15
+ const seen = new Set();
16
+ list.forEach(l => seen.add(iteratee(l)));
17
+ return list.filter(l => {
18
+ const it = iteratee(l);
19
+ if (seen.has(it)) {
20
+ seen.delete(it);
21
+ return true;
22
+ }
23
+ return false;
24
+ });
25
+ }
@@ -192,4 +192,5 @@ export function isNodeEmpty(node) {
192
192
  child.isInline ? nonBlock.push(child) : block.push(child);
193
193
  });
194
194
  return !nonBlock.length && !block.filter(childNode => !!childNode.childCount && !(childNode.childCount === 1 && isEmptyParagraph(childNode.firstChild)) || childNode.isAtom).length;
195
- }
195
+ }
196
+ export { dedupe } from './dedupe';
@@ -184,7 +184,7 @@ var finaliseInsert = function finaliseInsert(tr, nodeLength) {
184
184
  };
185
185
 
186
186
  /**
187
- * Method extracted from typeahed plugin to be shared with the element browser on handling element insertion.
187
+ * Method extracted from typeahead plugin to be shared with the element browser on handling element insertion.
188
188
  */
189
189
  export var insertSelectedItem = function insertSelectedItem(maybeNode) {
190
190
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -1,9 +1,9 @@
1
1
  import { isListItemNode, isListNode } from '../utils';
2
2
  import { getListItemAttributes } from './selection';
3
- export var getCommonListAnalyticsAttributes = function getCommonListAnalyticsAttributes(state) {
4
- var _state$selection = state.selection,
5
- $from = _state$selection.$from,
6
- $to = _state$selection.$to;
3
+ export var getCommonListAnalyticsAttributes = function getCommonListAnalyticsAttributes(tr) {
4
+ var _tr$selection = tr.selection,
5
+ $from = _tr$selection.$from,
6
+ $to = _tr$selection.$to;
7
7
  var fromAttrs = getListItemAttributes($from);
8
8
  var toAttrs = getListItemAttributes($to);
9
9
  return {
@@ -11,18 +11,18 @@ export var getCommonListAnalyticsAttributes = function getCommonListAnalyticsAtt
11
11
  itemIndexAtSelectionEnd: toAttrs.itemIndex,
12
12
  indentLevelAtSelectionStart: fromAttrs.indentLevel,
13
13
  indentLevelAtSelectionEnd: toAttrs.indentLevel,
14
- itemsInSelection: countListItemsInSelection(state)
14
+ itemsInSelection: countListItemsInSelection(tr)
15
15
  };
16
16
  };
17
- export var countListItemsInSelection = function countListItemsInSelection(state) {
18
- var _state$selection2 = state.selection,
19
- from = _state$selection2.from,
20
- to = _state$selection2.to;
17
+ export var countListItemsInSelection = function countListItemsInSelection(tr) {
18
+ var _tr$selection2 = tr.selection,
19
+ from = _tr$selection2.from,
20
+ to = _tr$selection2.to;
21
21
  if (from === to) {
22
22
  return 1;
23
23
  }
24
24
  var count = 0;
25
- var listSlice = state.doc.cut(from, to);
25
+ var listSlice = tr.doc.cut(from, to);
26
26
  listSlice.content.nodesBetween(0, listSlice.content.size, function (node, pos, parent, index) {
27
27
  if (parent && isListItemNode(parent) && !isListNode(node) && index === 0) {
28
28
  count++;
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "74.51.6";
9
+ var packageVersion = "74.52.0";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -1,3 +1,11 @@
1
+ import _createClass from "@babel/runtime/helpers/createClass";
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import _inherits from "@babel/runtime/helpers/inherits";
4
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
7
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
8
+ import { Transaction } from '@atlaskit/editor-prosemirror/state';
1
9
  /**
2
10
  * Convert a EditorCommand to a standard Prosemirror Command.
3
11
  * The preferred approach to dispatching a `EditorCommand` is via the
@@ -14,10 +22,31 @@ export function editorCommandToPMCommand(command) {
14
22
  var newTr = command === null || command === void 0 ? void 0 : command({
15
23
  tr: tr
16
24
  });
17
- if (newTr) {
18
- dispatch === null || dispatch === void 0 ? void 0 : dispatch(newTr);
25
+ if (!newTr) {
26
+ return false;
27
+ }
28
+ if (newTr instanceof PassiveTransaction) {
19
29
  return true;
20
30
  }
21
- return false;
31
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch(newTr);
32
+ return true;
22
33
  };
23
- }
34
+ }
35
+
36
+ /**
37
+ * PassiveTransaction is used only to indicate that
38
+ * an `EditorCommand` should return `true` but should not dispatch.
39
+ */
40
+ export var PassiveTransaction = /*#__PURE__*/function (_Transaction) {
41
+ _inherits(PassiveTransaction, _Transaction);
42
+ var _super = _createSuper(PassiveTransaction);
43
+ // This is very cheeky but this should never be used outside its intended
44
+ // purpose - it will likely crash the editor so we should get an early warning
45
+ // signal
46
+ function PassiveTransaction() {
47
+ _classCallCheck(this, PassiveTransaction);
48
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
+ return _super.call(this, {});
50
+ }
51
+ return _createClass(PassiveTransaction);
52
+ }(Transaction);
@@ -1,3 +1,3 @@
1
1
  export { EditorPresetBuilder } from './builder';
2
2
  export { EditorPluginInjectionAPI } from './plugin-injection-api';
3
- export { editorCommandToPMCommand } from './editor-commands';
3
+ export { editorCommandToPMCommand, PassiveTransaction } from './editor-commands';
@@ -1,81 +1,56 @@
1
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
2
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
1
  import React from 'react';
2
+ import { useIconThemed } from '../use-icon-themed';
4
3
  export default function IconImages() {
4
+ var _useIconThemed = useIconThemed(),
5
+ iconThemed = _useIconThemed.iconThemed;
5
6
  return /*#__PURE__*/React.createElement("svg", {
6
7
  focusable: "false",
7
8
  "aria-hidden": true,
8
9
  width: 40,
9
10
  height: 40
10
- }, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
11
- x1: "46.315%",
12
- y1: "-31.529%",
13
- x2: "50%",
14
- y2: "100%",
15
- id: "images-a"
16
- }, /*#__PURE__*/React.createElement("stop", {
17
- stopColor: "#FFD500",
18
- offset: "0%"
19
- }), /*#__PURE__*/React.createElement("stop", {
20
- stopColor: "#FFAB00",
21
- offset: "100%"
22
- })), /*#__PURE__*/React.createElement("linearGradient", {
23
- x1: "100.699%",
24
- y1: "50%",
25
- x2: "-14.52%",
26
- y2: "50%",
27
- id: "images-b"
28
- }, /*#__PURE__*/React.createElement("stop", {
29
- stopColor: "#FAFBFC",
30
- offset: "0%"
31
- }), /*#__PURE__*/React.createElement("stop", {
32
- stopColor: "#F4F6F8",
33
- stopOpacity: 0.859,
34
- offset: "12.52%"
35
- }), /*#__PURE__*/React.createElement("stop", {
36
- stopColor: "#E3E6EA",
37
- stopOpacity: 0.402,
38
- offset: "54.65%"
39
- }), /*#__PURE__*/React.createElement("stop", {
40
- stopColor: "#D7DCE1",
41
- stopOpacity: 0.113,
42
- offset: "83.66%"
43
- }), /*#__PURE__*/React.createElement("stop", {
44
- stopColor: "#D3D8DE",
45
- stopOpacity: 0,
46
- offset: "97.03%"
47
- }))), /*#__PURE__*/React.createElement("g", {
11
+ }, /*#__PURE__*/React.createElement("defs", null), /*#__PURE__*/React.createElement("g", {
48
12
  fill: "none",
49
13
  fillRule: "evenodd"
50
14
  }, /*#__PURE__*/React.createElement("path", {
51
- fill: "#FFF",
15
+ fill: iconThemed({
16
+ light: '#FFF',
17
+ dark: '#161A1D'
18
+ }),
52
19
  d: "M0 0h40v40H0z"
53
20
  }), /*#__PURE__*/React.createElement("g", {
54
21
  transform: "translate(4 9)",
55
22
  fillRule: "nonzero"
56
23
  }, /*#__PURE__*/React.createElement("rect", {
57
- fill: "url(#images-a)",
24
+ fill: iconThemed({
25
+ light: '#EBB800',
26
+ dark: '#09326C'
27
+ }),
58
28
  width: 32,
59
29
  height: 24,
60
30
  rx: 1
61
31
  }), /*#__PURE__*/React.createElement("path", {
62
- fill: "#E5E8EC",
32
+ fill: iconThemed({
33
+ light: '#F7F8F9',
34
+ dark: '#161A1D'
35
+ }),
63
36
  d: "M4 4h24v16H4z"
64
37
  }), /*#__PURE__*/React.createElement("path", {
65
- fill: "#0049B0",
38
+ fill: iconThemed({
39
+ light: '#09326C',
40
+ dark: '#09326C'
41
+ }),
66
42
  d: "M6.351 18.062l5.594-6.017 5.594 6.017z"
67
43
  }), /*#__PURE__*/React.createElement("path", {
68
- fill: "#0065FF",
44
+ fill: iconThemed({
45
+ light: '#0065FF',
46
+ dark: '#0055CC'
47
+ }),
69
48
  d: "M9.341 18.062l8.198-8.818 8.198 8.818z"
70
- }), /*#__PURE__*/React.createElement("path", {
71
- d: "M20.484 14.353c-2.618-1.255-5.104-.564-8.519-1.373C9.625 12.426 6.719 11.135 4 8v11.913h20.294c-.321-2.073-1.26-4.337-3.81-5.56z",
72
- fill: "url(#images-b)",
73
- opacity: 0.37,
74
- style: {
75
- mixBlendMode: 'screen'
76
- }
77
49
  }), /*#__PURE__*/React.createElement("ellipse", {
78
- fill: "#FFAB00",
50
+ fill: iconThemed({
51
+ light: '#F88A0D',
52
+ dark: '#B85C00'
53
+ }),
79
54
  cx: 9,
80
55
  cy: 9.028,
81
56
  rx: 2,
@@ -1,7 +1,8 @@
1
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
2
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
1
  import React from 'react';
2
+ import { useIconThemed } from '../use-icon-themed';
4
3
  export default function IconMention() {
4
+ var _useIconThemed = useIconThemed(),
5
+ iconThemed = _useIconThemed.iconThemed;
5
6
  return /*#__PURE__*/React.createElement("svg", {
6
7
  focusable: "false",
7
8
  "aria-hidden": true,
@@ -11,34 +12,52 @@ export default function IconMention() {
11
12
  fill: "none",
12
13
  fillRule: "evenodd"
13
14
  }, /*#__PURE__*/React.createElement("path", {
14
- fill: "#FFF",
15
+ fill: iconThemed({
16
+ light: '#FFF',
17
+ dark: '#161A1D'
18
+ }),
15
19
  d: "M0 0h40v40H0z"
16
20
  }), /*#__PURE__*/React.createElement("g", {
17
21
  transform: "translate(6 12)"
18
22
  }, /*#__PURE__*/React.createElement("circle", {
19
- fill: "#2684FF",
23
+ fill: iconThemed({
24
+ light: '#388BFF',
25
+ dark: '#0055CC'
26
+ }),
20
27
  cx: 8,
21
28
  cy: 8,
22
29
  r: 8
23
30
  }), /*#__PURE__*/React.createElement("path", {
24
31
  d: "M12.875 12.767A6.891 6.891 0 018.02 14.75a6.889 6.889 0 01-4.895-2.026V11.9c0-1.049.873-1.9 1.95-1.9h5.85c1.077 0 1.95.851 1.95 1.9v.867zM8 3a2.874 2.874 0 10-.001 5.748 2.874 2.874 0 000-5.748",
25
- fill: "#B3D4FF"
32
+ fill: iconThemed({
33
+ light: '#85B8FF',
34
+ dark: '#388BFF'
35
+ })
26
36
  }), /*#__PURE__*/React.createElement("rect", {
27
- fill: "#A5ADBA",
37
+ fill: iconThemed({
38
+ light: '#A4ACB9',
39
+ dark: '#A4ACB9'
40
+ }),
28
41
  x: 19,
29
42
  y: 3,
30
43
  width: 12,
31
44
  height: 1,
32
45
  rx: 0.5
33
46
  }), /*#__PURE__*/React.createElement("rect", {
34
- fill: "#A5ADBA",
47
+ fill: iconThemed({
48
+ light: '#A4ACB9',
49
+ dark: '#A4ACB9'
50
+ }),
35
51
  x: 19,
36
52
  y: 7,
37
53
  width: 6,
38
54
  height: 1,
39
55
  rx: 0.5
40
56
  }), /*#__PURE__*/React.createElement("rect", {
41
- fill: "#A5ADBA",
57
+ fill: iconThemed({
58
+ light: '#A4ACB9',
59
+ dark: '#A4ACB9'
60
+ }),
42
61
  x: 19,
43
62
  y: 11,
44
63
  width: 8,
@@ -1 +1,2 @@
1
- export { IconAction, IconCode, IconDate, IconDecision, IconDivider, IconEmoji, IconImages, IconLayout, IconLink, IconListNumber, IconList, IconMention, IconPanelError, IconPanelNote, IconPanelSuccess, IconPanelWarning, IconPanel, IconQuote, IconStatus, IconHeading, IconFeedback, IconExpand, IconCustomPanel, IconFallback, IconDatasourceJiraIssue, IconDatasourceAssetsObjects } from './assets';
1
+ export { IconAction, IconCode, IconDate, IconDecision, IconDivider, IconEmoji, IconImages, IconLayout, IconLink, IconListNumber, IconList, IconMention, IconPanelError, IconPanelNote, IconPanelSuccess, IconPanelWarning, IconPanel, IconQuote, IconStatus, IconHeading, IconFeedback, IconExpand, IconCustomPanel, IconFallback, IconDatasourceJiraIssue, IconDatasourceAssetsObjects } from './assets';
2
+ export { memoProcessQuickInsertItems, getQuickInsertSuggestions, find } from './utils';
@@ -0,0 +1,69 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import Fuse from 'fuse.js';
3
+ import memoizeOne from 'memoize-one';
4
+ import { dedupe } from '../utils';
5
+ var processQuickInsertItems = function processQuickInsertItems(items, intl) {
6
+ return items.reduce(function (acc, item) {
7
+ if (typeof item === 'function') {
8
+ var quickInsertItems = item(intl);
9
+ return acc.concat(quickInsertItems);
10
+ }
11
+ return acc.concat(item);
12
+ }, []);
13
+ };
14
+ export var memoProcessQuickInsertItems = memoizeOne(processQuickInsertItems);
15
+ var options = {
16
+ threshold: 0.3,
17
+ keys: [{
18
+ name: 'title',
19
+ weight: 0.57
20
+ }, {
21
+ name: 'priority',
22
+ weight: 0.3
23
+ }, {
24
+ name: 'keywords',
25
+ weight: 0.08
26
+ }, {
27
+ name: 'description',
28
+ weight: 0.04
29
+ }, {
30
+ name: 'keyshortcut',
31
+ weight: 0.01
32
+ }]
33
+ };
34
+ export function find(query, items) {
35
+ var fuse = new Fuse(items, options);
36
+ if (query === '') {
37
+ // Copy and sort list by priority
38
+ return items.slice(0).sort(function (a, b) {
39
+ return (a.priority || Number.POSITIVE_INFINITY) - (b.priority || Number.POSITIVE_INFINITY);
40
+ });
41
+ }
42
+ return fuse.search(query).map(function (result) {
43
+ return result.item;
44
+ });
45
+ }
46
+ export var getQuickInsertSuggestions = function getQuickInsertSuggestions(_ref) {
47
+ var searchOptions = _ref.searchOptions,
48
+ _ref$lazyDefaultItems = _ref.lazyDefaultItems,
49
+ lazyDefaultItems = _ref$lazyDefaultItems === void 0 ? function () {
50
+ return [];
51
+ } : _ref$lazyDefaultItems,
52
+ providedItems = _ref.providedItems;
53
+ var query = searchOptions.query,
54
+ category = searchOptions.category,
55
+ disableDefaultItems = searchOptions.disableDefaultItems,
56
+ featuredItems = searchOptions.featuredItems;
57
+ var defaultItems = disableDefaultItems ? [] : lazyDefaultItems();
58
+ var items = providedItems ? dedupe([].concat(_toConsumableArray(defaultItems), _toConsumableArray(providedItems)), function (item) {
59
+ return item.title;
60
+ }) : defaultItems;
61
+ if (featuredItems) {
62
+ return items.filter(function (item) {
63
+ return item.featured;
64
+ });
65
+ }
66
+ return find(query || '', category === 'all' || !category ? items : items.filter(function (item) {
67
+ return item.categories && item.categories.includes(category);
68
+ }));
69
+ };
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
18
18
  import { borderRadius } from '@atlaskit/theme/constants';
19
19
  import Layer from '../Layer';
20
20
  var packageName = "@atlaskit/editor-common";
21
- var packageVersion = "74.51.6";
21
+ var packageVersion = "74.52.0";
22
22
  var halfFocusRing = 1;
23
23
  var dropOffset = '0, 8';
24
24
  var DropList = /*#__PURE__*/function (_Component) {