@atlaskit/editor-common 134.6.2 → 134.7.2

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 (54) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/cjs/analytics/types/ai-suggestions-events.js +2 -0
  3. package/dist/cjs/monitoring/error.js +1 -1
  4. package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
  5. package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.js +6 -6
  6. package/dist/cjs/quick-insert/ElementBrowserQuickInsertMenuItem.js +76 -103
  7. package/dist/cjs/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
  8. package/dist/cjs/quick-insert/QuickInsertHoverPreview.js +9 -93
  9. package/dist/cjs/quick-insert/QuickInsertMenuItem.js +2 -1
  10. package/dist/cjs/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
  11. package/dist/cjs/quick-insert/QuickInsertPreviewContent.js +142 -0
  12. package/dist/cjs/quick-insert/QuickInsertShortcut.compiled.css +10 -0
  13. package/dist/cjs/quick-insert/QuickInsertShortcut.js +28 -0
  14. package/dist/cjs/ui/DropList/index.js +1 -1
  15. package/dist/cjs/ui/Layer/index.js +14 -208
  16. package/dist/cjs/vanilla-tooltip/index.js +5 -14
  17. package/dist/es2019/analytics/types/ai-suggestions-events.js +2 -0
  18. package/dist/es2019/monitoring/error.js +1 -1
  19. package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
  20. package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.js +6 -6
  21. package/dist/es2019/quick-insert/ElementBrowserQuickInsertMenuItem.js +74 -101
  22. package/dist/es2019/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
  23. package/dist/es2019/quick-insert/QuickInsertHoverPreview.js +10 -86
  24. package/dist/es2019/quick-insert/QuickInsertMenuItem.js +2 -1
  25. package/dist/es2019/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
  26. package/dist/es2019/quick-insert/QuickInsertPreviewContent.js +126 -0
  27. package/dist/es2019/quick-insert/QuickInsertShortcut.compiled.css +10 -0
  28. package/dist/es2019/quick-insert/QuickInsertShortcut.js +19 -0
  29. package/dist/es2019/ui/DropList/index.js +1 -1
  30. package/dist/es2019/ui/Layer/index.js +15 -192
  31. package/dist/es2019/vanilla-tooltip/index.js +7 -15
  32. package/dist/esm/analytics/types/ai-suggestions-events.js +2 -0
  33. package/dist/esm/monitoring/error.js +1 -1
  34. package/dist/esm/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
  35. package/dist/esm/quick-insert/CompactQuickInsertMenuItem.js +6 -6
  36. package/dist/esm/quick-insert/ElementBrowserQuickInsertMenuItem.js +77 -104
  37. package/dist/esm/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
  38. package/dist/esm/quick-insert/QuickInsertHoverPreview.js +10 -93
  39. package/dist/esm/quick-insert/QuickInsertMenuItem.js +2 -1
  40. package/dist/esm/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
  41. package/dist/esm/quick-insert/QuickInsertPreviewContent.js +135 -0
  42. package/dist/esm/quick-insert/QuickInsertShortcut.compiled.css +10 -0
  43. package/dist/esm/quick-insert/QuickInsertShortcut.js +21 -0
  44. package/dist/esm/ui/DropList/index.js +1 -1
  45. package/dist/esm/ui/Layer/index.js +15 -211
  46. package/dist/esm/vanilla-tooltip/index.js +7 -15
  47. package/dist/types/analytics/types/ai-suggestions-events.d.ts +3 -1
  48. package/dist/types/quick-insert/ElementBrowserQuickInsertMenuItem.d.ts +7 -1
  49. package/dist/types/quick-insert/QuickInsertHoverPreview.d.ts +0 -1
  50. package/dist/types/quick-insert/QuickInsertPreviewContent.d.ts +24 -0
  51. package/dist/types/quick-insert/QuickInsertShortcut.d.ts +13 -0
  52. package/dist/types/ui/Layer/index.d.ts +1 -15
  53. package/dist/types/vanilla-tooltip/index.d.ts +1 -1
  54. package/package.json +3 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 134.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f1dbe14f9e8d0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f1dbe14f9e8d0) -
8
+ Cleanup `feature_gate` `platform-dst-popper-consolidation`. `PopupSelect`, the Editor `Layer` and
9
+ `VanillaTooltip` now always position through `@atlaskit/popper`, and the direct `react-popper`,
10
+ `popper.js` and `@popperjs/core` paths are removed.
11
+
12
+ `Layer` mounts its content in the commit that opens it again, as the `popper.js` path did, so
13
+ Editor dropdown menus opened by keyboard focus their first item.
14
+
15
+ - [`7b6b2186d8c8b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7b6b2186d8c8b) -
16
+ Element Browser (platform_editor_slash_command experiment): show Recommended elements above All
17
+ elements in the All category; render every tile as its hover preview card (image, full
18
+ description, attribution) with lazily loaded images, equal heights per row and aligned footers;
19
+ show each tile's shortcut beside its title, which uses the hover preview's title style; enlarge
20
+ the modal to 1072x804 with 264px tiles; and support arrow-key navigation across rows of different
21
+ widths. Unclamped Quick Insert hover previews (Rovo skills) use the same subtle heading title as
22
+ other previews.
23
+ - Updated dependencies
24
+
25
+ ## 134.7.1
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies
30
+
31
+ ## 134.7.0
32
+
33
+ ### Minor Changes
34
+
35
+ - [`3e09cc46e3481`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3e09cc46e3481) -
36
+ Add the `CONTEXTUAL_NUDGE` AI suggestions entry point so analytics can tell reviews started from
37
+ the contextual nudge's call to action apart from other entry points.
38
+
3
39
  ## 134.6.2
4
40
 
5
41
  ### Patch Changes
@@ -22,6 +22,8 @@ var AiSuggestionsEntryPointValue = exports.AiSuggestionsEntryPointValue = /*#__P
22
22
  AiSuggestionsEntryPointValue["SUGGESTIONS_PANEL_MOUNT"] = "suggestionsPanelMount";
23
23
  /** The "Review" button on the follow-up card after the last suggestion is actioned. */
24
24
  AiSuggestionsEntryPointValue["FOLLOW_UP_CARD"] = "followUpCard";
25
+ /** The call to action on the contextual nudge that points at the Review suggestions button. */
26
+ AiSuggestionsEntryPointValue["CONTEXTUAL_NUDGE"] = "contextualNudge";
25
27
  return AiSuggestionsEntryPointValue;
26
28
  }({});
27
29
  var AiSuggestionsRightRailEntryPointValue = exports.AiSuggestionsRightRailEntryPointValue = /*#__PURE__*/function (AiSuggestionsRightRailEntryPointValue) {
@@ -27,7 +27,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
27
27
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
28
28
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
29
29
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
30
- var packageVersion = "134.6.1";
30
+ var packageVersion = "134.7.1";
31
31
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
32
32
  // Remove URL as it has UGC
33
33
  // Ignored via go/ees007
@@ -1,12 +1,7 @@
1
- ._11c8wadc{font:var(--ds-font-body-small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
- ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
3
1
  ._2rko1mok{border-radius:var(--ds-radius-large,8px)}
4
2
  ._189ee4h9{border-width:var(--ds-border-width,1px)}
5
- ._18zr1b66{padding-inline:var(--ds-space-050,4px)}
6
3
  ._1dqonqa1{border-style:solid}
7
- ._1h6d1l7x{border-color:var(--ds-border,#0b120e24)}
8
- ._1rjcv77o{padding-block:var(--ds-space-025,2px)}
9
- ._16jlkb7n{flex-grow:1}
4
+ ._1h6d1l7x{border-color:var(--ds-border,#0b120e24)}._16jlkb7n{flex-grow:1}
10
5
  ._18m915vq{overflow-y:hidden}
11
6
  ._1bah1h6o{justify-content:center}
12
7
  ._1bsbzwfg{width:2pc}
@@ -21,8 +16,6 @@
21
16
  ._4cvr1h6o{align-items:center}
22
17
  ._4t3izwfg{height:2pc}
23
18
  ._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
24
- ._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
25
19
  ._i0dlidpf{flex-basis:0}
26
20
  ._rpzpjdj5 [style*="--ds-icon-accent-gray"]{color:inherit!important}
27
- ._syaz1q3r{color:var(--ds-icon,#292a2e)}
28
- ._syazazsu{color:var(--ds-text-subtle,#505258)}
21
+ ._syaz1q3r{color:var(--ds-icon,#292a2e)}
@@ -18,6 +18,7 @@ var _pressable = require("@atlaskit/primitives/pressable");
18
18
  var _xcss = require("@atlaskit/primitives/xcss/xcss");
19
19
  var _QuickInsertHoverPreview = require("./QuickInsertHoverPreview");
20
20
  var _quickInsertMenuItemUtils = require("./quickInsertMenuItemUtils");
21
+ var _QuickInsertShortcut = require("./QuickInsertShortcut");
21
22
  var _useQuickInsertContext = require("./useQuickInsertContext");
22
23
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
23
24
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- Compiled primitives do not provide Pressable.
@@ -25,8 +26,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
25
26
  var styles = {
26
27
  iconContainer: "_4cvr1h6o _1e0c1txw _1o9zidpf _1bah1h6o _1tke1tcg _1ul91tcg",
27
28
  content: "_16jlkb7n _1o9zkb7n _i0dlidpf _1ul9idpf",
28
- iconLarge: "_2rko1mok _1reo15vq _18m915vq _1h6d1l7x _1dqonqa1 _189ee4h9 _4cvr1h6o _bfhk1bhr _1e0c1txw _4t3izwfg _1bah1h6o _1bsbzwfg",
29
- shortcut: "_2rko12b0 _11c8wadc _1rjcv77o _18zr1b66 _bfhki8nm _syazazsu"
29
+ iconLarge: "_2rko1mok _1reo15vq _18m915vq _1h6d1l7x _1dqonqa1 _189ee4h9 _4cvr1h6o _bfhk1bhr _1e0c1txw _4t3izwfg _1bah1h6o _1bsbzwfg"
30
30
  };
31
31
  var iconColorStyles = null;
32
32
 
@@ -165,10 +165,10 @@ var CompactQuickInsertMenuItem = exports.CompactQuickInsertMenuItem = function C
165
165
  }, lozenge ? /*#__PURE__*/_react.default.createElement(_inline.Inline, {
166
166
  alignBlock: "center",
167
167
  space: "space.100"
168
- }, rowTitle, lozenge) : rowTitle, shortcut && /*#__PURE__*/_react.default.createElement(_box.Box, {
169
- as: "span",
170
- xcss: styles.shortcut
171
- }, shortcut))), shouldRenderPreview && referenceElement && /*#__PURE__*/_react.default.createElement(_QuickInsertHoverPreview.QuickInsertHoverPreview, {
168
+ }, rowTitle, lozenge) : rowTitle, shortcut && /*#__PURE__*/_react.default.createElement(_QuickInsertShortcut.QuickInsertShortcut, {
169
+ isDisabled: isDisabled,
170
+ shortcut: shortcut
171
+ }))), shouldRenderPreview && referenceElement && /*#__PURE__*/_react.default.createElement(_QuickInsertHoverPreview.QuickInsertHoverPreview, {
172
172
  key: (_ref3 = (_resolvedPreview$imag = (_resolvedPreview$imag2 = resolvedPreview.image) === null || _resolvedPreview$imag2 === void 0 ? void 0 : _resolvedPreview$imag2.light) !== null && _resolvedPreview$imag !== void 0 ? _resolvedPreview$imag : previewAttributionKey) !== null && _ref3 !== void 0 ? _ref3 : title,
173
173
  id: previewId,
174
174
  description: resolvedDescription,
@@ -9,88 +9,76 @@ exports.ElementBrowserQuickInsertMenuItem = void 0;
9
9
  require("./ElementBrowserQuickInsertMenuItem.compiled.css");
10
10
  var _runtime = require("@compiled/react/runtime");
11
11
  var _react = _interopRequireWildcard(require("react"));
12
- var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
13
12
  var _box = require("@atlaskit/primitives/box");
14
- var _inline = require("@atlaskit/primitives/inline");
15
13
  var _pressable = require("@atlaskit/primitives/pressable");
16
- var _stack = require("@atlaskit/primitives/stack");
17
- var _text = require("@atlaskit/primitives/text");
18
14
  var _xcss = require("@atlaskit/primitives/xcss/xcss");
19
15
  var _quickInsertMenuItemUtils = require("./quickInsertMenuItemUtils");
16
+ var _QuickInsertPreviewContent = require("./QuickInsertPreviewContent");
20
17
  var _useQuickInsertContext = require("./useQuickInsertContext");
21
18
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
22
19
  /* eslint-disable @atlaskit/design-system/no-emotion-primitives -- Compiled primitives do not provide Pressable. */
23
- var borderlessItemStyles = (0, _xcss.xcss)({
24
- alignItems: 'start',
25
- backgroundColor: 'color.background.neutral.subtle',
26
- borderRadius: 'radius.medium',
20
+ var cardStyles = (0, _xcss.xcss)({
21
+ backgroundColor: 'elevation.surface',
22
+ borderColor: 'color.border',
23
+ borderRadius: 'radius.large',
24
+ borderStyle: 'solid',
25
+ borderWidth: 'border.width',
27
26
  color: 'color.text',
28
27
  cursor: 'pointer',
29
28
  display: 'flex',
30
- gap: 'space.150',
31
- height: '88px',
29
+ flexDirection: 'column',
30
+ gap: 'space.100',
31
+ // Fills the grid row so every tile in a row is as tall as the tallest one.
32
+ height: '100%',
32
33
  padding: 'space.150',
33
34
  textAlign: 'start',
34
- width: '100%'
35
+ width: '100%',
36
+ ':hover': {
37
+ backgroundColor: 'elevation.surface.hovered'
38
+ }
35
39
  });
36
- var borderlessSelectedItemStyles = (0, _xcss.xcss)({
37
- alignItems: 'start',
40
+
41
+ // Each state is a complete style so the tile can pick one without composing styles at render.
42
+ var selectedCardStyles = (0, _xcss.xcss)({
38
43
  backgroundColor: 'color.background.selected',
39
- borderRadius: 'radius.medium',
44
+ borderColor: 'color.border.selected',
45
+ borderRadius: 'radius.large',
46
+ borderStyle: 'solid',
47
+ borderWidth: 'border.width',
40
48
  color: 'color.text',
41
49
  cursor: 'pointer',
42
50
  display: 'flex',
43
- gap: 'space.150',
44
- height: '88px',
51
+ flexDirection: 'column',
52
+ gap: 'space.100',
53
+ height: '100%',
45
54
  padding: 'space.150',
46
- position: 'relative',
47
55
  textAlign: 'start',
48
56
  width: '100%',
49
- '::before': {
50
- borderInlineStartColor: 'color.border.selected',
51
- borderInlineStartStyle: 'solid',
52
- borderInlineStartWidth: 'border.width.selected',
53
- content: "''",
54
- insetBlock: 'space.0',
55
- insetInlineStart: 'space.0',
56
- pointerEvents: 'none',
57
- position: 'absolute'
57
+ ':hover': {
58
+ backgroundColor: 'color.background.selected.hovered'
59
+ },
60
+ // Keyboard focus draws the focus ring, so drop the selected border to avoid a double outline.
61
+ ':focus-visible': {
62
+ borderColor: 'color.border'
58
63
  }
59
64
  });
60
- var borderlessDisabledItemStyles = (0, _xcss.xcss)({
61
- alignItems: 'start',
62
- backgroundColor: 'color.background.neutral.subtle',
63
- borderRadius: 'radius.medium',
65
+ var disabledCardStyles = (0, _xcss.xcss)({
66
+ backgroundColor: 'elevation.surface',
67
+ borderColor: 'color.border',
68
+ borderRadius: 'radius.large',
69
+ borderStyle: 'solid',
70
+ borderWidth: 'border.width',
64
71
  color: 'color.text.disabled',
65
72
  cursor: 'not-allowed',
66
73
  display: 'flex',
67
- gap: 'space.150',
68
- height: '88px',
74
+ flexDirection: 'column',
75
+ gap: 'space.100',
76
+ height: '100%',
69
77
  padding: 'space.150',
70
78
  textAlign: 'start',
71
79
  width: '100%'
72
80
  });
73
- var hoveredItemStyles = (0, _xcss.xcss)({
74
- ':hover': {
75
- backgroundColor: 'elevation.surface.hovered',
76
- borderRadius: 'radius.medium'
77
- }
78
- });
79
81
  var iconStyles = (0, _xcss.xcss)({
80
- alignItems: 'center',
81
- backgroundColor: 'elevation.surface.overlay',
82
- borderColor: 'color.border',
83
- borderRadius: 'radius.medium',
84
- borderStyle: 'solid',
85
- borderWidth: 'border.width',
86
- display: 'flex',
87
- flexShrink: 0,
88
- height: '40px',
89
- justifyContent: 'center',
90
- overflow: 'hidden',
91
- width: '40px'
92
- });
93
- var iconLargeStyles = (0, _xcss.xcss)({
94
82
  alignItems: 'center',
95
83
  backgroundColor: 'elevation.surface.overlay',
96
84
  borderColor: 'color.border',
@@ -99,10 +87,10 @@ var iconLargeStyles = (0, _xcss.xcss)({
99
87
  borderWidth: 'border.width',
100
88
  display: 'flex',
101
89
  flexShrink: 0,
102
- height: '40px',
90
+ height: '32px',
103
91
  justifyContent: 'center',
104
92
  overflow: 'hidden',
105
- width: '40px'
93
+ width: '32px'
106
94
  });
107
95
  var iconColorStyles = null;
108
96
 
@@ -115,25 +103,24 @@ var iconColorStyles = null;
115
103
  var pinnedIconColorResetStyles = null;
116
104
  /* eslint-enable @atlaskit/design-system/no-unsafe-design-token-usage, @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-important-styles */
117
105
 
118
- var shortcutStyles = (0, _xcss.xcss)({
119
- backgroundColor: 'color.background.neutral',
120
- borderRadius: 'radius.small',
121
- color: 'color.text.subtle',
122
- font: 'font.body.small',
123
- paddingBlock: 'space.025',
124
- paddingInline: 'space.050'
125
- });
106
+ /**
107
+ * An Element Browser tile: the item's hover preview card (image, title, full description, and
108
+ * attribution), with its shortcut beside the title. Items without a preview image show their icon,
109
+ * always in a bordered box, above the title instead. The hover card's small title icon
110
+ * (`previewIcon`) is not shown, so a tile never repeats its icon.
111
+ */
126
112
  var ElementBrowserQuickInsertMenuItem = exports.ElementBrowserQuickInsertMenuItem = function ElementBrowserQuickInsertMenuItem(_ref) {
127
113
  var ariaLabel = _ref.ariaLabel,
128
114
  description = _ref.description,
129
115
  iconBefore = _ref.iconBefore,
130
- isDisabled = _ref.isDisabled,
116
+ _ref$isDisabled = _ref.isDisabled,
117
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
131
118
  lozenge = _ref.lozenge,
132
119
  onSelect = _ref.onSelect,
120
+ preview = _ref.preview,
121
+ previewImageUrls = _ref.previewImageUrls,
133
122
  shortcut = _ref.shortcut,
134
123
  titleContent = _ref.titleContent,
135
- _ref$shouldWrapIcon = _ref.shouldWrapIcon,
136
- shouldWrapIcon = _ref$shouldWrapIcon === void 0 ? true : _ref$shouldWrapIcon,
137
124
  title = _ref.title;
138
125
  var _useQuickInsertContex = (0, _useQuickInsertContext.useQuickInsertContext)(),
139
126
  item = _useQuickInsertContex.item;
@@ -145,50 +132,36 @@ var ElementBrowserQuickInsertMenuItem = exports.ElementBrowserQuickInsertMenuIte
145
132
  isSelected = _ref2.isSelected;
146
133
  var itemDescription = description !== null && description !== void 0 ? description : item === null || item === void 0 ? void 0 : item.description;
147
134
  var handleClick = (0, _quickInsertMenuItemUtils.useQuickInsertMenuItemSelection)(onSelect);
148
- var itemStyles = (0, _react.useMemo)(function () {
149
- return [isDisabled ? borderlessDisabledItemStyles : isSelected ? borderlessSelectedItemStyles : borderlessItemStyles, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command') && !isDisabled && !isSelected && hoveredItemStyles];
150
- }, [isDisabled, isSelected]);
151
- var itemTitle = titleContent !== null && titleContent !== void 0 ? titleContent : /*#__PURE__*/_react.default.createElement(_text.Text, {
152
- color: isDisabled ? 'color.text.disabled' : 'color.text',
153
- maxLines: 1,
154
- size: "medium",
155
- weight: "medium"
156
- }, title);
157
-
158
- // Disabled items keep the dimmed colour inherited from the item.
135
+ var descriptionId = (0, _react.useId)();
136
+ var resolvedPreview = (0, _react.useMemo)(function () {
137
+ return preview !== null && preview !== void 0 ? preview : previewImageUrls ? {
138
+ image: previewImageUrls
139
+ } : {};
140
+ }, [preview, previewImageUrls]);
141
+ var hasDescription = Boolean(itemDescription || resolvedPreview.attribution || shortcut);
159
142
  var icon = iconBefore ? /*#__PURE__*/_react.default.createElement("span", {
160
143
  className: (0, _runtime.ax)(["_rpzpjdj5 _1pgcjdj5", !isDisabled && "_syaz1q3r"])
161
- }, iconBefore) : iconBefore;
144
+ }, iconBefore) : undefined;
162
145
  return /*#__PURE__*/_react.default.createElement(_pressable.Pressable, {
163
- "aria-label": ariaLabel,
146
+ "aria-describedby": hasDescription ? descriptionId : undefined,
147
+ "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : title,
164
148
  "aria-selected": isSelected,
165
149
  id: id,
166
150
  isDisabled: isDisabled,
167
151
  onClick: handleClick,
168
152
  role: "option",
169
- tabIndex: isSelected ? 0 : -1
170
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Memoizes composition of module-scoped xcss styles for Pressable.
171
- ,
172
- xcss: itemStyles
173
- }, iconBefore && shouldWrapIcon ? /*#__PURE__*/_react.default.createElement(_box.Box, {
174
- xcss: (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command') ? iconLargeStyles : iconStyles
175
- }, icon) : icon, /*#__PURE__*/_react.default.createElement(_stack.Stack, {
176
- space: "space.050",
177
- grow: "fill"
178
- }, /*#__PURE__*/_react.default.createElement(_inline.Inline, {
179
- alignBlock: "center",
180
- spread: "space-between",
181
- space: "space.100"
182
- }, lozenge ? /*#__PURE__*/_react.default.createElement(_inline.Inline, {
183
- alignBlock: "center",
184
- space: "space.100"
185
- }, itemTitle, lozenge) : itemTitle, shortcut && /*#__PURE__*/_react.default.createElement(_box.Box, {
186
- as: "span",
187
- xcss: shortcutStyles
188
- }, shortcut)), itemDescription && /*#__PURE__*/_react.default.createElement(_text.Text, {
189
- color: "color.text.subtlest",
190
- maxLines: 2,
191
- size: "small",
192
- weight: "regular"
193
- }, itemDescription)));
153
+ tabIndex: isSelected ? 0 : -1,
154
+ xcss: isDisabled ? disabledCardStyles : isSelected ? selectedCardStyles : cardStyles
155
+ }, !resolvedPreview.image && icon && /*#__PURE__*/_react.default.createElement(_box.Box, {
156
+ xcss: iconStyles
157
+ }, icon), /*#__PURE__*/_react.default.createElement(_QuickInsertPreviewContent.QuickInsertPreviewContent, {
158
+ description: itemDescription,
159
+ id: hasDescription ? descriptionId : undefined,
160
+ isDisabled: isDisabled,
161
+ lozenge: lozenge,
162
+ preview: resolvedPreview,
163
+ shortcut: shortcut,
164
+ shouldClampText: false,
165
+ title: titleContent !== null && titleContent !== void 0 ? titleContent : title
166
+ }));
194
167
  };
@@ -1,50 +1,13 @@
1
- ._11c81qyo{font:var(--ds-font-heading-xsmall,normal 653 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
- ._11c8fhey{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
3
- ._11c8wadc{font:var(--ds-font-body-small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
4
- ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
5
1
  ._2rko1qi0{border-radius:var(--ds-radius-medium,6px)}
6
- ._zulp1b66{gap:var(--ds-space-050,4px)}
7
- ._zulpu2gc{gap:var(--ds-space-100,8px)}
8
2
  ._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
9
- ._1rjcutpp{padding-block:var(--ds-space-150,9pt)}
10
- ._16jlidpf{flex-grow:0}
11
- ._16jlkb7n{flex-grow:1}
12
- ._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
3
+ ._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
13
4
  ._18m915vq{overflow-y:hidden}
14
- ._1bah1h6o{justify-content:center}
15
- ._1bsb1osq{width:100%}
16
- ._1bsb7vkz{width:1pc}
17
5
  ._1bsbncxg{width:264px}
18
- ._1bsbp3fh{width:15pc}
19
- ._1e0c1txw{display:flex}
20
- ._1e0c1ule{display:block}
21
- ._1e0ccj1k{display:-webkit-box}
22
- ._1i4qfg65{overflow-wrap:anywhere}
23
- ._1o9zidpf{flex-shrink:0}
24
- ._1o9zkb7n{flex-shrink:1}
25
6
  ._1pby16oo{z-index:510}
26
7
  ._1reo15vq{overflow-x:hidden}
27
- ._1ul9idpf{min-width:0}
28
- ._1yyjcs5v{-webkit-line-clamp:2}
29
- ._1yyjegat{-webkit-line-clamp:4}
30
- ._2lx21bp4{flex-direction:column}
31
- ._3um015vq{visibility:hidden}
32
- ._4cvr1h6o{align-items:center}
33
- ._4t3i1osq{height:100%}
34
- ._4t3i68cl{height:90pt}
35
- ._4t3i7vkz{height:1pc}
36
- ._5ral1f51{object-fit:contain}
37
- ._6rthu2gc{margin-block-end:var(--ds-space-100,8px)}
38
8
  ._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
39
- ._bfhkhfxm{background-color:var(--ds-surface-sunken,#f8f8f8)}
40
9
  ._c71l1kw7{max-height:inherit}
41
10
  ._c71lk6is{max-height:calc(100vh - 1pc)}
42
- ._i0dl1wug{flex-basis:auto}
43
- ._i0dlexct{flex-basis:16px}
44
- ._k48pwu06{font-weight:var(--ds-font-weight-bold,653)}
45
11
  ._p12f1oec{max-width:calc(100vw - 1pc)}
46
12
  ._p12f1osq{max-width:100%}
47
- ._sudp1e54{-webkit-box-orient:vertical}
48
- ._syazazsu{color:var(--ds-text-subtle,#505258)}
49
- ._syazi7uo{color:var(--ds-text,#292a2e)}
50
13
  ._vchhusvi{box-sizing:border-box}
@@ -13,15 +13,10 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _reactDom = require("react-dom");
15
15
  var _bindEventListener = require("bind-event-listener");
16
- var _reactIntl = require("react-intl");
17
16
  var _reactPopper = require("@atlaskit/popper/react-popper");
18
- var _box = require("@atlaskit/primitives/compiled/box");
19
- var _inline = require("@atlaskit/primitives/compiled/inline");
20
- var _text = require("@atlaskit/primitives/compiled/text");
21
- var _useThemeObserver2 = require("@atlaskit/tokens/use-theme-observer");
22
- var _messages = require("./messages");
17
+ var _QuickInsertPreviewContent = require("./QuickInsertPreviewContent");
23
18
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
24
- // Viewport calculations and multiline clamping require styles outside @atlaskit/css's schema.
19
+ // Viewport calculations require styles outside @atlaskit/css's schema.
25
20
  // Viewport clamping requires modifiers, which the top-layer adapter does not support.
26
21
  var PREVIEW_MODIFIERS = [{
27
22
  name: 'offset',
@@ -47,25 +42,9 @@ var PREVIEW_MODIFIERS = [{
47
42
  rootBoundary: 'viewport'
48
43
  }
49
44
  }];
50
- var layoutStyles = {
51
- titleRow: "_1ul9idpf",
52
- titleIcon: "_4cvr1h6o _1e0c1txw _1o9zidpf _1bah1h6o",
53
- attributionText: "_16jlkb7n _1o9zkb7n _i0dl1wug _1ul9idpf _1i4qfg65"
54
- };
55
45
  var styles = {
56
46
  positioner: "_c71lk6is _p12f1oec _1pby16oo",
57
- panel: "_2rko1qi0 _1reo15vq _18m915vq _1rjcutpp _18zrutpp _vchhusvi _bfhk1bhr _16qs130s _c71l1kw7 _p12f1osq _1bsbncxg",
58
- content: "_zulpu2gc _1e0c1txw _2lx21bp4",
59
- title: "_11c81qyo _16jlkb7n _1o9zkb7n _i0dl1wug _1reo15vq _18m915vq _syazazsu _1ul9idpf _1i4qfg65 _1e0ccj1k _sudp1e54 _1yyjcs5v",
60
- unclampedTitle: "_11c8fhey _16jlkb7n _1o9zkb7n _i0dl1wug _syazi7uo _k48pwu06 _1ul9idpf _1i4qfg65",
61
- description: "_11c8fhey _1reo15vq _18m915vq _syazi7uo _1e0ccj1k _1i4qfg65 _sudp1e54 _1yyjegat",
62
- unclampedDescription: "_11c8fhey _syazi7uo _1i4qfg65",
63
- imageArea: "_2rko12b0 _1reo15vq _18m915vq _bfhkhfxm _4t3i68cl _6rthu2gc _p12f1osq _1bsbp3fh",
64
- image: "_1e0c1ule _4t3i1osq _5ral1f51 _1bsb1osq",
65
- imageHidden: "_3um015vq",
66
- attribution: "_zulp1b66 _4cvr1h6o _syazazsu _1e0c1txw _1i4qfg65",
67
- compactAttribution: "_11c8wadc",
68
- attributionIcon: "_16jlidpf _1o9zidpf _i0dlexct _4cvr1h6o _1e0c1txw _4t3i7vkz _1bah1h6o _1bsb7vkz"
47
+ panel: "_2rko1qi0 _1reo15vq _18m915vq _1rjcutpp _18zrutpp _vchhusvi _bfhk1bhr _16qs130s _c71l1kw7 _p12f1osq _1bsbncxg"
69
48
  };
70
49
 
71
50
  /** The selected item's description and attribution are announced through its aria-describedby. */
@@ -80,9 +59,6 @@ var QuickInsertHoverPreview = exports.QuickInsertHoverPreview = function QuickIn
80
59
  shouldClampText = _ref$shouldClampText === void 0 ? true : _ref$shouldClampText,
81
60
  title = _ref.title,
82
61
  titleContent = _ref.titleContent;
83
- var _useThemeObserver = (0, _useThemeObserver2.useThemeObserver)(),
84
- colorMode = _useThemeObserver.colorMode;
85
- var imageUrl = preview.image ? colorMode === 'dark' && preview.image.dark ? preview.image.dark : preview.image.light : undefined;
86
62
  var hasAccessibleContent = Boolean(description || preview.attribution);
87
63
  var portalTarget = popupsMountPoint !== null && popupsMountPoint !== void 0 ? popupsMountPoint : referenceElement.ownerDocument.body;
88
64
  return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement(_reactPopper.Popper, {
@@ -102,7 +78,6 @@ var QuickInsertHoverPreview = exports.QuickInsertHoverPreview = function QuickIn
102
78
  description: description,
103
79
  icon: icon,
104
80
  id: hasAccessibleContent ? id : undefined,
105
- imageUrl: imageUrl,
106
81
  preview: preview,
107
82
  popupsMountPoint: popupsMountPoint,
108
83
  referenceElement: referenceElement,
@@ -114,11 +89,9 @@ var QuickInsertHoverPreview = exports.QuickInsertHoverPreview = function QuickIn
114
89
  }), portalTarget);
115
90
  };
116
91
  var QuickInsertPreviewPanel = function QuickInsertPreviewPanel(_ref3) {
117
- var _preview$attribution, _preview$attribution2;
118
92
  var description = _ref3.description,
119
93
  icon = _ref3.icon,
120
94
  id = _ref3.id,
121
- imageUrl = _ref3.imageUrl,
122
95
  preview = _ref3.preview,
123
96
  popupsMountPoint = _ref3.popupsMountPoint,
124
97
  referenceElement = _ref3.referenceElement,
@@ -126,15 +99,10 @@ var QuickInsertPreviewPanel = function QuickInsertPreviewPanel(_ref3) {
126
99
  title = _ref3.title,
127
100
  titleContent = _ref3.titleContent,
128
101
  update = _ref3.update;
129
- var _useIntl = (0, _reactIntl.useIntl)(),
130
- formatMessage = _useIntl.formatMessage;
131
102
  var _useState = (0, _react.useState)(null),
132
103
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
133
104
  panelElement = _useState2[0],
134
105
  setPanelElement = _useState2[1];
135
- var AttributionIcon = (_preview$attribution = preview.attribution) === null || _preview$attribution === void 0 ? void 0 : _preview$attribution.icon;
136
- var attributionName = (_preview$attribution2 = preview.attribution) === null || _preview$attribution2 === void 0 ? void 0 : _preview$attribution2.name;
137
- var formattedAttributionName = typeof attributionName === 'string' ? attributionName : attributionName ? formatMessage(attributionName) : '';
138
106
  (0, _react.useLayoutEffect)(function () {
139
107
  var _ownerDocument$defaul;
140
108
  void update();
@@ -170,63 +138,11 @@ var QuickInsertPreviewPanel = function QuickInsertPreviewPanel(_ref3) {
170
138
  role: id ? 'tooltip' : undefined,
171
139
  "data-testid": "quick-insert-preview-panel",
172
140
  className: (0, _runtime.ax)([styles.panel])
173
- }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, imageUrl && /*#__PURE__*/_react.default.createElement(PreviewImage, {
174
- key: imageUrl,
175
- imageUrl: imageUrl
176
- }), /*#__PURE__*/_react.default.createElement("div", {
177
- className: (0, _runtime.ax)([styles.content])
178
- }, /*#__PURE__*/_react.default.createElement(_inline.Inline, {
179
- alignBlock: "center",
180
- space: "space.100",
181
- xcss: layoutStyles.titleRow,
182
- "aria-hidden": "true"
183
- }, icon && /*#__PURE__*/_react.default.createElement(_box.Box, {
184
- as: "span",
185
- "aria-hidden": "true",
186
- xcss: layoutStyles.titleIcon
187
- }, icon), /*#__PURE__*/_react.default.createElement("span", {
188
- className: (0, _runtime.ax)([shouldClampText && styles.title, !shouldClampText && styles.unclampedTitle])
189
- }, titleContent !== null && titleContent !== void 0 ? titleContent : title)), description && /*#__PURE__*/_react.default.createElement("div", {
190
- className: (0, _runtime.ax)([shouldClampText && styles.description, !shouldClampText && styles.unclampedDescription])
191
- }, description), preview.attribution && /*#__PURE__*/_react.default.createElement("div", {
192
- className: (0, _runtime.ax)([styles.attribution, shouldClampText && styles.compactAttribution])
193
- }, AttributionIcon && /*#__PURE__*/_react.default.createElement("span", {
194
- "aria-hidden": "true",
195
- className: (0, _runtime.ax)([styles.attributionIcon])
196
- }, /*#__PURE__*/_react.default.createElement(AttributionIcon, null)), /*#__PURE__*/_react.default.createElement("span", {
197
- className: (0, _runtime.ax)([layoutStyles.attributionText])
198
- }, /*#__PURE__*/_react.default.createElement(_text.Text, {
199
- size: "small",
200
- color: "color.text.subtle"
201
- }, AttributionIcon ? formattedAttributionName : formatMessage(_messages.messages.previewAttributionBy, {
202
- name: formattedAttributionName
203
- })))))));
204
- };
205
- var PreviewImage = function PreviewImage(_ref4) {
206
- var imageUrl = _ref4.imageUrl;
207
- var _useState3 = (0, _react.useState)(false),
208
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
209
- hasFailed = _useState4[0],
210
- setHasFailed = _useState4[1];
211
- var _useState5 = (0, _react.useState)(false),
212
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
213
- hasLoaded = _useState6[0],
214
- setHasLoaded = _useState6[1];
215
- return /*#__PURE__*/_react.default.createElement("div", {
216
- "aria-hidden": "true",
217
- "data-testid": "quick-insert-preview-image-area",
218
- className: (0, _runtime.ax)([styles.imageArea])
219
- }, !hasFailed && /*#__PURE__*/_react.default.createElement("img", {
220
- "aria-hidden": "true",
221
- "data-testid": "quick-insert-hover-preview",
222
- src: imageUrl,
223
- alt: "",
224
- onLoad: function onLoad() {
225
- return setHasLoaded(true);
226
- },
227
- onError: function onError() {
228
- return setHasFailed(true);
229
- },
230
- className: (0, _runtime.ax)([styles.image, !hasLoaded && styles.imageHidden])
141
+ }, /*#__PURE__*/_react.default.createElement(_QuickInsertPreviewContent.QuickInsertPreviewContent, {
142
+ description: description,
143
+ icon: icon,
144
+ preview: preview,
145
+ shouldClampText: shouldClampText,
146
+ title: titleContent !== null && titleContent !== void 0 ? titleContent : title
231
147
  }));
232
148
  };
@@ -37,9 +37,10 @@ var QuickInsertMenuItem = exports.QuickInsertMenuItem = function QuickInsertMenu
37
37
  isDisabled: isDisabled,
38
38
  lozenge: lozenge,
39
39
  onSelect: onSelect,
40
+ preview: preview,
41
+ previewImageUrls: previewImageUrls,
40
42
  shortcut: shortcut,
41
43
  titleContent: titleContent,
42
- shouldWrapIcon: shouldWrapIcon,
43
44
  title: title
44
45
  }) : /*#__PURE__*/_react.default.createElement(_CompactQuickInsertMenuItem.CompactQuickInsertMenuItem, {
45
46
  ariaLabel: ariaLabel,
@@ -0,0 +1,38 @@
1
+ ._11c81qyo{font:var(--ds-font-heading-xsmall,normal 653 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
+ ._11c8fhey{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
3
+ ._11c8wadc{font:var(--ds-font-body-small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
4
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
5
+ ._zulp1b66{gap:var(--ds-space-050,4px)}
6
+ ._zulpu2gc{gap:var(--ds-space-100,8px)}
7
+ ._16jlidpf{flex-grow:0}
8
+ ._16jlkb7n{flex-grow:1}
9
+ ._18m915vq{overflow-y:hidden}
10
+ ._1bah1h6o{justify-content:center}
11
+ ._1bsb1osq{width:100%}
12
+ ._1bsb7vkz{width:1pc}
13
+ ._1e0c1txw{display:flex}
14
+ ._1e0c1ule{display:block}
15
+ ._1e0ccj1k{display:-webkit-box}
16
+ ._1i4qfg65{overflow-wrap:anywhere}
17
+ ._1o9zidpf{flex-shrink:0}
18
+ ._1o9zkb7n{flex-shrink:1}
19
+ ._1pfh1wug{margin-block-start:auto}
20
+ ._1reo15vq{overflow-x:hidden}
21
+ ._1ul9idpf{min-width:0}
22
+ ._1yyjcs5v{-webkit-line-clamp:2}
23
+ ._1yyjegat{-webkit-line-clamp:4}
24
+ ._2lx21bp4{flex-direction:column}
25
+ ._3um015vq{visibility:hidden}
26
+ ._4cvr1h6o{align-items:center}
27
+ ._4t3i1osq{height:100%}
28
+ ._4t3i68cl{height:90pt}
29
+ ._4t3i7vkz{height:1pc}
30
+ ._5ral1f51{object-fit:contain}
31
+ ._6rthu2gc{margin-block-end:var(--ds-space-100,8px)}
32
+ ._bfhkhfxm{background-color:var(--ds-surface-sunken,#f8f8f8)}
33
+ ._i0dl1wug{flex-basis:auto}
34
+ ._i0dlexct{flex-basis:16px}
35
+ ._sudp1e54{-webkit-box-orient:vertical}
36
+ ._syaz1gmx{color:var(--ds-text-disabled,#080f214a)}
37
+ ._syazazsu{color:var(--ds-text-subtle,#505258)}
38
+ ._syazi7uo{color:var(--ds-text,#292a2e)}