@atlaskit/editor-common 103.16.1 → 103.17.1

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 (36) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/dist/cjs/element-browser/ElementBrowser.js +3 -1
  4. package/dist/cjs/element-browser/components/StatelessElementBrowser.js +11 -3
  5. package/dist/cjs/element-browser/components/ViewMore.compiled.css +11 -0
  6. package/dist/cjs/element-browser/components/ViewMore.js +51 -0
  7. package/dist/cjs/messages/insert-block.js +6 -1
  8. package/dist/cjs/monitoring/error.js +1 -1
  9. package/dist/cjs/ui/DropList/index.js +1 -1
  10. package/dist/cjs/ui/MediaSingle/index.js +2 -1
  11. package/dist/es2019/element-browser/ElementBrowser.js +3 -1
  12. package/dist/es2019/element-browser/components/StatelessElementBrowser.js +10 -2
  13. package/dist/es2019/element-browser/components/ViewMore.compiled.css +11 -0
  14. package/dist/es2019/element-browser/components/ViewMore.js +43 -0
  15. package/dist/es2019/messages/insert-block.js +6 -1
  16. package/dist/es2019/monitoring/error.js +1 -1
  17. package/dist/es2019/ui/DropList/index.js +1 -1
  18. package/dist/es2019/ui/MediaSingle/index.js +2 -1
  19. package/dist/esm/element-browser/ElementBrowser.js +3 -1
  20. package/dist/esm/element-browser/components/StatelessElementBrowser.js +10 -2
  21. package/dist/esm/element-browser/components/ViewMore.compiled.css +11 -0
  22. package/dist/esm/element-browser/components/ViewMore.js +41 -0
  23. package/dist/esm/messages/insert-block.js +6 -1
  24. package/dist/esm/monitoring/error.js +1 -1
  25. package/dist/esm/ui/DropList/index.js +1 -1
  26. package/dist/esm/ui/MediaSingle/index.js +2 -1
  27. package/dist/types/element-browser/ElementBrowser.d.ts +7 -0
  28. package/dist/types/element-browser/components/StatelessElementBrowser.d.ts +14 -0
  29. package/dist/types/element-browser/components/ViewMore.d.ts +5 -0
  30. package/dist/types/messages/insert-block.d.ts +5 -0
  31. package/dist/types-ts4.5/element-browser/ElementBrowser.d.ts +7 -0
  32. package/dist/types-ts4.5/element-browser/components/StatelessElementBrowser.d.ts +14 -0
  33. package/dist/types-ts4.5/element-browser/components/ViewMore.d.ts +5 -0
  34. package/dist/types-ts4.5/messages/insert-block.d.ts +5 -0
  35. package/i18n/package.json +17 -0
  36. package/package.json +10 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 103.17.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#146650](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/146650)
8
+ [`9074704f03590`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9074704f03590) -
9
+ add data attribute to media single component
10
+ - Updated dependencies
11
+
12
+ ## 103.17.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#142191](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/142191)
17
+ [`8a39e59bec14f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8a39e59bec14f) -
18
+ [ux] A11Y-9980: Refactored ViewMore button component to simplify usage, and updated icon and
19
+ styling alongside with adding support for aria-label.
20
+
3
21
  ## 103.16.1
4
22
 
5
23
  ### Patch Changes
@@ -125,6 +125,9 @@
125
125
  {
126
126
  "path": "../../../people-and-teams/profilecard/afm-cc/tsconfig.json"
127
127
  },
128
+ {
129
+ "path": "../../../react-ufo/atlaskit/afm-cc/tsconfig.json"
130
+ },
128
131
  {
129
132
  "path": "../../../design-system/section-message/afm-cc/tsconfig.json"
130
133
  },
@@ -121,6 +121,7 @@ var ElementBrowser = exports.default = /*#__PURE__*/function (_PureComponent) {
121
121
  mode = _this$props.mode,
122
122
  emptyStateHandler = _this$props.emptyStateHandler,
123
123
  viewMoreItem = _this$props.viewMoreItem,
124
+ onViewMore = _this$props.onViewMore,
124
125
  cache = _this$props.cache;
125
126
  var _this$state2 = this.state,
126
127
  categories = _this$state2.categories,
@@ -141,7 +142,8 @@ var ElementBrowser = exports.default = /*#__PURE__*/function (_PureComponent) {
141
142
  searchTerm: searchTerm,
142
143
  emptyStateHandler: emptyStateHandler,
143
144
  viewMoreItem: viewMoreItem,
144
- cache: cache
145
+ cache: cache,
146
+ onViewMore: onViewMore
145
147
  });
146
148
  }
147
149
  }]);
@@ -13,12 +13,14 @@ var _react2 = require("@emotion/react");
13
13
  var _reactIntlNext = require("react-intl-next");
14
14
  var _withAnalyticsContext = _interopRequireDefault(require("@atlaskit/analytics-next/withAnalyticsContext"));
15
15
  var _withAnalyticsEvents = _interopRequireDefault(require("@atlaskit/analytics-next/withAnalyticsEvents"));
16
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
17
  var _analytics = require("../../analytics");
17
18
  var _getEditorUgcToken = _interopRequireDefault(require("../../ugc-tokens/get-editor-ugc-token"));
19
+ var _ViewMore = require("../components/ViewMore");
18
20
  var _constants = require("../constants");
19
21
  var _useContainerWidth2 = _interopRequireDefault(require("../hooks/use-container-width"));
20
22
  var _useSelectAndFocusOnArrowNavigation = _interopRequireDefault(require("../hooks/use-select-and-focus-on-arrow-navigation"));
21
- var _ViewMore = require("../ViewMore");
23
+ var _ViewMore2 = require("../ViewMore");
22
24
  var _CategoryList = _interopRequireDefault(require("./CategoryList"));
23
25
  var _ElementList = _interopRequireDefault(require("./ElementList/ElementList"));
24
26
  var _ElementSearch = _interopRequireDefault(require("./ElementSearch"));
@@ -129,6 +131,7 @@ function StatelessElementBrowser(props) {
129
131
  onSelectItem = props.onSelectItem,
130
132
  onInsertItem = props.onInsertItem,
131
133
  viewMoreItem = props.viewMoreItem,
134
+ onViewMore = props.onViewMore,
132
135
  selectedCategory = props.selectedCategory,
133
136
  onSelectCategory = props.onSelectCategory,
134
137
  searchTerm = props.searchTerm,
@@ -160,7 +163,7 @@ function StatelessElementBrowser(props) {
160
163
  var _items$index$isDisabl, _items$index;
161
164
  return (_items$index$isDisabl = (_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.isDisabled) !== null && _items$index$isDisabl !== void 0 ? _items$index$isDisabl : false;
162
165
  }, [items]);
163
- var _useSelectAndFocusOnA = (0, _useSelectAndFocusOnArrowNavigation.default)(items.length - 1, columnCount, !!viewMoreItem, itemIsDisabled, isFocusSearch),
166
+ var _useSelectAndFocusOnA = (0, _useSelectAndFocusOnArrowNavigation.default)(items.length - 1, columnCount, (0, _platformFeatureFlags.fg)('platform_editor_refactor_view_more') ? !!onViewMore : !!viewMoreItem, itemIsDisabled, isFocusSearch),
164
167
  selectedItemIndex = _useSelectAndFocusOnA.selectedItemIndex,
165
168
  focusedItemIndex = _useSelectAndFocusOnA.focusedItemIndex,
166
169
  setFocusedItemIndex = _useSelectAndFocusOnA.setFocusedItemIndex,
@@ -249,6 +252,7 @@ function StatelessElementBrowser(props) {
249
252
  onKeyPress: onItemsEnterTabKeyPress,
250
253
  onKeyDown: onKeyDown,
251
254
  viewMoreItem: viewMoreItem,
255
+ onViewMore: onViewMore,
252
256
  focusOnViewMore: focusOnViewMore,
253
257
  cache: cache
254
258
  })) : (0, _react2.jsx)(DesktopBrowser
@@ -297,6 +301,7 @@ function MobileBrowser(_ref) {
297
301
  createAnalyticsEvent = _ref.createAnalyticsEvent,
298
302
  emptyStateHandler = _ref.emptyStateHandler,
299
303
  viewMoreItem = _ref.viewMoreItem,
304
+ onViewMore = _ref.onViewMore,
300
305
  cache = _ref.cache;
301
306
  return (
302
307
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
@@ -342,7 +347,10 @@ function MobileBrowser(_ref) {
342
347
  selectedCategory: selectedCategory,
343
348
  searchTerm: searchTerm,
344
349
  cache: cache
345
- })), viewMoreItem && (0, _react2.jsx)(_ViewMore.ViewMore, {
350
+ })), onViewMore && (0, _platformFeatureFlags.fg)('platform_editor_refactor_view_more') && (0, _react2.jsx)(_ViewMore.ViewMore, {
351
+ onViewMore: onViewMore,
352
+ focus: focusOnViewMore
353
+ }), viewMoreItem && !(0, _platformFeatureFlags.fg)('platform_editor_refactor_view_more') && (0, _react2.jsx)(_ViewMore2.ViewMore, {
346
354
  item: viewMoreItem,
347
355
  focus: focusOnViewMore
348
356
  }))
@@ -0,0 +1,11 @@
1
+
2
+ ._zulputpp{gap:var(--ds-space-150,9pt)}._19bvv77o{padding-left:var(--ds-space-025,2px)}
3
+ ._1bah1h6o{justify-content:center}
4
+ ._1bsbzwfg{width:2pc}
5
+ ._1e0c1txw{display:flex}
6
+ ._2hwx1b66{margin-right:var(--ds-space-050,4px)}
7
+ ._4cvr1h6o{align-items:center}
8
+ ._4t3i1tcg{height:24px}
9
+ ._ca0qv77o{padding-top:var(--ds-space-025,2px)}
10
+ ._n3tdv77o{padding-bottom:var(--ds-space-025,2px)}
11
+ ._u5f3v77o{padding-right:var(--ds-space-025,2px)}
@@ -0,0 +1,51 @@
1
+ /* ViewMore.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ "use strict";
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.ViewMore = void 0;
10
+ require("./ViewMore.compiled.css");
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var React = _react;
13
+ var _runtime = require("@compiled/react/runtime");
14
+ var _reactIntlNext = require("react-intl-next");
15
+ var _showMoreHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/show-more-horizontal"));
16
+ var _menu = require("@atlaskit/menu");
17
+ var _compiled = require("@atlaskit/primitives/compiled");
18
+ var _insertBlock = require("../../messages/insert-block");
19
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
+ var styles = {
22
+ iconContainer: "_1e0c1txw _4cvr1h6o _1bah1h6o _1bsbzwfg _4t3i1tcg _2hwx1b66",
23
+ buttonContent: "_zulputpp _1e0c1txw _4cvr1h6o _ca0qv77o _u5f3v77o _n3tdv77o _19bvv77o"
24
+ };
25
+ var ViewMore = exports.ViewMore = function ViewMore(_ref) {
26
+ var onViewMore = _ref.onViewMore,
27
+ focus = _ref.focus;
28
+ var ref = (0, _react.useRef)(null);
29
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
30
+ formatMessage = _useIntl.formatMessage;
31
+ (0, _react.useEffect)(function () {
32
+ if (ref.current && focus) {
33
+ ref.current.focus();
34
+ }
35
+ }, [focus]);
36
+ return /*#__PURE__*/React.createElement(_menu.Section, {
37
+ hasSeparator: true
38
+ }, /*#__PURE__*/React.createElement(_menu.ButtonItem, {
39
+ onClick: onViewMore,
40
+ "aria-label": formatMessage(_insertBlock.toolbarInsertBlockMessages.viewMoreAriaLabel),
41
+ "data-testid": "view-more-elements-item",
42
+ ref: ref
43
+ }, /*#__PURE__*/React.createElement("div", {
44
+ className: (0, _runtime.ax)([styles.buttonContent])
45
+ }, /*#__PURE__*/React.createElement("div", {
46
+ className: (0, _runtime.ax)([styles.iconContainer])
47
+ }, /*#__PURE__*/React.createElement(_showMoreHorizontal.default, {
48
+ label: "",
49
+ spacing: "spacious"
50
+ })), /*#__PURE__*/React.createElement(_compiled.Text, null, formatMessage(_insertBlock.toolbarInsertBlockMessages.viewMore)))));
51
+ };
@@ -199,7 +199,12 @@ var toolbarInsertBlockMessages = exports.toolbarInsertBlockMessages = (0, _react
199
199
  viewMore: {
200
200
  id: 'fabric.editor.viewMore',
201
201
  defaultMessage: 'View more',
202
- description: ''
202
+ description: 'View more elements that can be inserted'
203
+ },
204
+ viewMoreAriaLabel: {
205
+ id: 'fabric.editor.viewMoreAriaLabel',
206
+ defaultMessage: 'View all elements',
207
+ description: 'A more descriptive aria label describing that users can view all the elements to be inserted.'
203
208
  },
204
209
  insertMenu: {
205
210
  id: 'fabric.editor.insertMenu',
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "103.16.1";
20
+ var packageVersion = "103.17.1";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // Ignored via go/ees007
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
23
23
  * @jsx jsx
24
24
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "103.16.1";
26
+ var packageVersion = "103.17.1";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -12,6 +12,7 @@ var _react2 = require("@emotion/react");
12
12
  var _classnames = _interopRequireDefault(require("classnames"));
13
13
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
14
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
+ var _vcMedia = require("@atlaskit/react-ufo/vc-media");
15
16
  var _constants = require("../../media-single/constants");
16
17
  var _utils = require("../../media-single/utils");
17
18
  var _richMediaUtils = require("../../utils/rich-media-utils");
@@ -124,7 +125,7 @@ function MediaSingle(_ref) {
124
125
  })
125
126
  // Ignored via go/ees005
126
127
  // eslint-disable-next-line react/jsx-props-no-spreading
127
- }, dataAttributes), (0, _react2.jsx)(_styled.MediaWrapper, {
128
+ }, dataAttributes, (0, _platformFeatureFlags.fg)('platform_exclude_media_single_from_vc') && _vcMedia.VcMediaWrapperProps), (0, _react2.jsx)(_styled.MediaWrapper, {
128
129
  hasFallbackContainer: hasFallbackContainer,
129
130
  height: mediaWrapperHeight,
130
131
  paddingBottom: paddingBottom
@@ -89,6 +89,7 @@ export default class ElementBrowser extends PureComponent {
89
89
  mode,
90
90
  emptyStateHandler,
91
91
  viewMoreItem,
92
+ onViewMore,
92
93
  cache
93
94
  } = this.props;
94
95
  const {
@@ -111,7 +112,8 @@ export default class ElementBrowser extends PureComponent {
111
112
  searchTerm: searchTerm,
112
113
  emptyStateHandler: emptyStateHandler,
113
114
  viewMoreItem: viewMoreItem,
114
- cache: cache
115
+ cache: cache,
116
+ onViewMore: onViewMore
115
117
  });
116
118
  }
117
119
  }
@@ -10,8 +10,10 @@ import { css, jsx } from '@emotion/react';
10
10
  import { FormattedMessage } from 'react-intl-next';
11
11
  import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext';
12
12
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
13
+ import { fg } from '@atlaskit/platform-feature-flags';
13
14
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../analytics';
14
15
  import editorUGCToken from '../../ugc-tokens/get-editor-ugc-token';
16
+ import { ViewMore as ViewMoreNext } from '../components/ViewMore';
15
17
  import { DEVICE_BREAKPOINT_NUMBERS, ELEMENT_BROWSER_ID, GRID_SIZE, INLINE_SIDEBAR_HEIGHT, SIDEBAR_HEADING_WRAPPER_HEIGHT, SIDEBAR_WIDTH } from '../constants';
16
18
  import useContainerWidth from '../hooks/use-container-width';
17
19
  import useSelectAndFocusOnArrowNavigation from '../hooks/use-select-and-focus-on-arrow-navigation';
@@ -118,6 +120,7 @@ function StatelessElementBrowser(props) {
118
120
  onSelectItem,
119
121
  onInsertItem,
120
122
  viewMoreItem,
123
+ onViewMore,
121
124
  selectedCategory,
122
125
  onSelectCategory,
123
126
  searchTerm,
@@ -158,7 +161,7 @@ function StatelessElementBrowser(props) {
158
161
  focusOnViewMore,
159
162
  onKeyDown,
160
163
  setFocusOnSearch
161
- } = useSelectAndFocusOnArrowNavigation(items.length - 1, columnCount, !!viewMoreItem, itemIsDisabled, isFocusSearch);
164
+ } = useSelectAndFocusOnArrowNavigation(items.length - 1, columnCount, fg('platform_editor_refactor_view_more') ? !!onViewMore : !!viewMoreItem, itemIsDisabled, isFocusSearch);
162
165
  useEffect(() => {
163
166
  fireAnalyticsEvent(props.createAnalyticsEvent)({
164
167
  payload: {
@@ -238,6 +241,7 @@ function StatelessElementBrowser(props) {
238
241
  onKeyPress: onItemsEnterTabKeyPress,
239
242
  onKeyDown: onKeyDown,
240
243
  viewMoreItem: viewMoreItem,
244
+ onViewMore: onViewMore,
241
245
  focusOnViewMore: focusOnViewMore,
242
246
  cache: cache
243
247
  })) : jsx(DesktopBrowser
@@ -286,6 +290,7 @@ function MobileBrowser({
286
290
  createAnalyticsEvent,
287
291
  emptyStateHandler,
288
292
  viewMoreItem,
293
+ onViewMore,
289
294
  cache
290
295
  }) {
291
296
  return (
@@ -332,7 +337,10 @@ function MobileBrowser({
332
337
  selectedCategory: selectedCategory,
333
338
  searchTerm: searchTerm,
334
339
  cache: cache
335
- })), viewMoreItem && jsx(ViewMore, {
340
+ })), onViewMore && fg('platform_editor_refactor_view_more') && jsx(ViewMoreNext, {
341
+ onViewMore: onViewMore,
342
+ focus: focusOnViewMore
343
+ }), viewMoreItem && !fg('platform_editor_refactor_view_more') && jsx(ViewMore, {
336
344
  item: viewMoreItem,
337
345
  focus: focusOnViewMore
338
346
  }))
@@ -0,0 +1,11 @@
1
+
2
+ ._zulputpp{gap:var(--ds-space-150,9pt)}._19bvv77o{padding-left:var(--ds-space-025,2px)}
3
+ ._1bah1h6o{justify-content:center}
4
+ ._1bsbzwfg{width:2pc}
5
+ ._1e0c1txw{display:flex}
6
+ ._2hwx1b66{margin-right:var(--ds-space-050,4px)}
7
+ ._4cvr1h6o{align-items:center}
8
+ ._4t3i1tcg{height:24px}
9
+ ._ca0qv77o{padding-top:var(--ds-space-025,2px)}
10
+ ._n3tdv77o{padding-bottom:var(--ds-space-025,2px)}
11
+ ._u5f3v77o{padding-right:var(--ds-space-025,2px)}
@@ -0,0 +1,43 @@
1
+ /* ViewMore.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import "./ViewMore.compiled.css";
3
+ import * as React from 'react';
4
+ import { ax, ix } from "@compiled/react/runtime";
5
+ import { useEffect, useRef } from 'react';
6
+ import { useIntl } from 'react-intl-next';
7
+ import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
8
+ import { ButtonItem, Section } from '@atlaskit/menu';
9
+ import { Text } from '@atlaskit/primitives/compiled';
10
+ import { toolbarInsertBlockMessages } from '../../messages/insert-block';
11
+ const styles = {
12
+ iconContainer: "_1e0c1txw _4cvr1h6o _1bah1h6o _1bsbzwfg _4t3i1tcg _2hwx1b66",
13
+ buttonContent: "_zulputpp _1e0c1txw _4cvr1h6o _ca0qv77o _u5f3v77o _n3tdv77o _19bvv77o"
14
+ };
15
+ export const ViewMore = ({
16
+ onViewMore,
17
+ focus
18
+ }) => {
19
+ const ref = useRef(null);
20
+ const {
21
+ formatMessage
22
+ } = useIntl();
23
+ useEffect(() => {
24
+ if (ref.current && focus) {
25
+ ref.current.focus();
26
+ }
27
+ }, [focus]);
28
+ return /*#__PURE__*/React.createElement(Section, {
29
+ hasSeparator: true
30
+ }, /*#__PURE__*/React.createElement(ButtonItem, {
31
+ onClick: onViewMore,
32
+ "aria-label": formatMessage(toolbarInsertBlockMessages.viewMoreAriaLabel),
33
+ "data-testid": "view-more-elements-item",
34
+ ref: ref
35
+ }, /*#__PURE__*/React.createElement("div", {
36
+ className: ax([styles.buttonContent])
37
+ }, /*#__PURE__*/React.createElement("div", {
38
+ className: ax([styles.iconContainer])
39
+ }, /*#__PURE__*/React.createElement(ShowMoreHorizontalIcon, {
40
+ label: "",
41
+ spacing: "spacious"
42
+ })), /*#__PURE__*/React.createElement(Text, null, formatMessage(toolbarInsertBlockMessages.viewMore)))));
43
+ };
@@ -193,7 +193,12 @@ export const toolbarInsertBlockMessages = defineMessages({
193
193
  viewMore: {
194
194
  id: 'fabric.editor.viewMore',
195
195
  defaultMessage: 'View more',
196
- description: ''
196
+ description: 'View more elements that can be inserted'
197
+ },
198
+ viewMoreAriaLabel: {
199
+ id: 'fabric.editor.viewMoreAriaLabel',
200
+ defaultMessage: 'View all elements',
201
+ description: 'A more descriptive aria label describing that users can view all the elements to be inserted.'
197
202
  },
198
203
  insertMenu: {
199
204
  id: 'fabric.editor.insertMenu',
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "103.16.1";
4
+ const packageVersion = "103.17.1";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // Ignored via go/ees007
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "103.16.1";
16
+ const packageVersion = "103.17.1";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -10,6 +10,7 @@ import { jsx } from '@emotion/react';
10
10
  import classnames from 'classnames';
11
11
  import { akEditorMediaResizeHandlerPaddingWide, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
12
12
  import { fg } from '@atlaskit/platform-feature-flags';
13
+ import { VcMediaWrapperProps } from '@atlaskit/react-ufo/vc-media';
13
14
  import { MEDIA_SINGLE_GUTTER_SIZE } from '../../media-single/constants';
14
15
  import { getMediaSinglePixelWidth } from '../../media-single/utils';
15
16
  import { shouldAddDefaultWrappedWidth } from '../../utils/rich-media-utils';
@@ -109,7 +110,7 @@ export default function MediaSingle({
109
110
  })
110
111
  // Ignored via go/ees005
111
112
  // eslint-disable-next-line react/jsx-props-no-spreading
112
- }, dataAttributes), jsx(MediaWrapper, {
113
+ }, dataAttributes, fg('platform_exclude_media_single_from_vc') && VcMediaWrapperProps), jsx(MediaWrapper, {
113
114
  hasFallbackContainer: hasFallbackContainer,
114
115
  height: mediaWrapperHeight,
115
116
  paddingBottom: paddingBottom
@@ -111,6 +111,7 @@ var ElementBrowser = /*#__PURE__*/function (_PureComponent) {
111
111
  mode = _this$props.mode,
112
112
  emptyStateHandler = _this$props.emptyStateHandler,
113
113
  viewMoreItem = _this$props.viewMoreItem,
114
+ onViewMore = _this$props.onViewMore,
114
115
  cache = _this$props.cache;
115
116
  var _this$state2 = this.state,
116
117
  categories = _this$state2.categories,
@@ -131,7 +132,8 @@ var ElementBrowser = /*#__PURE__*/function (_PureComponent) {
131
132
  searchTerm: searchTerm,
132
133
  emptyStateHandler: emptyStateHandler,
133
134
  viewMoreItem: viewMoreItem,
134
- cache: cache
135
+ cache: cache,
136
+ onViewMore: onViewMore
135
137
  });
136
138
  }
137
139
  }]);
@@ -11,8 +11,10 @@ import { css, jsx } from '@emotion/react';
11
11
  import { FormattedMessage } from 'react-intl-next';
12
12
  import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext';
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
14
15
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../analytics';
15
16
  import editorUGCToken from '../../ugc-tokens/get-editor-ugc-token';
17
+ import { ViewMore as ViewMoreNext } from '../components/ViewMore';
16
18
  import { DEVICE_BREAKPOINT_NUMBERS, ELEMENT_BROWSER_ID, GRID_SIZE, INLINE_SIDEBAR_HEIGHT, SIDEBAR_HEADING_WRAPPER_HEIGHT, SIDEBAR_WIDTH } from '../constants';
17
19
  import useContainerWidth from '../hooks/use-container-width';
18
20
  import useSelectAndFocusOnArrowNavigation from '../hooks/use-select-and-focus-on-arrow-navigation';
@@ -118,6 +120,7 @@ function StatelessElementBrowser(props) {
118
120
  onSelectItem = props.onSelectItem,
119
121
  onInsertItem = props.onInsertItem,
120
122
  viewMoreItem = props.viewMoreItem,
123
+ onViewMore = props.onViewMore,
121
124
  selectedCategory = props.selectedCategory,
122
125
  onSelectCategory = props.onSelectCategory,
123
126
  searchTerm = props.searchTerm,
@@ -149,7 +152,7 @@ function StatelessElementBrowser(props) {
149
152
  var _items$index$isDisabl, _items$index;
150
153
  return (_items$index$isDisabl = (_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.isDisabled) !== null && _items$index$isDisabl !== void 0 ? _items$index$isDisabl : false;
151
154
  }, [items]);
152
- var _useSelectAndFocusOnA = useSelectAndFocusOnArrowNavigation(items.length - 1, columnCount, !!viewMoreItem, itemIsDisabled, isFocusSearch),
155
+ var _useSelectAndFocusOnA = useSelectAndFocusOnArrowNavigation(items.length - 1, columnCount, fg('platform_editor_refactor_view_more') ? !!onViewMore : !!viewMoreItem, itemIsDisabled, isFocusSearch),
153
156
  selectedItemIndex = _useSelectAndFocusOnA.selectedItemIndex,
154
157
  focusedItemIndex = _useSelectAndFocusOnA.focusedItemIndex,
155
158
  setFocusedItemIndex = _useSelectAndFocusOnA.setFocusedItemIndex,
@@ -238,6 +241,7 @@ function StatelessElementBrowser(props) {
238
241
  onKeyPress: onItemsEnterTabKeyPress,
239
242
  onKeyDown: onKeyDown,
240
243
  viewMoreItem: viewMoreItem,
244
+ onViewMore: onViewMore,
241
245
  focusOnViewMore: focusOnViewMore,
242
246
  cache: cache
243
247
  })) : jsx(DesktopBrowser
@@ -286,6 +290,7 @@ function MobileBrowser(_ref) {
286
290
  createAnalyticsEvent = _ref.createAnalyticsEvent,
287
291
  emptyStateHandler = _ref.emptyStateHandler,
288
292
  viewMoreItem = _ref.viewMoreItem,
293
+ onViewMore = _ref.onViewMore,
289
294
  cache = _ref.cache;
290
295
  return (
291
296
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
@@ -331,7 +336,10 @@ function MobileBrowser(_ref) {
331
336
  selectedCategory: selectedCategory,
332
337
  searchTerm: searchTerm,
333
338
  cache: cache
334
- })), viewMoreItem && jsx(ViewMore, {
339
+ })), onViewMore && fg('platform_editor_refactor_view_more') && jsx(ViewMoreNext, {
340
+ onViewMore: onViewMore,
341
+ focus: focusOnViewMore
342
+ }), viewMoreItem && !fg('platform_editor_refactor_view_more') && jsx(ViewMore, {
335
343
  item: viewMoreItem,
336
344
  focus: focusOnViewMore
337
345
  }))
@@ -0,0 +1,11 @@
1
+
2
+ ._zulputpp{gap:var(--ds-space-150,9pt)}._19bvv77o{padding-left:var(--ds-space-025,2px)}
3
+ ._1bah1h6o{justify-content:center}
4
+ ._1bsbzwfg{width:2pc}
5
+ ._1e0c1txw{display:flex}
6
+ ._2hwx1b66{margin-right:var(--ds-space-050,4px)}
7
+ ._4cvr1h6o{align-items:center}
8
+ ._4t3i1tcg{height:24px}
9
+ ._ca0qv77o{padding-top:var(--ds-space-025,2px)}
10
+ ._n3tdv77o{padding-bottom:var(--ds-space-025,2px)}
11
+ ._u5f3v77o{padding-right:var(--ds-space-025,2px)}
@@ -0,0 +1,41 @@
1
+ /* ViewMore.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import "./ViewMore.compiled.css";
3
+ import * as React from 'react';
4
+ import { ax, ix } from "@compiled/react/runtime";
5
+ import { useEffect, useRef } from 'react';
6
+ import { useIntl } from 'react-intl-next';
7
+ import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
8
+ import { ButtonItem, Section } from '@atlaskit/menu';
9
+ import { Text } from '@atlaskit/primitives/compiled';
10
+ import { toolbarInsertBlockMessages } from '../../messages/insert-block';
11
+ var styles = {
12
+ iconContainer: "_1e0c1txw _4cvr1h6o _1bah1h6o _1bsbzwfg _4t3i1tcg _2hwx1b66",
13
+ buttonContent: "_zulputpp _1e0c1txw _4cvr1h6o _ca0qv77o _u5f3v77o _n3tdv77o _19bvv77o"
14
+ };
15
+ export var ViewMore = function ViewMore(_ref) {
16
+ var onViewMore = _ref.onViewMore,
17
+ focus = _ref.focus;
18
+ var ref = useRef(null);
19
+ var _useIntl = useIntl(),
20
+ formatMessage = _useIntl.formatMessage;
21
+ useEffect(function () {
22
+ if (ref.current && focus) {
23
+ ref.current.focus();
24
+ }
25
+ }, [focus]);
26
+ return /*#__PURE__*/React.createElement(Section, {
27
+ hasSeparator: true
28
+ }, /*#__PURE__*/React.createElement(ButtonItem, {
29
+ onClick: onViewMore,
30
+ "aria-label": formatMessage(toolbarInsertBlockMessages.viewMoreAriaLabel),
31
+ "data-testid": "view-more-elements-item",
32
+ ref: ref
33
+ }, /*#__PURE__*/React.createElement("div", {
34
+ className: ax([styles.buttonContent])
35
+ }, /*#__PURE__*/React.createElement("div", {
36
+ className: ax([styles.iconContainer])
37
+ }, /*#__PURE__*/React.createElement(ShowMoreHorizontalIcon, {
38
+ label: "",
39
+ spacing: "spacious"
40
+ })), /*#__PURE__*/React.createElement(Text, null, formatMessage(toolbarInsertBlockMessages.viewMore)))));
41
+ };
@@ -193,7 +193,12 @@ export var toolbarInsertBlockMessages = defineMessages({
193
193
  viewMore: {
194
194
  id: 'fabric.editor.viewMore',
195
195
  defaultMessage: 'View more',
196
- description: ''
196
+ description: 'View more elements that can be inserted'
197
+ },
198
+ viewMoreAriaLabel: {
199
+ id: 'fabric.editor.viewMoreAriaLabel',
200
+ defaultMessage: 'View all elements',
201
+ description: 'A more descriptive aria label describing that users can view all the elements to be inserted.'
197
202
  },
198
203
  insertMenu: {
199
204
  id: 'fabric.editor.insertMenu',
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "103.16.1";
10
+ var packageVersion = "103.17.1";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // Ignored via go/ees007
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
20
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "103.16.1";
23
+ var packageVersion = "103.17.1";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -11,6 +11,7 @@ import { jsx } from '@emotion/react';
11
11
  import classnames from 'classnames';
12
12
  import { akEditorMediaResizeHandlerPaddingWide, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
13
13
  import { fg } from '@atlaskit/platform-feature-flags';
14
+ import { VcMediaWrapperProps } from '@atlaskit/react-ufo/vc-media';
14
15
  import { MEDIA_SINGLE_GUTTER_SIZE } from '../../media-single/constants';
15
16
  import { getMediaSinglePixelWidth } from '../../media-single/utils';
16
17
  import { shouldAddDefaultWrappedWidth } from '../../utils/rich-media-utils';
@@ -116,7 +117,7 @@ export default function MediaSingle(_ref) {
116
117
  })
117
118
  // Ignored via go/ees005
118
119
  // eslint-disable-next-line react/jsx-props-no-spreading
119
- }, dataAttributes), jsx(MediaWrapper, {
120
+ }, dataAttributes, fg('platform_exclude_media_single_from_vc') && VcMediaWrapperProps), jsx(MediaWrapper, {
120
121
  hasFallbackContainer: hasFallbackContainer,
121
122
  height: mediaWrapperHeight,
122
123
  paddingBottom: paddingBottom
@@ -13,7 +13,14 @@ export interface Props {
13
13
  showCategories: boolean;
14
14
  defaultCategory?: string;
15
15
  emptyStateHandler?: EmptyStateHandler;
16
+ /**
17
+ * @private
18
+ * @deprecated
19
+ * Deprecated in favour of onViewMore
20
+ * Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
21
+ */
16
22
  viewMoreItem?: QuickInsertItem;
23
+ onViewMore?: () => void;
17
24
  cache?: CellMeasurerCache;
18
25
  }
19
26
  export interface State {
@@ -21,7 +21,14 @@ export type StatelessElementBrowserProps = {
21
21
  mode: keyof typeof Modes;
22
22
  searchTerm?: string;
23
23
  emptyStateHandler?: EmptyStateHandler;
24
+ /**
25
+ * @private
26
+ * @deprecated
27
+ * Deprecated in favour of onViewMore
28
+ * Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
29
+ */
24
30
  viewMoreItem?: QuickInsertItem;
31
+ onViewMore?: () => void;
25
32
  cache?: CellMeasurerCache;
26
33
  } & WithAnalyticsEventsProps;
27
34
  declare const MemoizedElementBrowser: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<Omit<{
@@ -37,7 +44,14 @@ declare const MemoizedElementBrowser: React.MemoExoticComponent<React.ForwardRef
37
44
  mode: keyof typeof Modes;
38
45
  searchTerm?: string | undefined;
39
46
  emptyStateHandler?: EmptyStateHandler | undefined;
47
+ /**
48
+ * @private
49
+ * @deprecated
50
+ * Deprecated in favour of onViewMore
51
+ * Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
52
+ */
40
53
  viewMoreItem?: QuickInsertItem | undefined;
54
+ onViewMore?: (() => void) | undefined;
41
55
  cache?: CellMeasurerCache | undefined;
42
56
  }, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "ref"> & React.RefAttributes<any>>>;
43
57
  export default MemoizedElementBrowser;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const ViewMore: ({ onViewMore, focus }: {
3
+ focus: boolean;
4
+ onViewMore: () => void;
5
+ }) => JSX.Element;
@@ -194,6 +194,11 @@ export declare const toolbarInsertBlockMessages: {
194
194
  defaultMessage: string;
195
195
  description: string;
196
196
  };
197
+ viewMoreAriaLabel: {
198
+ id: string;
199
+ defaultMessage: string;
200
+ description: string;
201
+ };
197
202
  insertMenu: {
198
203
  id: string;
199
204
  defaultMessage: string;
@@ -13,7 +13,14 @@ export interface Props {
13
13
  showCategories: boolean;
14
14
  defaultCategory?: string;
15
15
  emptyStateHandler?: EmptyStateHandler;
16
+ /**
17
+ * @private
18
+ * @deprecated
19
+ * Deprecated in favour of onViewMore
20
+ * Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
21
+ */
16
22
  viewMoreItem?: QuickInsertItem;
23
+ onViewMore?: () => void;
17
24
  cache?: CellMeasurerCache;
18
25
  }
19
26
  export interface State {
@@ -21,7 +21,14 @@ export type StatelessElementBrowserProps = {
21
21
  mode: keyof typeof Modes;
22
22
  searchTerm?: string;
23
23
  emptyStateHandler?: EmptyStateHandler;
24
+ /**
25
+ * @private
26
+ * @deprecated
27
+ * Deprecated in favour of onViewMore
28
+ * Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
29
+ */
24
30
  viewMoreItem?: QuickInsertItem;
31
+ onViewMore?: () => void;
25
32
  cache?: CellMeasurerCache;
26
33
  } & WithAnalyticsEventsProps;
27
34
  declare const MemoizedElementBrowser: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<Omit<{
@@ -37,7 +44,14 @@ declare const MemoizedElementBrowser: React.MemoExoticComponent<React.ForwardRef
37
44
  mode: keyof typeof Modes;
38
45
  searchTerm?: string | undefined;
39
46
  emptyStateHandler?: EmptyStateHandler | undefined;
47
+ /**
48
+ * @private
49
+ * @deprecated
50
+ * Deprecated in favour of onViewMore
51
+ * Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
52
+ */
40
53
  viewMoreItem?: QuickInsertItem | undefined;
54
+ onViewMore?: (() => void) | undefined;
41
55
  cache?: CellMeasurerCache | undefined;
42
56
  }, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "ref"> & React.RefAttributes<any>>>;
43
57
  export default MemoizedElementBrowser;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const ViewMore: ({ onViewMore, focus }: {
3
+ focus: boolean;
4
+ onViewMore: () => void;
5
+ }) => JSX.Element;
@@ -194,6 +194,11 @@ export declare const toolbarInsertBlockMessages: {
194
194
  defaultMessage: string;
195
195
  description: string;
196
196
  };
197
+ viewMoreAriaLabel: {
198
+ id: string;
199
+ defaultMessage: string;
200
+ description: string;
201
+ };
197
202
  insertMenu: {
198
203
  id: string;
199
204
  defaultMessage: string;
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/i18n",
3
+ "main": "../dist/cjs/i18n/index.js",
4
+ "module": "../dist/esm/i18n/index.js",
5
+ "module:es2019": "../dist/es2019/i18n/index.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../dist/types/i18n/index.d.ts",
10
+ "typesVersions": {
11
+ ">=4.5 <5.4": {
12
+ "*": [
13
+ "../dist/types-ts4.5/i18n/index.d.ts"
14
+ ]
15
+ }
16
+ }
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "103.16.1",
3
+ "version": "103.17.1",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,6 +30,7 @@
30
30
  "runReact18": true
31
31
  },
32
32
  "af:exports": {
33
+ "./i18n": "./src/i18n/index.ts",
33
34
  "./prosemirror-dom-metadata": "./src/prosemirror-dom-metadata/index.ts",
34
35
  "./whitespace": "./src/whitespace/index.ts",
35
36
  "./event-dispatcher": "./src/event-dispatcher/index.ts",
@@ -139,7 +140,7 @@
139
140
  "@atlaskit/emoji": "^69.1.0",
140
141
  "@atlaskit/icon": "^25.6.0",
141
142
  "@atlaskit/icon-object": "^7.1.0",
142
- "@atlaskit/link-datasource": "^4.7.0",
143
+ "@atlaskit/link-datasource": "^4.8.0",
143
144
  "@atlaskit/link-picker": "^3.2.0",
144
145
  "@atlaskit/media-card": "^79.2.0",
145
146
  "@atlaskit/media-client": "^32.0.0",
@@ -156,6 +157,7 @@
156
157
  "@atlaskit/popper": "^7.0.0",
157
158
  "@atlaskit/primitives": "^14.4.0",
158
159
  "@atlaskit/profilecard": "^23.8.0",
160
+ "@atlaskit/react-ufo": "^3.7.0",
159
161
  "@atlaskit/section-message": "^8.2.0",
160
162
  "@atlaskit/smart-card": "^36.10.0",
161
163
  "@atlaskit/smart-user-picker": "^8.0.0",
@@ -351,6 +353,12 @@
351
353
  },
352
354
  "platform_editor_hyperlink_underline": {
353
355
  "type": "boolean"
356
+ },
357
+ "platform_editor_refactor_view_more": {
358
+ "type": "boolean"
359
+ },
360
+ "platform_exclude_media_single_from_vc": {
361
+ "type": "boolean"
354
362
  }
355
363
  }
356
364
  }