@atlaskit/editor-common 78.17.1 → 78.18.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 (117) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/analytics/package.json +1 -1
  3. package/annotation/package.json +1 -1
  4. package/card/package.json +1 -1
  5. package/clipboard/package.json +1 -1
  6. package/collab/package.json +1 -1
  7. package/commands/package.json +1 -1
  8. package/constants/package.json +1 -1
  9. package/copy-button/package.json +1 -1
  10. package/core-utils/package.json +1 -1
  11. package/dist/cjs/element-browser/components/CategoryList.js +6 -2
  12. package/dist/cjs/element-browser/components/ElementList/ElementList.js +10 -6
  13. package/dist/cjs/element-browser/components/StatelessElementBrowser.js +82 -20
  14. package/dist/cjs/extensibility/Extension/Extension/index.js +17 -12
  15. package/dist/cjs/extensibility/MultiBodiedExtension/index.js +16 -12
  16. package/dist/cjs/hooks/useSharedPluginState.js +3 -0
  17. package/dist/cjs/monitoring/error.js +1 -1
  18. package/dist/cjs/ui/DropList/index.js +1 -1
  19. package/dist/es2019/element-browser/components/CategoryList.js +6 -2
  20. package/dist/es2019/element-browser/components/ElementList/ElementList.js +10 -6
  21. package/dist/es2019/element-browser/components/StatelessElementBrowser.js +81 -99
  22. package/dist/es2019/extensibility/Extension/Extension/index.js +16 -11
  23. package/dist/es2019/extensibility/MultiBodiedExtension/index.js +15 -11
  24. package/dist/es2019/hooks/useSharedPluginState.js +5 -0
  25. package/dist/es2019/monitoring/error.js +1 -1
  26. package/dist/es2019/ui/DropList/index.js +1 -1
  27. package/dist/esm/element-browser/components/CategoryList.js +6 -2
  28. package/dist/esm/element-browser/components/ElementList/ElementList.js +10 -6
  29. package/dist/esm/element-browser/components/StatelessElementBrowser.js +81 -20
  30. package/dist/esm/extensibility/Extension/Extension/index.js +17 -12
  31. package/dist/esm/extensibility/MultiBodiedExtension/index.js +16 -12
  32. package/dist/esm/hooks/useSharedPluginState.js +3 -0
  33. package/dist/esm/monitoring/error.js +1 -1
  34. package/dist/esm/ui/DropList/index.js +1 -1
  35. package/dist/types/analytics/types/enums.d.ts +2 -2
  36. package/dist/types/annotation/index.d.ts +2 -0
  37. package/dist/types/commands/index.d.ts +3 -3
  38. package/dist/types/element-browser/components/ElementSearch.d.ts +1 -1
  39. package/dist/types/floating-toolbar/index.d.ts +1 -1
  40. package/dist/types/link/LinkSearch/LinkSearchListItem.d.ts +2 -2
  41. package/dist/types/preset/plugin-injection-api.d.ts +1 -1
  42. package/dist/types/provider-helpers/promise-helpers.d.ts +2 -2
  43. package/dist/types/styles/shared/resizer.d.ts +3 -3
  44. package/dist/types/ui/Caption/index.d.ts +2 -2
  45. package/dist/types/ui/UnsupportedBlock/index.d.ts +2 -2
  46. package/dist/types/ui/UnsupportedInline/index.d.ts +2 -2
  47. package/dist/types/ui-color/ColorPalette/index.d.ts +2 -2
  48. package/dist/types/utils/compare-props.d.ts +2 -2
  49. package/dist/types/utils/imageLoader.d.ts +1 -1
  50. package/dist/types-ts4.5/analytics/types/enums.d.ts +2 -2
  51. package/dist/types-ts4.5/annotation/index.d.ts +2 -0
  52. package/dist/types-ts4.5/commands/index.d.ts +3 -3
  53. package/dist/types-ts4.5/element-browser/components/ElementSearch.d.ts +1 -1
  54. package/dist/types-ts4.5/floating-toolbar/index.d.ts +1 -1
  55. package/dist/types-ts4.5/link/LinkSearch/LinkSearchListItem.d.ts +2 -2
  56. package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +2 -2
  57. package/dist/types-ts4.5/provider-helpers/promise-helpers.d.ts +2 -2
  58. package/dist/types-ts4.5/styles/shared/resizer.d.ts +3 -3
  59. package/dist/types-ts4.5/ui/Caption/index.d.ts +2 -2
  60. package/dist/types-ts4.5/ui/UnsupportedBlock/index.d.ts +2 -2
  61. package/dist/types-ts4.5/ui/UnsupportedInline/index.d.ts +2 -2
  62. package/dist/types-ts4.5/ui-color/ColorPalette/index.d.ts +2 -2
  63. package/dist/types-ts4.5/utils/compare-props.d.ts +2 -2
  64. package/dist/types-ts4.5/utils/imageLoader.d.ts +1 -1
  65. package/doc-utils/package.json +1 -1
  66. package/editor-analytics/package.json +1 -1
  67. package/element-browser/package.json +1 -1
  68. package/emoji/package.json +1 -1
  69. package/error-boundary/package.json +1 -1
  70. package/event-dispatcher/package.json +1 -1
  71. package/extensibility/package.json +1 -1
  72. package/extensions/package.json +1 -1
  73. package/floating-toolbar/package.json +1 -1
  74. package/guideline/package.json +1 -1
  75. package/hooks/package.json +1 -1
  76. package/icons/package.json +1 -1
  77. package/in-product/package.json +1 -1
  78. package/indentation/package.json +1 -1
  79. package/insert/package.json +1 -1
  80. package/keymaps/package.json +1 -1
  81. package/legacy-rank-plugins/package.json +1 -1
  82. package/link/package.json +1 -1
  83. package/lists/package.json +1 -1
  84. package/mark/package.json +1 -1
  85. package/media/package.json +1 -1
  86. package/media-inline/package.json +1 -1
  87. package/media-single/package.json +1 -1
  88. package/mention/package.json +1 -1
  89. package/messages/package.json +1 -1
  90. package/monitoring/package.json +1 -1
  91. package/node-width/package.json +1 -1
  92. package/normalize-feature-flags/package.json +1 -1
  93. package/package.json +4 -4
  94. package/panel/package.json +1 -1
  95. package/paste/package.json +1 -1
  96. package/portal-provider/package.json +1 -1
  97. package/preset/package.json +1 -1
  98. package/provider-factory/package.json +1 -1
  99. package/provider-helpers/package.json +1 -1
  100. package/quick-insert/package.json +1 -1
  101. package/react-node-view/package.json +1 -1
  102. package/resizer/package.json +1 -1
  103. package/safe-plugin/package.json +1 -1
  104. package/selection/package.json +1 -1
  105. package/selection-based-node-view/package.json +1 -1
  106. package/styles/package.json +1 -1
  107. package/transforms/package.json +1 -1
  108. package/type-ahead/package.json +1 -1
  109. package/types/package.json +1 -1
  110. package/ufo/package.json +1 -1
  111. package/ui/package.json +1 -1
  112. package/ui-color/package.json +1 -1
  113. package/ui-menu/package.json +1 -1
  114. package/ui-react/package.json +1 -1
  115. package/utils/package.json +1 -1
  116. package/validator/package.json +1 -1
  117. package/with-plugin-state/package.json +1 -1
@@ -5,109 +5,86 @@ import { css, jsx } from '@emotion/react';
5
5
  import { FormattedMessage } from 'react-intl-next';
6
6
  import { withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
7
7
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../analytics';
8
- import { DEVICE_BREAKPOINT_NUMBERS, GRID_SIZE, INLINE_SIDEBAR_HEIGHT, SIDEBAR_HEADING_PADDING_LEFT, SIDEBAR_HEADING_WRAPPER_HEIGHT, SIDEBAR_WIDTH } from '../constants';
8
+ import { DEVICE_BREAKPOINT_NUMBERS, GRID_SIZE, INLINE_SIDEBAR_HEIGHT, SIDEBAR_HEADING_WRAPPER_HEIGHT, SIDEBAR_WIDTH } from '../constants';
9
9
  import useContainerWidth from '../hooks/use-container-width';
10
10
  import useSelectAndFocusOnArrowNavigation from '../hooks/use-select-and-focus-on-arrow-navigation';
11
11
  import { ViewMore } from '../ViewMore';
12
12
  import CategoryList from './CategoryList';
13
13
  import ElementList from './ElementList/ElementList';
14
14
  import ElementSearch from './ElementSearch';
15
- const wrapper = css`
16
- width: 100%;
17
- max-height: inherit;
18
- overflow: hidden;
19
- `;
20
- const baseBrowserContainerStyles = css`
21
- display: flex;
22
- height: 100%;
23
- /** Needed for Safari to work with current css.
24
- * 100% heights wont work and
25
- * will default to auto if one of the containers doesn't have a specified height in pixels.
26
- * Setting the min-height to fill available fits safari's needs and the above 100% height works on the rest of the browsers.
27
- */
28
-
29
- /* TODO: fix in develop: https://atlassian.slack.com/archives/CFG3PSQ9E/p1647395052443259?thread_ts=1647394572.556029&cid=CFG3PSQ9E */
30
-
31
- /* stylelint-disable-next-line */
32
- min-height: -webkit-fill-available;
33
- `;
34
- const mobileElementBrowserContainer = css`
35
- ${baseBrowserContainerStyles};
36
- flex-direction: column;
37
- `;
38
- const elementBrowserContainer = css`
39
- ${baseBrowserContainerStyles};
40
- flex-direction: row;
41
- `;
42
- const baseSidebarStyles = css`
43
- display: flex;
44
- flex-direction: column;
45
-
46
- overflow-x: auto;
47
- overflow-y: hidden;
48
- `;
49
- const mobileSideBar = css`
50
- ${baseSidebarStyles};
51
- flex: 0 0 ${INLINE_SIDEBAR_HEIGHT};
52
- padding: ${"var(--ds-space-150, 12px)"} ${"var(--ds-space-150, 12px)"} 0
53
- ${"var(--ds-space-150, 12px)"};
54
- `;
55
- const mobileSideBarShowCategories = css`
56
- flex: 0 0 auto;
57
- `;
58
- const sideBar = css`
59
- ${baseSidebarStyles};
60
- flex: 0 0 'auto';
61
- `;
62
- const sideBarShowCategories = css`
63
- ${baseSidebarStyles};
64
- flex: 0 0 ${SIDEBAR_WIDTH};
65
- `;
66
- const sidebarHeading = css`
67
- flex: 0 0 ${SIDEBAR_HEADING_WRAPPER_HEIGHT};
68
- display: inline-flex;
69
- align-items: center;
70
- padding-left: ${SIDEBAR_HEADING_PADDING_LEFT};
71
- font-weight: 700;
72
- `;
73
- const mobileMainContent = css`
74
- flex: 1 1 auto;
75
-
76
- display: flex;
77
- flex-direction: column;
78
-
79
- overflow-y: auto;
80
- height: 100%;
81
- `;
82
- const mainContent = css`
83
- ${mobileMainContent}
84
- margin-left: ${GRID_SIZE * 2}px;
85
- // Needed for safari
86
- height: auto;
87
- `;
88
- const searchContainer = css`
89
- padding-bottom: ${GRID_SIZE * 2}px;
90
- `;
91
- const mobileCategoryListWrapper = css`
92
- display: flex;
93
- overflow-x: auto;
94
-
95
- padding: ${GRID_SIZE}px 0 ${GRID_SIZE * 2}px 0;
96
- min-height: ${GRID_SIZE * 4}px;
97
-
98
- overflow: -moz-scrollbars-none;
99
- ::-webkit-scrollbar {
100
- display: none;
101
- }
102
- scrollbar-width: none;
103
- -ms-overflow-style: none;
104
- `;
105
- const categoryListWrapper = css`
106
- ${mobileCategoryListWrapper}
107
- padding: 0;
108
- margin-top: ${GRID_SIZE * 3}px;
109
- flex-direction: column;
110
- `;
15
+ const wrapper = css({
16
+ width: '100%',
17
+ maxHeight: 'inherit',
18
+ overflow: 'hidden'
19
+ });
20
+ const baseBrowserContainerStyles = css({
21
+ display: 'flex',
22
+ height: '100%',
23
+ minHeight: '-webkit-fill-available'
24
+ });
25
+ const mobileElementBrowserContainer = css(baseBrowserContainerStyles, {
26
+ flexDirection: 'column'
27
+ });
28
+ const elementBrowserContainer = css(baseBrowserContainerStyles, {
29
+ flexDirection: 'row'
30
+ });
31
+ const baseSidebarStyles = css({
32
+ display: 'flex',
33
+ flexDirection: 'column',
34
+ overflowX: 'auto',
35
+ overflowY: 'hidden'
36
+ });
37
+ const mobileSideBar = css(baseSidebarStyles, {
38
+ flex: `0 0 ${INLINE_SIDEBAR_HEIGHT}`,
39
+ padding: `${"var(--ds-space-150, 12px)"} ${"var(--ds-space-150, 12px)"} 0 ${"var(--ds-space-150, 12px)"}`
40
+ });
41
+ const mobileSideBarShowCategories = css({
42
+ flex: '0 0 auto'
43
+ });
44
+ const sideBar = css(baseSidebarStyles, {
45
+ flex: "0 0 'auto'"
46
+ });
47
+ const sideBarShowCategories = css(baseSidebarStyles, {
48
+ flex: `0 0 ${SIDEBAR_WIDTH}`
49
+ });
50
+ const sidebarHeading = css({
51
+ flex: `0 0 ${SIDEBAR_HEADING_WRAPPER_HEIGHT}`,
52
+ display: 'inline-flex',
53
+ alignItems: 'center',
54
+ paddingLeft: "var(--ds-space-150, 12px)",
55
+ fontWeight: 700
56
+ });
57
+ const mobileMainContent = css({
58
+ flex: '1 1 auto',
59
+ display: 'flex',
60
+ flexDirection: 'column',
61
+ overflowY: 'auto',
62
+ height: '100%'
63
+ });
64
+ const mainContent = css(mobileMainContent, {
65
+ marginLeft: "var(--ds-space-200, 16px)",
66
+ height: 'auto'
67
+ });
68
+ const searchContainer = css({
69
+ paddingBottom: "var(--ds-space-200, 16px)"
70
+ });
71
+ const mobileCategoryListWrapper = css({
72
+ display: 'flex',
73
+ overflowX: 'auto',
74
+ padding: `${"var(--ds-space-200, 8px)"} 0 ${"var(--ds-space-200, 16px)"} 0`,
75
+ minHeight: `${GRID_SIZE * 4}px`,
76
+ overflow: '-moz-scrollbars-none',
77
+ '::-webkit-scrollbar': {
78
+ display: 'none'
79
+ },
80
+ scrollbarWidth: 'none',
81
+ MsOverflowStyle: 'none'
82
+ });
83
+ const categoryListWrapper = css(mobileCategoryListWrapper, {
84
+ padding: 0,
85
+ marginTop: "var(--ds-space-200, 24px)",
86
+ flexDirection: 'column'
87
+ });
111
88
  function StatelessElementBrowser(props) {
112
89
  const {
113
90
  items,
@@ -296,12 +273,15 @@ function DesktopBrowser({
296
273
  css: showCategories ? sideBarShowCategories : sideBar
297
274
  }, jsx("h2", {
298
275
  css: sidebarHeading,
299
- "data-testid": "sidebar-heading"
276
+ "data-testid": "sidebar-heading",
277
+ id: "sidebar-heading"
300
278
  }, jsx(FormattedMessage, {
301
279
  id: "fabric.editor.elementbrowser.sidebar.heading",
302
280
  defaultMessage: "Browse",
303
281
  description: "Sidebar heading"
304
282
  })), jsx("nav", {
283
+ role: "tablist",
284
+ "aria-labelledby": "sidebar-heading",
305
285
  css: categoryListWrapper
306
286
  }, jsx(CategoryList, {
307
287
  categories: categories,
@@ -312,7 +292,9 @@ function DesktopBrowser({
312
292
  css: mainContent,
313
293
  onKeyDown: onKeyDown,
314
294
  "data-testid": "main-content"
315
- }, showSearch && jsx("div", {
295
+ }, showSearch &&
296
+ // eslint-disable-next-line
297
+ jsx("div", {
316
298
  css: searchContainer
317
299
  }, jsx(ElementSearch, {
318
300
  onSearch: onSearch,
@@ -162,18 +162,23 @@ const widthPluginKey = {
162
162
  }
163
163
  };
164
164
  const ExtensionDeprecated = props => {
165
- return jsx(WithPluginState, {
166
- editorView: props.view,
167
- plugins: {
168
- widthState: widthPluginKey
169
- },
170
- render: ({
171
- widthState
172
- }) => jsx(ExtensionWithPluginState, _extends({
173
- widthState: widthState
174
- }, props))
175
- });
165
+ return (
166
+ // @ts-ignore - 'WithPluginState' cannot be used as a JSX component.
167
+ // This error was introduced after upgrading to TypeScript 5
168
+ jsx(WithPluginState, {
169
+ editorView: props.view,
170
+ plugins: {
171
+ widthState: widthPluginKey
172
+ },
173
+ render: ({
174
+ widthState
175
+ }) => jsx(ExtensionWithPluginState, _extends({
176
+ widthState: widthState
177
+ }, props))
178
+ })
179
+ );
176
180
  };
181
+
177
182
  /**
178
183
  * End workaround
179
184
  */
@@ -188,17 +188,21 @@ const widthPluginKey = {
188
188
  }
189
189
  };
190
190
  const MultiBodiedExtensionDeprecated = props => {
191
- return jsx(WithPluginState, {
192
- editorView: props.editorView,
193
- plugins: {
194
- widthState: widthPluginKey
195
- },
196
- render: ({
197
- widthState
198
- }) => jsx(MultiBodiedExtensionWithWidth, _extends({
199
- widthState: widthState
200
- }, props))
201
- });
191
+ return (
192
+ // @ts-ignore - 'WithPluginState' cannot be used as a JSX component.
193
+ // This error was introduced after upgrading to TypeScript 5
194
+ jsx(WithPluginState, {
195
+ editorView: props.editorView,
196
+ plugins: {
197
+ widthState: widthPluginKey
198
+ },
199
+ render: ({
200
+ widthState
201
+ }) => jsx(MultiBodiedExtensionWithWidth, _extends({
202
+ widthState: widthState
203
+ }, props))
204
+ })
205
+ );
202
206
  };
203
207
  /**
204
208
  * End workaround
@@ -91,8 +91,13 @@ export function useSharedPluginState(injectionApi, plugins) {
91
91
  // Create a memoized object containing the named plugins
92
92
  const namedExternalPlugins = useMemo(() => pluginNames.reduce((acc, pluginName) => ({
93
93
  ...acc,
94
+ // @ts-expect-error - Implicit conversion of a 'symbol' to a 'string' will fail at runtime. Consider wrapping this expression in 'String(...)'
95
+ // This error was introduced after upgrading to TypeScript 5
94
96
  [`${pluginName}State`]: injectionApi === null || injectionApi === void 0 ? void 0 : injectionApi[pluginName]
95
97
  }), {}), [injectionApi, pluginNames]);
98
+
99
+ // @ts-expect-error - Type '`${K}State`' is not assignable to type '`${K}State`'. Two different types with this name exist, but they are unrelated.
100
+ // This error was introduced after upgrading to TypeScript 5
96
101
  return useSharedPluginStateInternal(namedExternalPlugins);
97
102
  }
98
103
  function useSharedPluginStateInternal(externalPlugins) {
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "78.17.1";
3
+ const packageVersion = "78.18.0";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
7
7
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
8
8
  import Layer from '../Layer';
9
9
  const packageName = "@atlaskit/editor-common";
10
- const packageVersion = "78.17.1";
10
+ const packageVersion = "78.18.0";
11
11
  const halfFocusRing = 1;
12
12
  const dropOffset = '0, 8';
13
13
  class DropList extends Component {
@@ -45,7 +45,6 @@ function CategoryListItem(_ref2) {
45
45
  var ref = useFocus(focus);
46
46
  var onClick = useCallback(function () {
47
47
  onSelectCategory(category);
48
-
49
48
  /**
50
49
  * When user double clicks on same category, focus on first item.
51
50
  */
@@ -85,13 +84,18 @@ function CategoryListItem(_ref2) {
85
84
  }, rest);
86
85
  }, [category.name, selectedCategory]);
87
86
  return jsx("div", {
88
- css: buttonWrapper
87
+ css: buttonWrapper,
88
+ role: "presentation"
89
89
  }, jsx(Button, {
90
90
  appearance: "subtle",
91
91
  isSelected: selectedCategory === category.name,
92
92
  onClick: onClick,
93
93
  onFocus: onFocus,
94
94
  theme: getTheme,
95
+ role: "tab",
96
+ "aria-selected": selectedCategory === category.name ? 'true' : 'false',
97
+ "aria-controls": "browse-category-".concat(category.name, "-tab"),
98
+ id: "browse-category--".concat(category.name, "-button"),
95
99
  ref: ref,
96
100
  testId: "element-browser-category-item"
97
101
  }, category.title));
@@ -103,16 +103,20 @@ function ElementList(_ref) {
103
103
  }, props)));
104
104
  };
105
105
  }, [items, fullMode, selectedItemIndex, focusedItemIndex, props]);
106
- return jsx(Fragment, null, jsx(ContainerWidthMonitor, null), !items.length ? emptyStateHandler ? emptyStateHandler({
106
+ return jsx(Fragment, null, jsx(ContainerWidthMonitor, null), jsx("div", {
107
+ css: elementItemsWrapper,
108
+ "data-testid": "element-items",
109
+ id: selectedCategory ? "browse-category-".concat(selectedCategory, "-tab") : 'browse-category-tab',
110
+ "aria-labelledby": selectedCategory ? "browse-category--".concat(selectedCategory, "-button") : 'browse-category-button',
111
+ role: "tabpanel",
112
+ tabIndex: items.length === 0 ? 0 : undefined
113
+ }, !items.length ? emptyStateHandler ? emptyStateHandler({
107
114
  mode: mode,
108
115
  selectedCategory: selectedCategory,
109
116
  searchTerm: searchTerm
110
117
  }) : jsx(EmptyState, {
111
118
  onExternalLinkClick: onExternalLinkClick
112
- }) : jsx("div", {
113
- css: elementItemsWrapper,
114
- "data-testid": "element-items"
115
- }, jsx(Fragment, null, containerWidth > 0 && jsx(AutoSizer, {
119
+ }) : jsx(Fragment, null, containerWidth > 0 && jsx(AutoSizer, {
116
120
  disableWidth: true
117
121
  }, function (_ref3) {
118
122
  var height = _ref3.height;
@@ -258,7 +262,7 @@ var elementItemWrapper = css({
258
262
  button: {
259
263
  height: '75px',
260
264
  alignItems: 'flex-start',
261
- padding: "var(--ds-space-150, 12px)"
265
+ padding: "var(--ds-space-150, 12px)".concat(" ", "var(--ds-space-150, 12px)", " 11px")
262
266
  }
263
267
  }
264
268
  });
@@ -1,35 +1,91 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
4
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
5
3
  /** @jsx jsx */
6
4
  import React, { memo, useCallback, useEffect, useState } from 'react';
7
5
  import { css, jsx } from '@emotion/react';
8
6
  import { FormattedMessage } from 'react-intl-next';
9
7
  import { withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
10
8
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../analytics';
11
- import { DEVICE_BREAKPOINT_NUMBERS, GRID_SIZE, INLINE_SIDEBAR_HEIGHT, SIDEBAR_HEADING_PADDING_LEFT, SIDEBAR_HEADING_WRAPPER_HEIGHT, SIDEBAR_WIDTH } from '../constants';
9
+ import { DEVICE_BREAKPOINT_NUMBERS, GRID_SIZE, INLINE_SIDEBAR_HEIGHT, SIDEBAR_HEADING_WRAPPER_HEIGHT, SIDEBAR_WIDTH } from '../constants';
12
10
  import useContainerWidth from '../hooks/use-container-width';
13
11
  import useSelectAndFocusOnArrowNavigation from '../hooks/use-select-and-focus-on-arrow-navigation';
14
12
  import { ViewMore } from '../ViewMore';
15
13
  import CategoryList from './CategoryList';
16
14
  import ElementList from './ElementList/ElementList';
17
15
  import ElementSearch from './ElementSearch';
18
- var wrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n max-height: inherit;\n overflow: hidden;\n"])));
19
- var baseBrowserContainerStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n height: 100%;\n /** Needed for Safari to work with current css.\n * 100% heights wont work and\n * will default to auto if one of the containers doesn't have a specified height in pixels.\n * Setting the min-height to fill available fits safari's needs and the above 100% height works on the rest of the browsers.\n */\n\n /* TODO: fix in develop: https://atlassian.slack.com/archives/CFG3PSQ9E/p1647395052443259?thread_ts=1647394572.556029&cid=CFG3PSQ9E */\n\n /* stylelint-disable-next-line */\n min-height: -webkit-fill-available;\n"])));
20
- var mobileElementBrowserContainer = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", ";\n flex-direction: column;\n"])), baseBrowserContainerStyles);
21
- var elementBrowserContainer = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n flex-direction: row;\n"])), baseBrowserContainerStyles);
22
- var baseSidebarStyles = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n\n overflow-x: auto;\n overflow-y: hidden;\n"])));
23
- var mobileSideBar = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 ", ";\n padding: ", " ", " 0\n ", ";\n"])), baseSidebarStyles, INLINE_SIDEBAR_HEIGHT, "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)");
24
- var mobileSideBarShowCategories = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n flex: 0 0 auto;\n"])));
25
- var sideBar = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 'auto';\n"])), baseSidebarStyles);
26
- var sideBarShowCategories = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 ", ";\n"])), baseSidebarStyles, SIDEBAR_WIDTH);
27
- var sidebarHeading = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n flex: 0 0 ", ";\n display: inline-flex;\n align-items: center;\n padding-left: ", ";\n font-weight: 700;\n"])), SIDEBAR_HEADING_WRAPPER_HEIGHT, SIDEBAR_HEADING_PADDING_LEFT);
28
- var mobileMainContent = css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n\n display: flex;\n flex-direction: column;\n\n overflow-y: auto;\n height: 100%;\n"])));
29
- var mainContent = css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n ", "\n margin-left: ", "px;\n // Needed for safari\n height: auto;\n"])), mobileMainContent, GRID_SIZE * 2);
30
- var searchContainer = css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n padding-bottom: ", "px;\n"])), GRID_SIZE * 2);
31
- var mobileCategoryListWrapper = css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n display: flex;\n overflow-x: auto;\n\n padding: ", "px 0 ", "px 0;\n min-height: ", "px;\n\n overflow: -moz-scrollbars-none;\n ::-webkit-scrollbar {\n display: none;\n }\n scrollbar-width: none;\n -ms-overflow-style: none;\n"])), GRID_SIZE, GRID_SIZE * 2, GRID_SIZE * 4);
32
- var categoryListWrapper = css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n ", "\n padding: 0;\n margin-top: ", "px;\n flex-direction: column;\n"])), mobileCategoryListWrapper, GRID_SIZE * 3);
16
+ var wrapper = css({
17
+ width: '100%',
18
+ maxHeight: 'inherit',
19
+ overflow: 'hidden'
20
+ });
21
+ var baseBrowserContainerStyles = css({
22
+ display: 'flex',
23
+ height: '100%',
24
+ minHeight: '-webkit-fill-available'
25
+ });
26
+ var mobileElementBrowserContainer = css(baseBrowserContainerStyles, {
27
+ flexDirection: 'column'
28
+ });
29
+ var elementBrowserContainer = css(baseBrowserContainerStyles, {
30
+ flexDirection: 'row'
31
+ });
32
+ var baseSidebarStyles = css({
33
+ display: 'flex',
34
+ flexDirection: 'column',
35
+ overflowX: 'auto',
36
+ overflowY: 'hidden'
37
+ });
38
+ var mobileSideBar = css(baseSidebarStyles, {
39
+ flex: "0 0 ".concat(INLINE_SIDEBAR_HEIGHT),
40
+ padding: "var(--ds-space-150, 12px)".concat(" ", "var(--ds-space-150, 12px)", " 0 ", "var(--ds-space-150, 12px)")
41
+ });
42
+ var mobileSideBarShowCategories = css({
43
+ flex: '0 0 auto'
44
+ });
45
+ var sideBar = css(baseSidebarStyles, {
46
+ flex: "0 0 'auto'"
47
+ });
48
+ var sideBarShowCategories = css(baseSidebarStyles, {
49
+ flex: "0 0 ".concat(SIDEBAR_WIDTH)
50
+ });
51
+ var sidebarHeading = css({
52
+ flex: "0 0 ".concat(SIDEBAR_HEADING_WRAPPER_HEIGHT),
53
+ display: 'inline-flex',
54
+ alignItems: 'center',
55
+ paddingLeft: "var(--ds-space-150, 12px)",
56
+ fontWeight: 700
57
+ });
58
+ var mobileMainContent = css({
59
+ flex: '1 1 auto',
60
+ display: 'flex',
61
+ flexDirection: 'column',
62
+ overflowY: 'auto',
63
+ height: '100%'
64
+ });
65
+ var mainContent = css(mobileMainContent, {
66
+ marginLeft: "var(--ds-space-200, 16px)",
67
+ height: 'auto'
68
+ });
69
+ var searchContainer = css({
70
+ paddingBottom: "var(--ds-space-200, 16px)"
71
+ });
72
+ var mobileCategoryListWrapper = css({
73
+ display: 'flex',
74
+ overflowX: 'auto',
75
+ padding: "var(--ds-space-200, 8px)".concat(" 0 ", "var(--ds-space-200, 16px)", " 0"),
76
+ minHeight: "".concat(GRID_SIZE * 4, "px"),
77
+ overflow: '-moz-scrollbars-none',
78
+ '::-webkit-scrollbar': {
79
+ display: 'none'
80
+ },
81
+ scrollbarWidth: 'none',
82
+ MsOverflowStyle: 'none'
83
+ });
84
+ var categoryListWrapper = css(mobileCategoryListWrapper, {
85
+ padding: 0,
86
+ marginTop: "var(--ds-space-200, 24px)",
87
+ flexDirection: 'column'
88
+ });
33
89
  function StatelessElementBrowser(props) {
34
90
  var items = props.items,
35
91
  onSelectItem = props.onSelectItem,
@@ -215,12 +271,15 @@ function DesktopBrowser(_ref2) {
215
271
  css: showCategories ? sideBarShowCategories : sideBar
216
272
  }, jsx("h2", {
217
273
  css: sidebarHeading,
218
- "data-testid": "sidebar-heading"
274
+ "data-testid": "sidebar-heading",
275
+ id: "sidebar-heading"
219
276
  }, jsx(FormattedMessage, {
220
277
  id: "fabric.editor.elementbrowser.sidebar.heading",
221
278
  defaultMessage: "Browse",
222
279
  description: "Sidebar heading"
223
280
  })), jsx("nav", {
281
+ role: "tablist",
282
+ "aria-labelledby": "sidebar-heading",
224
283
  css: categoryListWrapper
225
284
  }, jsx(CategoryList, {
226
285
  categories: categories,
@@ -231,7 +290,9 @@ function DesktopBrowser(_ref2) {
231
290
  css: mainContent,
232
291
  onKeyDown: onKeyDown,
233
292
  "data-testid": "main-content"
234
- }, showSearch && jsx("div", {
293
+ }, showSearch &&
294
+ // eslint-disable-next-line
295
+ jsx("div", {
235
296
  css: searchContainer
236
297
  }, jsx(ElementSearch, {
237
298
  onSearch: onSearch,
@@ -156,19 +156,24 @@ var widthPluginKey = {
156
156
  }
157
157
  };
158
158
  var ExtensionDeprecated = function ExtensionDeprecated(props) {
159
- return jsx(WithPluginState, {
160
- editorView: props.view,
161
- plugins: {
162
- widthState: widthPluginKey
163
- },
164
- render: function render(_ref) {
165
- var widthState = _ref.widthState;
166
- return jsx(ExtensionWithPluginState, _extends({
167
- widthState: widthState
168
- }, props));
169
- }
170
- });
159
+ return (
160
+ // @ts-ignore - 'WithPluginState' cannot be used as a JSX component.
161
+ // This error was introduced after upgrading to TypeScript 5
162
+ jsx(WithPluginState, {
163
+ editorView: props.view,
164
+ plugins: {
165
+ widthState: widthPluginKey
166
+ },
167
+ render: function render(_ref) {
168
+ var widthState = _ref.widthState;
169
+ return jsx(ExtensionWithPluginState, _extends({
170
+ widthState: widthState
171
+ }, props));
172
+ }
173
+ })
174
+ );
171
175
  };
176
+
172
177
  /**
173
178
  * End workaround
174
179
  */
@@ -188,18 +188,22 @@ var widthPluginKey = {
188
188
  }
189
189
  };
190
190
  var MultiBodiedExtensionDeprecated = function MultiBodiedExtensionDeprecated(props) {
191
- return jsx(WithPluginState, {
192
- editorView: props.editorView,
193
- plugins: {
194
- widthState: widthPluginKey
195
- },
196
- render: function render(_ref2) {
197
- var widthState = _ref2.widthState;
198
- return jsx(MultiBodiedExtensionWithWidth, _extends({
199
- widthState: widthState
200
- }, props));
201
- }
202
- });
191
+ return (
192
+ // @ts-ignore - 'WithPluginState' cannot be used as a JSX component.
193
+ // This error was introduced after upgrading to TypeScript 5
194
+ jsx(WithPluginState, {
195
+ editorView: props.editorView,
196
+ plugins: {
197
+ widthState: widthPluginKey
198
+ },
199
+ render: function render(_ref2) {
200
+ var widthState = _ref2.widthState;
201
+ return jsx(MultiBodiedExtensionWithWidth, _extends({
202
+ widthState: widthState
203
+ }, props));
204
+ }
205
+ })
206
+ );
203
207
  };
204
208
  /**
205
209
  * End workaround
@@ -102,6 +102,9 @@ export function useSharedPluginState(injectionApi, plugins) {
102
102
  return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, "".concat(pluginName, "State"), injectionApi === null || injectionApi === void 0 ? void 0 : injectionApi[pluginName]));
103
103
  }, {});
104
104
  }, [injectionApi, pluginNames]);
105
+
106
+ // @ts-expect-error - Type '`${K}State`' is not assignable to type '`${K}State`'. Two different types with this name exist, but they are unrelated.
107
+ // This error was introduced after upgrading to TypeScript 5
105
108
  return useSharedPluginStateInternal(namedExternalPlugins);
106
109
  }
107
110
  function useSharedPluginStateInternal(externalPlugins) {
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
6
  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; }
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 = "78.17.1";
9
+ var packageVersion = "78.18.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
@@ -17,7 +17,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
17
17
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
18
18
  import Layer from '../Layer';
19
19
  var packageName = "@atlaskit/editor-common";
20
- var packageVersion = "78.17.1";
20
+ var packageVersion = "78.18.0";
21
21
  var halfFocusRing = 1;
22
22
  var dropOffset = '0, 8';
23
23
  var DropList = /*#__PURE__*/function (_Component) {
@@ -174,8 +174,8 @@ export declare enum INPUT_METHOD {
174
174
  }
175
175
  export declare enum TRIGGER_METHOD {
176
176
  BUTTON = "button",
177
- KEYBOARD = "keyboard",
178
- SHORTCUT = "shortcut",
177
+ KEYBOARD = "keyboard",// single key, e.g. Esc, Enter
178
+ SHORTCUT = "shortcut",// combination of keys, e.g. Mod + F
179
179
  TOOLBAR = "toolbar"
180
180
  }
181
181
  export declare enum ACTION_SUBJECT {
@@ -1,4 +1,6 @@
1
+ /// <reference path="../../../../../../typings/events.d.ts" />
1
2
  /// <reference types="node" />
3
+ /// <reference types="node/events" />
2
4
  import { EventEmitter } from 'events';
3
5
  export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve' | 'setselectedannotation';
4
6
  export type VisibilityEvent = 'setvisibility';