@atlaskit/editor-common 128.0.1 → 128.2.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 (49) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/cjs/extensions/buildMenuItem.js +1 -0
  3. package/dist/cjs/messages/syncBlock.js +5 -0
  4. package/dist/cjs/monitoring/error.js +1 -1
  5. package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.js +13 -4
  6. package/dist/cjs/quick-insert/ElementBrowserQuickInsertMenuItem.js +2 -1
  7. package/dist/cjs/quick-insert/QuickInsertHoverPreview.compiled.css +5 -0
  8. package/dist/cjs/quick-insert/QuickInsertHoverPreview.js +73 -28
  9. package/dist/cjs/quick-insert/QuickInsertMenuItem.js +7 -0
  10. package/dist/cjs/quick-insert/SkillTag.compiled.css +9 -0
  11. package/dist/cjs/quick-insert/SkillTag.js +44 -0
  12. package/dist/cjs/styles/shared/table.js +3 -5
  13. package/dist/cjs/ui/DropList/index.js +1 -1
  14. package/dist/es2019/extensions/buildMenuItem.js +1 -0
  15. package/dist/es2019/messages/syncBlock.js +5 -0
  16. package/dist/es2019/monitoring/error.js +1 -1
  17. package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.js +13 -4
  18. package/dist/es2019/quick-insert/ElementBrowserQuickInsertMenuItem.js +2 -1
  19. package/dist/es2019/quick-insert/QuickInsertHoverPreview.compiled.css +5 -0
  20. package/dist/es2019/quick-insert/QuickInsertHoverPreview.js +65 -20
  21. package/dist/es2019/quick-insert/QuickInsertMenuItem.js +7 -0
  22. package/dist/es2019/quick-insert/SkillTag.compiled.css +9 -0
  23. package/dist/es2019/quick-insert/SkillTag.js +35 -0
  24. package/dist/es2019/styles/shared/table.js +3 -5
  25. package/dist/es2019/ui/DropList/index.js +1 -1
  26. package/dist/esm/extensions/buildMenuItem.js +1 -0
  27. package/dist/esm/messages/syncBlock.js +5 -0
  28. package/dist/esm/monitoring/error.js +1 -1
  29. package/dist/esm/quick-insert/CompactQuickInsertMenuItem.js +13 -4
  30. package/dist/esm/quick-insert/ElementBrowserQuickInsertMenuItem.js +2 -1
  31. package/dist/esm/quick-insert/QuickInsertHoverPreview.compiled.css +5 -0
  32. package/dist/esm/quick-insert/QuickInsertHoverPreview.js +64 -20
  33. package/dist/esm/quick-insert/QuickInsertMenuItem.js +7 -0
  34. package/dist/esm/quick-insert/SkillTag.compiled.css +9 -0
  35. package/dist/esm/quick-insert/SkillTag.js +37 -0
  36. package/dist/esm/styles/shared/table.js +3 -5
  37. package/dist/esm/ui/DropList/index.js +1 -1
  38. package/dist/types/extensions/types/utils.d.ts +1 -0
  39. package/dist/types/messages/syncBlock.d.ts +5 -0
  40. package/dist/types/quick-insert/CompactQuickInsertMenuItem.d.ts +1 -1
  41. package/dist/types/quick-insert/ElementBrowserQuickInsertMenuItem.d.ts +1 -1
  42. package/dist/types/quick-insert/QuickInsertContext.d.ts +3 -0
  43. package/dist/types/quick-insert/QuickInsertHoverPreview.d.ts +10 -1
  44. package/dist/types/quick-insert/QuickInsertMenuItem.d.ts +7 -1
  45. package/dist/types/quick-insert/SkillTag.d.ts +6 -0
  46. package/dist/types/styles/shared/table.d.ts +3 -5
  47. package/dist/types/types/feature-flags.d.ts +10 -0
  48. package/package.json +10 -10
  49. package/quick-insert/skill-tag/package.json +10 -0
@@ -1,16 +1,17 @@
1
1
  /* QuickInsertHoverPreview.tsx generated by @compiled/babel-plugin v3.0.2 */
2
2
  import "./QuickInsertHoverPreview.compiled.css";
3
- import * as React from 'react';
4
3
  import { ax, ix } from "@compiled/react/runtime";
5
- import { useLayoutEffect, useState } from 'react';
4
+ import React, { useLayoutEffect, useState } from 'react';
6
5
  import { createPortal } from 'react-dom';
7
6
 
8
7
  // Viewport calculations and multiline clamping require styles outside @atlaskit/css's schema.
9
8
 
9
+ import { bind } from 'bind-event-listener';
10
10
  import { useIntl } from 'react-intl';
11
-
12
11
  // Viewport clamping requires modifiers, which the top-layer adapter does not support.
13
12
  import { Popper } from '@atlaskit/popper/react-popper';
13
+ import { Box } from '@atlaskit/primitives/compiled/box';
14
+ import { Inline } from '@atlaskit/primitives/compiled/inline';
14
15
  import { Text } from '@atlaskit/primitives/compiled/text';
15
16
  import { useThemeObserver } from '@atlaskit/tokens/use-theme-observer';
16
17
  import { messages } from './messages';
@@ -38,25 +39,36 @@ const PREVIEW_MODIFIERS = [{
38
39
  rootBoundary: 'viewport'
39
40
  }
40
41
  }];
42
+ const layoutStyles = {
43
+ titleRow: "_1ul9idpf",
44
+ titleIcon: "_4cvr1h6o _1e0c1txw _1o9zidpf _1bah1h6o",
45
+ attributionText: "_16jlkb7n _1o9zkb7n _i0dl1wug _1ul9idpf _1i4qfg65"
46
+ };
41
47
  const styles = {
42
48
  positioner: "_c71lk6is _p12f1oec _1pby16oo",
43
49
  panel: "_2rko1qi0 _1reo15vq _18m915vq _1rjcutpp _18zrutpp _vchhusvi _bfhk1bhr _16qs130s _c71l1kw7 _p12f1osq _1bsbncxg",
44
50
  content: "_zulpu2gc _1e0c1txw _2lx21bp4",
45
- title: "_11c81qyo _1reo15vq _18m915vq _syazazsu _1i4qfg65 _1e0ccj1k _sudp1e54 _1yyjcs5v",
51
+ title: "_11c81qyo _16jlkb7n _1o9zkb7n _i0dl1wug _1reo15vq _18m915vq _syazazsu _1ul9idpf _1i4qfg65 _1e0ccj1k _sudp1e54 _1yyjcs5v",
52
+ unclampedTitle: "_11c8fhey _16jlkb7n _1o9zkb7n _i0dl1wug _syazi7uo _k48pwu06 _1ul9idpf _1i4qfg65",
46
53
  description: "_11c8fhey _1reo15vq _18m915vq _syazi7uo _1e0ccj1k _1i4qfg65 _sudp1e54 _1yyjegat",
54
+ unclampedDescription: "_11c8fhey _syazi7uo _1i4qfg65",
47
55
  imageArea: "_2rko12b0 _1reo15vq _18m915vq _bfhkhfxm _4t3i68cl _6rthu2gc _p12f1osq _1bsbp3fh",
48
56
  image: "_1e0c1ule _4t3i1osq _5ral1f51 _1bsb1osq",
49
57
  imageHidden: "_3um015vq",
50
- attribution: "_11c8wadc _zulp1b66 _4cvr1h6o _syazazsu _1e0c1txw _1i4qfg65",
58
+ attribution: "_zulp1b66 _4cvr1h6o _syazazsu _1e0c1txw _1i4qfg65",
59
+ compactAttribution: "_11c8wadc",
51
60
  attributionIcon: "_16jlidpf _1o9zidpf _i0dlexct _4cvr1h6o _1e0c1txw _4t3i7vkz _1bah1h6o _1bsb7vkz"
52
61
  };
53
62
 
54
63
  /** The selected item's description and attribution are announced through its aria-describedby. */
55
64
  export const QuickInsertHoverPreview = ({
56
65
  description,
66
+ icon,
57
67
  id,
58
68
  preview,
69
+ popupsMountPoint,
59
70
  referenceElement,
71
+ shouldClampText = true,
60
72
  title
61
73
  }) => {
62
74
  const {
@@ -64,10 +76,11 @@ export const QuickInsertHoverPreview = ({
64
76
  } = useThemeObserver();
65
77
  const imageUrl = preview.image ? colorMode === 'dark' && preview.image.dark ? preview.image.dark : preview.image.light : undefined;
66
78
  const hasAccessibleContent = Boolean(description || preview.attribution);
79
+ const portalTarget = popupsMountPoint !== null && popupsMountPoint !== void 0 ? popupsMountPoint : referenceElement.ownerDocument.body;
67
80
  return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(Popper, {
68
81
  placement: "right-start",
69
82
  referenceElement: referenceElement,
70
- strategy: "fixed",
83
+ strategy: popupsMountPoint ? 'absolute' : 'fixed',
71
84
  modifiers: PREVIEW_MODIFIERS
72
85
  }, ({
73
86
  ref,
@@ -79,20 +92,26 @@ export const QuickInsertHoverPreview = ({
79
92
  className: ax([styles.positioner])
80
93
  }, /*#__PURE__*/React.createElement(QuickInsertPreviewPanel, {
81
94
  description: description,
95
+ icon: icon,
82
96
  id: hasAccessibleContent ? id : undefined,
83
97
  imageUrl: imageUrl,
84
98
  preview: preview,
99
+ popupsMountPoint: popupsMountPoint,
85
100
  referenceElement: referenceElement,
101
+ shouldClampText: shouldClampText,
86
102
  title: title,
87
103
  update: update
88
- }))), referenceElement.ownerDocument.body);
104
+ }))), portalTarget);
89
105
  };
90
106
  const QuickInsertPreviewPanel = ({
91
107
  description,
108
+ icon,
92
109
  id,
93
110
  imageUrl,
94
111
  preview,
112
+ popupsMountPoint,
95
113
  referenceElement,
114
+ shouldClampText,
96
115
  title,
97
116
  update
98
117
  }) => {
@@ -105,43 +124,69 @@ const QuickInsertPreviewPanel = ({
105
124
  const attributionName = (_preview$attribution2 = preview.attribution) === null || _preview$attribution2 === void 0 ? void 0 : _preview$attribution2.name;
106
125
  const formattedAttributionName = typeof attributionName === 'string' ? attributionName : attributionName ? formatMessage(attributionName) : '';
107
126
  useLayoutEffect(() => {
108
- var _referenceElement$own;
127
+ var _ownerDocument$defaul;
109
128
  void update();
110
- const ResizeObserverConstructor = (_referenceElement$own = referenceElement.ownerDocument.defaultView) === null || _referenceElement$own === void 0 ? void 0 : _referenceElement$own.ResizeObserver;
129
+ const {
130
+ ownerDocument
131
+ } = referenceElement;
132
+ const onScroll = () => void update();
133
+ const unbindScrollListener = bind(ownerDocument, {
134
+ type: 'scroll',
135
+ listener: onScroll,
136
+ options: true
137
+ });
138
+ const ResizeObserverConstructor = (_ownerDocument$defaul = ownerDocument.defaultView) === null || _ownerDocument$defaul === void 0 ? void 0 : _ownerDocument$defaul.ResizeObserver;
111
139
  if (!panelElement || !ResizeObserverConstructor) {
112
- return;
140
+ return unbindScrollListener;
113
141
  }
114
142
  const observer = new ResizeObserverConstructor(() => void update());
115
143
  observer.observe(panelElement);
116
- return () => observer.disconnect();
117
- }, [panelElement, referenceElement, update]);
144
+ observer.observe(referenceElement);
145
+ if (popupsMountPoint) {
146
+ observer.observe(popupsMountPoint);
147
+ }
148
+ return () => {
149
+ unbindScrollListener();
150
+ observer.disconnect();
151
+ };
152
+ }, [panelElement, popupsMountPoint, referenceElement, update]);
118
153
  return /*#__PURE__*/React.createElement("div", {
119
154
  ref: setPanelElement,
120
155
  id: id,
121
156
  role: id ? 'tooltip' : undefined,
122
157
  "data-testid": "quick-insert-preview-panel",
123
158
  className: ax([styles.panel])
124
- }, imageUrl && /*#__PURE__*/React.createElement(PreviewImage, {
159
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, imageUrl && /*#__PURE__*/React.createElement(PreviewImage, {
125
160
  key: imageUrl,
126
161
  imageUrl: imageUrl
127
162
  }), /*#__PURE__*/React.createElement("div", {
128
163
  className: ax([styles.content])
129
- }, /*#__PURE__*/React.createElement("div", {
164
+ }, /*#__PURE__*/React.createElement(Inline, {
165
+ alignBlock: "center",
166
+ space: "space.100",
167
+ xcss: layoutStyles.titleRow,
168
+ "aria-hidden": "true"
169
+ }, icon && /*#__PURE__*/React.createElement(Box, {
170
+ as: "span",
130
171
  "aria-hidden": "true",
131
- className: ax([styles.title])
132
- }, title), description && /*#__PURE__*/React.createElement("div", {
133
- className: ax([styles.description])
172
+ xcss: layoutStyles.titleIcon
173
+ }, icon), /*#__PURE__*/React.createElement("span", {
174
+ className: ax([shouldClampText && styles.title, !shouldClampText && styles.unclampedTitle])
175
+ }, title)), description && /*#__PURE__*/React.createElement("div", {
176
+ className: ax([shouldClampText && styles.description, !shouldClampText && styles.unclampedDescription])
134
177
  }, description), preview.attribution && /*#__PURE__*/React.createElement("div", {
135
- className: ax([styles.attribution])
178
+ className: ax([styles.attribution, shouldClampText && styles.compactAttribution])
136
179
  }, AttributionIcon && /*#__PURE__*/React.createElement("span", {
137
180
  "aria-hidden": "true",
138
181
  className: ax([styles.attributionIcon])
139
- }, /*#__PURE__*/React.createElement(AttributionIcon, null)), /*#__PURE__*/React.createElement(Text, {
182
+ }, /*#__PURE__*/React.createElement(AttributionIcon, null)), /*#__PURE__*/React.createElement("span", {
183
+ className: ax([layoutStyles.attributionText])
184
+ }, /*#__PURE__*/React.createElement(Text, {
140
185
  size: "small",
141
186
  color: "color.text.subtle"
142
187
  }, AttributionIcon ? formattedAttributionName : formatMessage(messages.previewAttributionBy, {
143
188
  name: formattedAttributionName
144
- })))));
189
+ })))))));
145
190
  };
146
191
  const PreviewImage = ({
147
192
  imageUrl
@@ -9,9 +9,12 @@ export const QuickInsertMenuItem = ({
9
9
  isDisabled,
10
10
  onSelect,
11
11
  preview,
12
+ previewIcon,
12
13
  previewImageUrls,
13
14
  shortcut,
15
+ titleContent,
14
16
  shouldShowPreview,
17
+ shouldClampPreview,
15
18
  shouldWrapIcon,
16
19
  title
17
20
  }) => {
@@ -25,6 +28,7 @@ export const QuickInsertMenuItem = ({
25
28
  isDisabled: isDisabled,
26
29
  onSelect: onSelect,
27
30
  shortcut: shortcut,
31
+ titleContent: titleContent,
28
32
  shouldWrapIcon: shouldWrapIcon,
29
33
  title: title
30
34
  }) : /*#__PURE__*/React.createElement(CompactQuickInsertMenuItem, {
@@ -34,9 +38,12 @@ export const QuickInsertMenuItem = ({
34
38
  isDisabled: isDisabled,
35
39
  onSelect: onSelect,
36
40
  preview: preview,
41
+ previewIcon: previewIcon,
37
42
  previewImageUrls: previewImageUrls,
38
43
  shortcut: shortcut,
44
+ titleContent: titleContent,
39
45
  shouldShowPreview: shouldShowPreview,
46
+ shouldClampPreview: shouldClampPreview,
40
47
  shouldWrapIcon: shouldWrapIcon,
41
48
  title: title
42
49
  });
@@ -0,0 +1,9 @@
1
+ ._16d9qvcn{-webkit-box-decoration-break:clone;box-decoration-break:clone}
2
+ ._1e0c1nu9{display:inline}
3
+ ._1i4qfg65{overflow-wrap:anywhere}
4
+ ._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
5
+ ._bozg1b66{padding-inline-start:var(--ds-space-050,4px)}
6
+ ._mkrz1f6o{clip-path:polygon(20% 0,100% 0,100% 100%,0 100%)}
7
+ ._mkrz1gdk{clip-path:polygon(0 0,100% 0,80% 100%,0 100%)}
8
+ ._o5724jg8{white-space:normal}
9
+ ._y4ti1b66{padding-inline-end:var(--ds-space-050,4px)}
@@ -0,0 +1,35 @@
1
+ /* SkillTag.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ import "./SkillTag.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ import { cx } from '@atlaskit/css';
6
+ import { Box } from '@atlaskit/primitives/compiled/box';
7
+ import { Text } from '@atlaskit/primitives/compiled/text';
8
+ const styles = {
9
+ highlight: "_bfhki8nm _16d9qvcn _1e0c1nu9",
10
+ start: "_bozg1b66 _y4ti1b66 _mkrz1f6o",
11
+ end: "_y4ti1b66 _mkrz1gdk",
12
+ wrapping: "_1i4qfg65 _o5724jg8",
13
+ text: "_1i4qfg65"
14
+ };
15
+ export const SkillTag = ({
16
+ slug,
17
+ isDisabled = false
18
+ }) => /*#__PURE__*/React.createElement(Box, {
19
+ as: "span",
20
+ xcss: styles.wrapping
21
+ }, /*#__PURE__*/React.createElement(Text, {
22
+ color: isDisabled ? 'color.text.disabled' : 'color.text',
23
+ xcss: styles.text
24
+ }, /*#__PURE__*/React.createElement(Box, {
25
+ as: "span",
26
+ xcss: cx(styles.highlight, styles.start)
27
+ }, /*#__PURE__*/React.createElement(Text, {
28
+ color: isDisabled ? 'color.text.disabled' : 'color.text.subtle'
29
+ }, "/")), /*#__PURE__*/React.createElement(Box, {
30
+ as: "span",
31
+ xcss: styles.highlight
32
+ }, slug.slice(0, -1)), slug && /*#__PURE__*/React.createElement(Box, {
33
+ as: "span",
34
+ xcss: cx(styles.highlight, styles.end)
35
+ }, slug.slice(-1))));
@@ -39,12 +39,10 @@ css`
39
39
  *
40
40
  * If you are updating this, please also update the above files.
41
41
  *
42
- * @deprecated This Emotion-based style function is being phased out as part of the
43
- * `platform_editor_core_static_css` experiment migration to Compiled CSS. While the experiment
44
- * is running, any changes here MUST also be reflected in `EditorContentContainer-compiled.tsx`
42
+ * @deprecated This Emotion-based style function is being phased out in favor of Compiled CSS.
43
+ * Any changes here MUST also be reflected in `EditorContentContainer-compiled.tsx`
45
44
  * (look for `tableSharedStyle`, `tableSharedStyle_with_*`, `tableSharedStyle_without_*` entries
46
- * in the `editorContentStyles` cssMap). Failure to do so will cause visual regressions when the
47
- * compiled version is active.
45
+ * in the `editorContentStyles` cssMap) to keep the shared styles consistent.
48
46
  */
49
47
  const tableSharedStyle = () => {
50
48
  const browser = getBrowserInfo();
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags/fg';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "128.0.0";
17
+ const packageVersion = "128.1.0";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -19,6 +19,7 @@ export function buildMenuItem(manifest, extensionModule) {
19
19
  }
20
20
  } : {}), {}, {
21
21
  key: key,
22
+ moduleKey: extensionModule.key,
22
23
  title: title,
23
24
  extensionType: manifest.type,
24
25
  extensionKey: manifest.key,
@@ -420,6 +420,11 @@ export var syncBlockMessages = defineMessages({
420
420
  defaultMessage: 'Request access',
421
421
  description: 'Label shown in the synced location dropdown option when the sync block is not accessible to the user'
422
422
  },
423
+ syncedLocationDropdownRestrictedContent: {
424
+ id: 'fabric.editor.syncedLocationDropdownRestrictedContent',
425
+ defaultMessage: 'Restricted content',
426
+ description: 'Title shown in the synced location dropdown in place of a page or work item the user does not have permission to view'
427
+ },
423
428
  syncedLocationDropdownUntitledPage: {
424
429
  id: 'fabric.editor.syncedLocationDropdownUntitledPage',
425
430
  defaultMessage: 'Untitled',
@@ -19,7 +19,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
19
19
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
20
20
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
21
21
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
22
- var packageVersion = "128.0.0";
22
+ var packageVersion = "128.1.0";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -76,20 +76,26 @@ export var CompactQuickInsertMenuItem = function CompactQuickInsertMenuItem(_ref
76
76
  isDisabled = _ref.isDisabled,
77
77
  onSelect = _ref.onSelect,
78
78
  preview = _ref.preview,
79
+ previewIcon = _ref.previewIcon,
79
80
  previewImageUrls = _ref.previewImageUrls,
80
81
  shortcut = _ref.shortcut,
82
+ titleContent = _ref.titleContent,
81
83
  _ref$shouldShowPrevie = _ref.shouldShowPreview,
82
84
  shouldShowPreview = _ref$shouldShowPrevie === void 0 ? true : _ref$shouldShowPrevie,
85
+ shouldClampPreview = _ref.shouldClampPreview,
83
86
  _ref$shouldWrapIcon = _ref.shouldWrapIcon,
84
87
  shouldWrapIcon = _ref$shouldWrapIcon === void 0 ? true : _ref$shouldWrapIcon,
85
88
  title = _ref.title;
86
89
  var _useQuickInsertContex = useQuickInsertContext(),
87
- item = _useQuickInsertContex.item;
90
+ item = _useQuickInsertContex.item,
91
+ popupsMountPoint = _useQuickInsertContex.popupsMountPoint;
88
92
  var _ref2 = item !== null && item !== void 0 ? item : {
89
93
  id: undefined,
94
+ isPreviewActive: undefined,
90
95
  isSelected: false
91
96
  },
92
97
  id = _ref2.id,
98
+ isPreviewActive = _ref2.isPreviewActive,
93
99
  isSelected = _ref2.isSelected;
94
100
  var resolvedDescription = description !== null && description !== void 0 ? description : item === null || item === void 0 ? void 0 : item.description;
95
101
  var previewId = useId();
@@ -103,7 +109,7 @@ export var CompactQuickInsertMenuItem = function CompactQuickInsertMenuItem(_ref
103
109
  image: previewImageUrls
104
110
  } : {};
105
111
  }, [preview, previewImageUrls]);
106
- var shouldRenderPreview = shouldShowPreview && isSelected && !isDisabled;
112
+ var shouldRenderPreview = shouldShowPreview && (isPreviewActive !== null && isPreviewActive !== void 0 ? isPreviewActive : isSelected) && !isDisabled;
107
113
  var hasAccessiblePreview = Boolean(resolvedDescription || (resolvedPreview === null || resolvedPreview === void 0 ? void 0 : resolvedPreview.attribution));
108
114
  var previewAttributionName = (_resolvedPreview$attr = resolvedPreview.attribution) === null || _resolvedPreview$attr === void 0 ? void 0 : _resolvedPreview$attr.name;
109
115
  var previewAttributionKey = typeof previewAttributionName === 'string' ? previewAttributionName : previewAttributionName === null || previewAttributionName === void 0 ? void 0 : previewAttributionName.id;
@@ -126,7 +132,7 @@ export var CompactQuickInsertMenuItem = function CompactQuickInsertMenuItem(_ref
126
132
  alignBlock: "center",
127
133
  spread: "space-between",
128
134
  xcss: styles.content
129
- }, /*#__PURE__*/React.createElement(Text, null, title), shortcut && /*#__PURE__*/React.createElement(Box, {
135
+ }, titleContent !== null && titleContent !== void 0 ? titleContent : /*#__PURE__*/React.createElement(Text, null, title), shortcut && /*#__PURE__*/React.createElement(Box, {
130
136
  as: "span",
131
137
  xcss: styles.shortcut
132
138
  }, shortcut))), shouldRenderPreview && referenceElement && /*#__PURE__*/React.createElement(QuickInsertHoverPreview, {
@@ -134,7 +140,10 @@ export var CompactQuickInsertMenuItem = function CompactQuickInsertMenuItem(_ref
134
140
  id: previewId,
135
141
  description: resolvedDescription,
136
142
  preview: resolvedPreview,
143
+ popupsMountPoint: popupsMountPoint,
137
144
  referenceElement: referenceElement,
138
- title: title
145
+ title: title,
146
+ icon: previewIcon,
147
+ shouldClampText: shouldClampPreview
139
148
  }));
140
149
  };
@@ -107,6 +107,7 @@ export var ElementBrowserQuickInsertMenuItem = function ElementBrowserQuickInser
107
107
  isDisabled = _ref.isDisabled,
108
108
  onSelect = _ref.onSelect,
109
109
  shortcut = _ref.shortcut,
110
+ titleContent = _ref.titleContent,
110
111
  _ref$shouldWrapIcon = _ref.shouldWrapIcon,
111
112
  shouldWrapIcon = _ref$shouldWrapIcon === void 0 ? true : _ref$shouldWrapIcon,
112
113
  title = _ref.title;
@@ -147,7 +148,7 @@ export var ElementBrowserQuickInsertMenuItem = function ElementBrowserQuickInser
147
148
  alignBlock: "center",
148
149
  spread: "space-between",
149
150
  space: "space.100"
150
- }, /*#__PURE__*/React.createElement(Text, {
151
+ }, titleContent !== null && titleContent !== void 0 ? titleContent : /*#__PURE__*/React.createElement(Text, {
151
152
  color: "color.text",
152
153
  maxLines: 1,
153
154
  size: "medium",
@@ -8,6 +8,7 @@
8
8
  ._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
9
9
  ._1rjcutpp{padding-block:var(--ds-space-150,9pt)}
10
10
  ._16jlidpf{flex-grow:0}
11
+ ._16jlkb7n{flex-grow:1}
11
12
  ._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
12
13
  ._18m915vq{overflow-y:hidden}
13
14
  ._1bah1h6o{justify-content:center}
@@ -20,8 +21,10 @@
20
21
  ._1e0ccj1k{display:-webkit-box}
21
22
  ._1i4qfg65{overflow-wrap:anywhere}
22
23
  ._1o9zidpf{flex-shrink:0}
24
+ ._1o9zkb7n{flex-shrink:1}
23
25
  ._1pby16oo{z-index:510}
24
26
  ._1reo15vq{overflow-x:hidden}
27
+ ._1ul9idpf{min-width:0}
25
28
  ._1yyjcs5v{-webkit-line-clamp:2}
26
29
  ._1yyjegat{-webkit-line-clamp:4}
27
30
  ._2lx21bp4{flex-direction:column}
@@ -36,7 +39,9 @@
36
39
  ._bfhkhfxm{background-color:var(--ds-surface-sunken,#f8f8f8)}
37
40
  ._c71l1kw7{max-height:inherit}
38
41
  ._c71lk6is{max-height:calc(100vh - 1pc)}
42
+ ._i0dl1wug{flex-basis:auto}
39
43
  ._i0dlexct{flex-basis:16px}
44
+ ._k48pwu06{font-weight:var(--ds-font-weight-bold,653)}
40
45
  ._p12f1oec{max-width:calc(100vw - 1pc)}
41
46
  ._p12f1osq{max-width:100%}
42
47
  ._sudp1e54{-webkit-box-orient:vertical}
@@ -1,17 +1,18 @@
1
1
  /* QuickInsertHoverPreview.tsx generated by @compiled/babel-plugin v3.0.2 */
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import "./QuickInsertHoverPreview.compiled.css";
4
- import * as React from 'react';
5
4
  import { ax, ix } from "@compiled/react/runtime";
6
- import { useLayoutEffect, useState } from 'react';
5
+ import React, { useLayoutEffect, useState } from 'react';
7
6
  import { createPortal } from 'react-dom';
8
7
 
9
8
  // Viewport calculations and multiline clamping require styles outside @atlaskit/css's schema.
10
9
 
10
+ import { bind } from 'bind-event-listener';
11
11
  import { useIntl } from 'react-intl';
12
-
13
12
  // Viewport clamping requires modifiers, which the top-layer adapter does not support.
14
13
  import { Popper } from '@atlaskit/popper/react-popper';
14
+ import { Box } from '@atlaskit/primitives/compiled/box';
15
+ import { Inline } from '@atlaskit/primitives/compiled/inline';
15
16
  import { Text } from '@atlaskit/primitives/compiled/text';
16
17
  import { useThemeObserver } from '@atlaskit/tokens/use-theme-observer';
17
18
  import { messages } from './messages';
@@ -39,34 +40,47 @@ var PREVIEW_MODIFIERS = [{
39
40
  rootBoundary: 'viewport'
40
41
  }
41
42
  }];
43
+ var layoutStyles = {
44
+ titleRow: "_1ul9idpf",
45
+ titleIcon: "_4cvr1h6o _1e0c1txw _1o9zidpf _1bah1h6o",
46
+ attributionText: "_16jlkb7n _1o9zkb7n _i0dl1wug _1ul9idpf _1i4qfg65"
47
+ };
42
48
  var styles = {
43
49
  positioner: "_c71lk6is _p12f1oec _1pby16oo",
44
50
  panel: "_2rko1qi0 _1reo15vq _18m915vq _1rjcutpp _18zrutpp _vchhusvi _bfhk1bhr _16qs130s _c71l1kw7 _p12f1osq _1bsbncxg",
45
51
  content: "_zulpu2gc _1e0c1txw _2lx21bp4",
46
- title: "_11c81qyo _1reo15vq _18m915vq _syazazsu _1i4qfg65 _1e0ccj1k _sudp1e54 _1yyjcs5v",
52
+ title: "_11c81qyo _16jlkb7n _1o9zkb7n _i0dl1wug _1reo15vq _18m915vq _syazazsu _1ul9idpf _1i4qfg65 _1e0ccj1k _sudp1e54 _1yyjcs5v",
53
+ unclampedTitle: "_11c8fhey _16jlkb7n _1o9zkb7n _i0dl1wug _syazi7uo _k48pwu06 _1ul9idpf _1i4qfg65",
47
54
  description: "_11c8fhey _1reo15vq _18m915vq _syazi7uo _1e0ccj1k _1i4qfg65 _sudp1e54 _1yyjegat",
55
+ unclampedDescription: "_11c8fhey _syazi7uo _1i4qfg65",
48
56
  imageArea: "_2rko12b0 _1reo15vq _18m915vq _bfhkhfxm _4t3i68cl _6rthu2gc _p12f1osq _1bsbp3fh",
49
57
  image: "_1e0c1ule _4t3i1osq _5ral1f51 _1bsb1osq",
50
58
  imageHidden: "_3um015vq",
51
- attribution: "_11c8wadc _zulp1b66 _4cvr1h6o _syazazsu _1e0c1txw _1i4qfg65",
59
+ attribution: "_zulp1b66 _4cvr1h6o _syazazsu _1e0c1txw _1i4qfg65",
60
+ compactAttribution: "_11c8wadc",
52
61
  attributionIcon: "_16jlidpf _1o9zidpf _i0dlexct _4cvr1h6o _1e0c1txw _4t3i7vkz _1bah1h6o _1bsb7vkz"
53
62
  };
54
63
 
55
64
  /** The selected item's description and attribution are announced through its aria-describedby. */
56
65
  export var QuickInsertHoverPreview = function QuickInsertHoverPreview(_ref) {
57
66
  var description = _ref.description,
67
+ icon = _ref.icon,
58
68
  id = _ref.id,
59
69
  preview = _ref.preview,
70
+ popupsMountPoint = _ref.popupsMountPoint,
60
71
  referenceElement = _ref.referenceElement,
72
+ _ref$shouldClampText = _ref.shouldClampText,
73
+ shouldClampText = _ref$shouldClampText === void 0 ? true : _ref$shouldClampText,
61
74
  title = _ref.title;
62
75
  var _useThemeObserver = useThemeObserver(),
63
76
  colorMode = _useThemeObserver.colorMode;
64
77
  var imageUrl = preview.image ? colorMode === 'dark' && preview.image.dark ? preview.image.dark : preview.image.light : undefined;
65
78
  var hasAccessibleContent = Boolean(description || preview.attribution);
79
+ var portalTarget = popupsMountPoint !== null && popupsMountPoint !== void 0 ? popupsMountPoint : referenceElement.ownerDocument.body;
66
80
  return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(Popper, {
67
81
  placement: "right-start",
68
82
  referenceElement: referenceElement,
69
- strategy: "fixed",
83
+ strategy: popupsMountPoint ? 'absolute' : 'fixed',
70
84
  modifiers: PREVIEW_MODIFIERS
71
85
  }, function (_ref2) {
72
86
  var ref = _ref2.ref,
@@ -78,22 +92,28 @@ export var QuickInsertHoverPreview = function QuickInsertHoverPreview(_ref) {
78
92
  className: ax([styles.positioner])
79
93
  }, /*#__PURE__*/React.createElement(QuickInsertPreviewPanel, {
80
94
  description: description,
95
+ icon: icon,
81
96
  id: hasAccessibleContent ? id : undefined,
82
97
  imageUrl: imageUrl,
83
98
  preview: preview,
99
+ popupsMountPoint: popupsMountPoint,
84
100
  referenceElement: referenceElement,
101
+ shouldClampText: shouldClampText,
85
102
  title: title,
86
103
  update: update
87
104
  }));
88
- }), referenceElement.ownerDocument.body);
105
+ }), portalTarget);
89
106
  };
90
107
  var QuickInsertPreviewPanel = function QuickInsertPreviewPanel(_ref3) {
91
108
  var _preview$attribution, _preview$attribution2;
92
109
  var description = _ref3.description,
110
+ icon = _ref3.icon,
93
111
  id = _ref3.id,
94
112
  imageUrl = _ref3.imageUrl,
95
113
  preview = _ref3.preview,
114
+ popupsMountPoint = _ref3.popupsMountPoint,
96
115
  referenceElement = _ref3.referenceElement,
116
+ shouldClampText = _ref3.shouldClampText,
97
117
  title = _ref3.title,
98
118
  update = _ref3.update;
99
119
  var _useIntl = useIntl(),
@@ -106,47 +126,71 @@ var QuickInsertPreviewPanel = function QuickInsertPreviewPanel(_ref3) {
106
126
  var attributionName = (_preview$attribution2 = preview.attribution) === null || _preview$attribution2 === void 0 ? void 0 : _preview$attribution2.name;
107
127
  var formattedAttributionName = typeof attributionName === 'string' ? attributionName : attributionName ? formatMessage(attributionName) : '';
108
128
  useLayoutEffect(function () {
109
- var _referenceElement$own;
129
+ var _ownerDocument$defaul;
110
130
  void update();
111
- var ResizeObserverConstructor = (_referenceElement$own = referenceElement.ownerDocument.defaultView) === null || _referenceElement$own === void 0 ? void 0 : _referenceElement$own.ResizeObserver;
131
+ var ownerDocument = referenceElement.ownerDocument;
132
+ var onScroll = function onScroll() {
133
+ return void update();
134
+ };
135
+ var unbindScrollListener = bind(ownerDocument, {
136
+ type: 'scroll',
137
+ listener: onScroll,
138
+ options: true
139
+ });
140
+ var ResizeObserverConstructor = (_ownerDocument$defaul = ownerDocument.defaultView) === null || _ownerDocument$defaul === void 0 ? void 0 : _ownerDocument$defaul.ResizeObserver;
112
141
  if (!panelElement || !ResizeObserverConstructor) {
113
- return;
142
+ return unbindScrollListener;
114
143
  }
115
144
  var observer = new ResizeObserverConstructor(function () {
116
145
  return void update();
117
146
  });
118
147
  observer.observe(panelElement);
148
+ observer.observe(referenceElement);
149
+ if (popupsMountPoint) {
150
+ observer.observe(popupsMountPoint);
151
+ }
119
152
  return function () {
120
- return observer.disconnect();
153
+ unbindScrollListener();
154
+ observer.disconnect();
121
155
  };
122
- }, [panelElement, referenceElement, update]);
156
+ }, [panelElement, popupsMountPoint, referenceElement, update]);
123
157
  return /*#__PURE__*/React.createElement("div", {
124
158
  ref: setPanelElement,
125
159
  id: id,
126
160
  role: id ? 'tooltip' : undefined,
127
161
  "data-testid": "quick-insert-preview-panel",
128
162
  className: ax([styles.panel])
129
- }, imageUrl && /*#__PURE__*/React.createElement(PreviewImage, {
163
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, imageUrl && /*#__PURE__*/React.createElement(PreviewImage, {
130
164
  key: imageUrl,
131
165
  imageUrl: imageUrl
132
166
  }), /*#__PURE__*/React.createElement("div", {
133
167
  className: ax([styles.content])
134
- }, /*#__PURE__*/React.createElement("div", {
168
+ }, /*#__PURE__*/React.createElement(Inline, {
169
+ alignBlock: "center",
170
+ space: "space.100",
171
+ xcss: layoutStyles.titleRow,
172
+ "aria-hidden": "true"
173
+ }, icon && /*#__PURE__*/React.createElement(Box, {
174
+ as: "span",
135
175
  "aria-hidden": "true",
136
- className: ax([styles.title])
137
- }, title), description && /*#__PURE__*/React.createElement("div", {
138
- className: ax([styles.description])
176
+ xcss: layoutStyles.titleIcon
177
+ }, icon), /*#__PURE__*/React.createElement("span", {
178
+ className: ax([shouldClampText && styles.title, !shouldClampText && styles.unclampedTitle])
179
+ }, title)), description && /*#__PURE__*/React.createElement("div", {
180
+ className: ax([shouldClampText && styles.description, !shouldClampText && styles.unclampedDescription])
139
181
  }, description), preview.attribution && /*#__PURE__*/React.createElement("div", {
140
- className: ax([styles.attribution])
182
+ className: ax([styles.attribution, shouldClampText && styles.compactAttribution])
141
183
  }, AttributionIcon && /*#__PURE__*/React.createElement("span", {
142
184
  "aria-hidden": "true",
143
185
  className: ax([styles.attributionIcon])
144
- }, /*#__PURE__*/React.createElement(AttributionIcon, null)), /*#__PURE__*/React.createElement(Text, {
186
+ }, /*#__PURE__*/React.createElement(AttributionIcon, null)), /*#__PURE__*/React.createElement("span", {
187
+ className: ax([layoutStyles.attributionText])
188
+ }, /*#__PURE__*/React.createElement(Text, {
145
189
  size: "small",
146
190
  color: "color.text.subtle"
147
191
  }, AttributionIcon ? formattedAttributionName : formatMessage(messages.previewAttributionBy, {
148
192
  name: formattedAttributionName
149
- })))));
193
+ })))))));
150
194
  };
151
195
  var PreviewImage = function PreviewImage(_ref4) {
152
196
  var imageUrl = _ref4.imageUrl;
@@ -9,9 +9,12 @@ export var QuickInsertMenuItem = function QuickInsertMenuItem(_ref) {
9
9
  isDisabled = _ref.isDisabled,
10
10
  onSelect = _ref.onSelect,
11
11
  preview = _ref.preview,
12
+ previewIcon = _ref.previewIcon,
12
13
  previewImageUrls = _ref.previewImageUrls,
13
14
  shortcut = _ref.shortcut,
15
+ titleContent = _ref.titleContent,
14
16
  shouldShowPreview = _ref.shouldShowPreview,
17
+ shouldClampPreview = _ref.shouldClampPreview,
15
18
  shouldWrapIcon = _ref.shouldWrapIcon,
16
19
  title = _ref.title;
17
20
  var _useQuickInsertContex = useQuickInsertContext(),
@@ -23,6 +26,7 @@ export var QuickInsertMenuItem = function QuickInsertMenuItem(_ref) {
23
26
  isDisabled: isDisabled,
24
27
  onSelect: onSelect,
25
28
  shortcut: shortcut,
29
+ titleContent: titleContent,
26
30
  shouldWrapIcon: shouldWrapIcon,
27
31
  title: title
28
32
  }) : /*#__PURE__*/React.createElement(CompactQuickInsertMenuItem, {
@@ -32,9 +36,12 @@ export var QuickInsertMenuItem = function QuickInsertMenuItem(_ref) {
32
36
  isDisabled: isDisabled,
33
37
  onSelect: onSelect,
34
38
  preview: preview,
39
+ previewIcon: previewIcon,
35
40
  previewImageUrls: previewImageUrls,
36
41
  shortcut: shortcut,
42
+ titleContent: titleContent,
37
43
  shouldShowPreview: shouldShowPreview,
44
+ shouldClampPreview: shouldClampPreview,
38
45
  shouldWrapIcon: shouldWrapIcon,
39
46
  title: title
40
47
  });
@@ -0,0 +1,9 @@
1
+ ._16d9qvcn{-webkit-box-decoration-break:clone;box-decoration-break:clone}
2
+ ._1e0c1nu9{display:inline}
3
+ ._1i4qfg65{overflow-wrap:anywhere}
4
+ ._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
5
+ ._bozg1b66{padding-inline-start:var(--ds-space-050,4px)}
6
+ ._mkrz1f6o{clip-path:polygon(20% 0,100% 0,100% 100%,0 100%)}
7
+ ._mkrz1gdk{clip-path:polygon(0 0,100% 0,80% 100%,0 100%)}
8
+ ._o5724jg8{white-space:normal}
9
+ ._y4ti1b66{padding-inline-end:var(--ds-space-050,4px)}