@atlaskit/editor-common 134.7.1 → 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 (50) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/monitoring/error.js +1 -1
  3. package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
  4. package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.js +6 -6
  5. package/dist/cjs/quick-insert/ElementBrowserQuickInsertMenuItem.js +76 -103
  6. package/dist/cjs/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
  7. package/dist/cjs/quick-insert/QuickInsertHoverPreview.js +9 -93
  8. package/dist/cjs/quick-insert/QuickInsertMenuItem.js +2 -1
  9. package/dist/cjs/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
  10. package/dist/cjs/quick-insert/QuickInsertPreviewContent.js +142 -0
  11. package/dist/cjs/quick-insert/QuickInsertShortcut.compiled.css +10 -0
  12. package/dist/cjs/quick-insert/QuickInsertShortcut.js +28 -0
  13. package/dist/cjs/ui/DropList/index.js +1 -1
  14. package/dist/cjs/ui/Layer/index.js +14 -208
  15. package/dist/cjs/vanilla-tooltip/index.js +5 -14
  16. package/dist/es2019/monitoring/error.js +1 -1
  17. package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
  18. package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.js +6 -6
  19. package/dist/es2019/quick-insert/ElementBrowserQuickInsertMenuItem.js +74 -101
  20. package/dist/es2019/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
  21. package/dist/es2019/quick-insert/QuickInsertHoverPreview.js +10 -86
  22. package/dist/es2019/quick-insert/QuickInsertMenuItem.js +2 -1
  23. package/dist/es2019/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
  24. package/dist/es2019/quick-insert/QuickInsertPreviewContent.js +126 -0
  25. package/dist/es2019/quick-insert/QuickInsertShortcut.compiled.css +10 -0
  26. package/dist/es2019/quick-insert/QuickInsertShortcut.js +19 -0
  27. package/dist/es2019/ui/DropList/index.js +1 -1
  28. package/dist/es2019/ui/Layer/index.js +15 -192
  29. package/dist/es2019/vanilla-tooltip/index.js +7 -15
  30. package/dist/esm/monitoring/error.js +1 -1
  31. package/dist/esm/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
  32. package/dist/esm/quick-insert/CompactQuickInsertMenuItem.js +6 -6
  33. package/dist/esm/quick-insert/ElementBrowserQuickInsertMenuItem.js +77 -104
  34. package/dist/esm/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
  35. package/dist/esm/quick-insert/QuickInsertHoverPreview.js +10 -93
  36. package/dist/esm/quick-insert/QuickInsertMenuItem.js +2 -1
  37. package/dist/esm/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
  38. package/dist/esm/quick-insert/QuickInsertPreviewContent.js +135 -0
  39. package/dist/esm/quick-insert/QuickInsertShortcut.compiled.css +10 -0
  40. package/dist/esm/quick-insert/QuickInsertShortcut.js +21 -0
  41. package/dist/esm/ui/DropList/index.js +1 -1
  42. package/dist/esm/ui/Layer/index.js +15 -211
  43. package/dist/esm/vanilla-tooltip/index.js +7 -15
  44. package/dist/types/quick-insert/ElementBrowserQuickInsertMenuItem.d.ts +7 -1
  45. package/dist/types/quick-insert/QuickInsertHoverPreview.d.ts +0 -1
  46. package/dist/types/quick-insert/QuickInsertPreviewContent.d.ts +24 -0
  47. package/dist/types/quick-insert/QuickInsertShortcut.d.ts +13 -0
  48. package/dist/types/ui/Layer/index.d.ts +1 -15
  49. package/dist/types/vanilla-tooltip/index.d.ts +1 -1
  50. package/package.json +2 -7
@@ -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}
@@ -5,17 +5,13 @@ import { ax, ix } from "@compiled/react/runtime";
5
5
  import React, { useLayoutEffect, useState } from 'react';
6
6
  import { createPortal } from 'react-dom';
7
7
 
8
- // Viewport calculations and multiline clamping require styles outside @atlaskit/css's schema.
8
+ // Viewport calculations require styles outside @atlaskit/css's schema.
9
9
 
10
10
  import { bind } from 'bind-event-listener';
11
- import { useIntl } from 'react-intl';
11
+
12
12
  // Viewport clamping requires modifiers, which the top-layer adapter does not support.
13
13
  import { Popper } from '@atlaskit/popper/react-popper';
14
- import { Box } from '@atlaskit/primitives/compiled/box';
15
- import { Inline } from '@atlaskit/primitives/compiled/inline';
16
- import { Text } from '@atlaskit/primitives/compiled/text';
17
- import { useThemeObserver } from '@atlaskit/tokens/use-theme-observer';
18
- import { messages } from './messages';
14
+ import { QuickInsertPreviewContent } from './QuickInsertPreviewContent';
19
15
  var PREVIEW_MODIFIERS = [{
20
16
  name: 'offset',
21
17
  options: {
@@ -40,25 +36,9 @@ var PREVIEW_MODIFIERS = [{
40
36
  rootBoundary: 'viewport'
41
37
  }
42
38
  }];
43
- var layoutStyles = {
44
- titleRow: "_1ul9idpf",
45
- titleIcon: "_4cvr1h6o _1e0c1txw _1o9zidpf _1bah1h6o",
46
- attributionText: "_16jlkb7n _1o9zkb7n _i0dl1wug _1ul9idpf _1i4qfg65"
47
- };
48
39
  var styles = {
49
40
  positioner: "_c71lk6is _p12f1oec _1pby16oo",
50
- panel: "_2rko1qi0 _1reo15vq _18m915vq _1rjcutpp _18zrutpp _vchhusvi _bfhk1bhr _16qs130s _c71l1kw7 _p12f1osq _1bsbncxg",
51
- content: "_zulpu2gc _1e0c1txw _2lx21bp4",
52
- title: "_11c81qyo _16jlkb7n _1o9zkb7n _i0dl1wug _1reo15vq _18m915vq _syazazsu _1ul9idpf _1i4qfg65 _1e0ccj1k _sudp1e54 _1yyjcs5v",
53
- unclampedTitle: "_11c8fhey _16jlkb7n _1o9zkb7n _i0dl1wug _syazi7uo _k48pwu06 _1ul9idpf _1i4qfg65",
54
- description: "_11c8fhey _1reo15vq _18m915vq _syazi7uo _1e0ccj1k _1i4qfg65 _sudp1e54 _1yyjegat",
55
- unclampedDescription: "_11c8fhey _syazi7uo _1i4qfg65",
56
- imageArea: "_2rko12b0 _1reo15vq _18m915vq _bfhkhfxm _4t3i68cl _6rthu2gc _p12f1osq _1bsbp3fh",
57
- image: "_1e0c1ule _4t3i1osq _5ral1f51 _1bsb1osq",
58
- imageHidden: "_3um015vq",
59
- attribution: "_zulp1b66 _4cvr1h6o _syazazsu _1e0c1txw _1i4qfg65",
60
- compactAttribution: "_11c8wadc",
61
- attributionIcon: "_16jlidpf _1o9zidpf _i0dlexct _4cvr1h6o _1e0c1txw _4t3i7vkz _1bah1h6o _1bsb7vkz"
41
+ panel: "_2rko1qi0 _1reo15vq _18m915vq _1rjcutpp _18zrutpp _vchhusvi _bfhk1bhr _16qs130s _c71l1kw7 _p12f1osq _1bsbncxg"
62
42
  };
63
43
 
64
44
  /** The selected item's description and attribution are announced through its aria-describedby. */
@@ -73,9 +53,6 @@ export var QuickInsertHoverPreview = function QuickInsertHoverPreview(_ref) {
73
53
  shouldClampText = _ref$shouldClampText === void 0 ? true : _ref$shouldClampText,
74
54
  title = _ref.title,
75
55
  titleContent = _ref.titleContent;
76
- var _useThemeObserver = useThemeObserver(),
77
- colorMode = _useThemeObserver.colorMode;
78
- var imageUrl = preview.image ? colorMode === 'dark' && preview.image.dark ? preview.image.dark : preview.image.light : undefined;
79
56
  var hasAccessibleContent = Boolean(description || preview.attribution);
80
57
  var portalTarget = popupsMountPoint !== null && popupsMountPoint !== void 0 ? popupsMountPoint : referenceElement.ownerDocument.body;
81
58
  return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(Popper, {
@@ -95,7 +72,6 @@ export var QuickInsertHoverPreview = function QuickInsertHoverPreview(_ref) {
95
72
  description: description,
96
73
  icon: icon,
97
74
  id: hasAccessibleContent ? id : undefined,
98
- imageUrl: imageUrl,
99
75
  preview: preview,
100
76
  popupsMountPoint: popupsMountPoint,
101
77
  referenceElement: referenceElement,
@@ -107,11 +83,9 @@ export var QuickInsertHoverPreview = function QuickInsertHoverPreview(_ref) {
107
83
  }), portalTarget);
108
84
  };
109
85
  var QuickInsertPreviewPanel = function QuickInsertPreviewPanel(_ref3) {
110
- var _preview$attribution, _preview$attribution2;
111
86
  var description = _ref3.description,
112
87
  icon = _ref3.icon,
113
88
  id = _ref3.id,
114
- imageUrl = _ref3.imageUrl,
115
89
  preview = _ref3.preview,
116
90
  popupsMountPoint = _ref3.popupsMountPoint,
117
91
  referenceElement = _ref3.referenceElement,
@@ -119,15 +93,10 @@ var QuickInsertPreviewPanel = function QuickInsertPreviewPanel(_ref3) {
119
93
  title = _ref3.title,
120
94
  titleContent = _ref3.titleContent,
121
95
  update = _ref3.update;
122
- var _useIntl = useIntl(),
123
- formatMessage = _useIntl.formatMessage;
124
96
  var _useState = useState(null),
125
97
  _useState2 = _slicedToArray(_useState, 2),
126
98
  panelElement = _useState2[0],
127
99
  setPanelElement = _useState2[1];
128
- var AttributionIcon = (_preview$attribution = preview.attribution) === null || _preview$attribution === void 0 ? void 0 : _preview$attribution.icon;
129
- var attributionName = (_preview$attribution2 = preview.attribution) === null || _preview$attribution2 === void 0 ? void 0 : _preview$attribution2.name;
130
- var formattedAttributionName = typeof attributionName === 'string' ? attributionName : attributionName ? formatMessage(attributionName) : '';
131
100
  useLayoutEffect(function () {
132
101
  var _ownerDocument$defaul;
133
102
  void update();
@@ -163,63 +132,11 @@ var QuickInsertPreviewPanel = function QuickInsertPreviewPanel(_ref3) {
163
132
  role: id ? 'tooltip' : undefined,
164
133
  "data-testid": "quick-insert-preview-panel",
165
134
  className: ax([styles.panel])
166
- }, /*#__PURE__*/React.createElement(React.Fragment, null, imageUrl && /*#__PURE__*/React.createElement(PreviewImage, {
167
- key: imageUrl,
168
- imageUrl: imageUrl
169
- }), /*#__PURE__*/React.createElement("div", {
170
- className: ax([styles.content])
171
- }, /*#__PURE__*/React.createElement(Inline, {
172
- alignBlock: "center",
173
- space: "space.100",
174
- xcss: layoutStyles.titleRow,
175
- "aria-hidden": "true"
176
- }, icon && /*#__PURE__*/React.createElement(Box, {
177
- as: "span",
178
- "aria-hidden": "true",
179
- xcss: layoutStyles.titleIcon
180
- }, icon), /*#__PURE__*/React.createElement("span", {
181
- className: ax([shouldClampText && styles.title, !shouldClampText && styles.unclampedTitle])
182
- }, titleContent !== null && titleContent !== void 0 ? titleContent : title)), description && /*#__PURE__*/React.createElement("div", {
183
- className: ax([shouldClampText && styles.description, !shouldClampText && styles.unclampedDescription])
184
- }, description), preview.attribution && /*#__PURE__*/React.createElement("div", {
185
- className: ax([styles.attribution, shouldClampText && styles.compactAttribution])
186
- }, AttributionIcon && /*#__PURE__*/React.createElement("span", {
187
- "aria-hidden": "true",
188
- className: ax([styles.attributionIcon])
189
- }, /*#__PURE__*/React.createElement(AttributionIcon, null)), /*#__PURE__*/React.createElement("span", {
190
- className: ax([layoutStyles.attributionText])
191
- }, /*#__PURE__*/React.createElement(Text, {
192
- size: "small",
193
- color: "color.text.subtle"
194
- }, AttributionIcon ? formattedAttributionName : formatMessage(messages.previewAttributionBy, {
195
- name: formattedAttributionName
196
- })))))));
197
- };
198
- var PreviewImage = function PreviewImage(_ref4) {
199
- var imageUrl = _ref4.imageUrl;
200
- var _useState3 = useState(false),
201
- _useState4 = _slicedToArray(_useState3, 2),
202
- hasFailed = _useState4[0],
203
- setHasFailed = _useState4[1];
204
- var _useState5 = useState(false),
205
- _useState6 = _slicedToArray(_useState5, 2),
206
- hasLoaded = _useState6[0],
207
- setHasLoaded = _useState6[1];
208
- return /*#__PURE__*/React.createElement("div", {
209
- "aria-hidden": "true",
210
- "data-testid": "quick-insert-preview-image-area",
211
- className: ax([styles.imageArea])
212
- }, !hasFailed && /*#__PURE__*/React.createElement("img", {
213
- "aria-hidden": "true",
214
- "data-testid": "quick-insert-hover-preview",
215
- src: imageUrl,
216
- alt: "",
217
- onLoad: function onLoad() {
218
- return setHasLoaded(true);
219
- },
220
- onError: function onError() {
221
- return setHasFailed(true);
222
- },
223
- className: ax([styles.image, !hasLoaded && styles.imageHidden])
135
+ }, /*#__PURE__*/React.createElement(QuickInsertPreviewContent, {
136
+ description: description,
137
+ icon: icon,
138
+ preview: preview,
139
+ shouldClampText: shouldClampText,
140
+ title: titleContent !== null && titleContent !== void 0 ? titleContent : title
224
141
  }));
225
142
  };
@@ -30,9 +30,10 @@ export var QuickInsertMenuItem = function QuickInsertMenuItem(_ref) {
30
30
  isDisabled: isDisabled,
31
31
  lozenge: lozenge,
32
32
  onSelect: onSelect,
33
+ preview: preview,
34
+ previewImageUrls: previewImageUrls,
33
35
  shortcut: shortcut,
34
36
  titleContent: titleContent,
35
- shouldWrapIcon: shouldWrapIcon,
36
37
  title: title
37
38
  }) : /*#__PURE__*/React.createElement(CompactQuickInsertMenuItem, {
38
39
  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)}
@@ -0,0 +1,135 @@
1
+ /* QuickInsertPreviewContent.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import "./QuickInsertPreviewContent.compiled.css";
4
+ import { ax, ix } from "@compiled/react/runtime";
5
+ import React, { useState } from 'react';
6
+
7
+ // Multiline clamping requires styles outside @atlaskit/css's schema.
8
+
9
+ import { useIntl } from 'react-intl';
10
+ import { Box } from '@atlaskit/primitives/compiled/box';
11
+ import { Inline } from '@atlaskit/primitives/compiled/inline';
12
+ import { Text } from '@atlaskit/primitives/compiled/text';
13
+ import { useThemeObserver } from '@atlaskit/tokens/use-theme-observer';
14
+ import { messages } from './messages';
15
+ import { QuickInsertShortcut } from './QuickInsertShortcut';
16
+ var layoutStyles = {
17
+ titleRow: "_1ul9idpf",
18
+ titleIcon: "_4cvr1h6o _1e0c1txw _1o9zidpf _1bah1h6o",
19
+ attributionText: "_16jlkb7n _1o9zkb7n _i0dl1wug _1ul9idpf _1i4qfg65"
20
+ };
21
+ var styles = {
22
+ root: "_1e0c1txw _2lx21bp4 _16jlkb7n _1ul9idpf",
23
+ content: "_zulpu2gc _1e0c1txw _2lx21bp4 _16jlkb7n",
24
+ title: "_11c81qyo _16jlidpf _1o9zkb7n _i0dl1wug _syazazsu _1ul9idpf _1i4qfg65",
25
+ clampedTitle: "_1reo15vq _18m915vq _1e0ccj1k _sudp1e54 _1yyjcs5v",
26
+ description: "_11c8fhey _1reo15vq _18m915vq _syazi7uo _1e0ccj1k _1i4qfg65 _sudp1e54 _1yyjegat",
27
+ unclampedDescription: "_11c8fhey _syazi7uo _1i4qfg65",
28
+ disabledText: "_syaz1gmx",
29
+ imageArea: "_2rko12b0 _1reo15vq _18m915vq _bfhkhfxm _4t3i68cl _6rthu2gc _1bsb1osq",
30
+ image: "_1e0c1ule _4t3i1osq _5ral1f51 _1bsb1osq",
31
+ imageHidden: "_3um015vq",
32
+ attribution: "_zulp1b66 _4cvr1h6o _syazazsu _1e0c1txw _1pfh1wug _1i4qfg65",
33
+ compactAttribution: "_11c8wadc",
34
+ attributionIcon: "_16jlidpf _1o9zidpf _i0dlexct _4cvr1h6o _1e0c1txw _4t3i7vkz _1bah1h6o _1bsb7vkz"
35
+ };
36
+
37
+ /**
38
+ * The image, title, description, and attribution shared by the Quick Insert hover preview and
39
+ * Element Browser tiles. It fills its container; callers own its width and accessible name.
40
+ */
41
+ export var QuickInsertPreviewContent = function QuickInsertPreviewContent(_ref) {
42
+ var _preview$attribution, _preview$attribution2;
43
+ var description = _ref.description,
44
+ icon = _ref.icon,
45
+ id = _ref.id,
46
+ _ref$isDisabled = _ref.isDisabled,
47
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
48
+ lozenge = _ref.lozenge,
49
+ preview = _ref.preview,
50
+ shortcut = _ref.shortcut,
51
+ _ref$shouldClampText = _ref.shouldClampText,
52
+ shouldClampText = _ref$shouldClampText === void 0 ? true : _ref$shouldClampText,
53
+ title = _ref.title;
54
+ var _useIntl = useIntl(),
55
+ formatMessage = _useIntl.formatMessage;
56
+ var _useThemeObserver = useThemeObserver(),
57
+ colorMode = _useThemeObserver.colorMode;
58
+ var imageUrl = preview.image ? colorMode === 'dark' && preview.image.dark ? preview.image.dark : preview.image.light : undefined;
59
+ var AttributionIcon = (_preview$attribution = preview.attribution) === null || _preview$attribution === void 0 ? void 0 : _preview$attribution.icon;
60
+ var attributionName = (_preview$attribution2 = preview.attribution) === null || _preview$attribution2 === void 0 ? void 0 : _preview$attribution2.name;
61
+ var formattedAttributionName = typeof attributionName === 'string' ? attributionName : attributionName ? formatMessage(attributionName) : '';
62
+ var titleRow = /*#__PURE__*/React.createElement(Inline, {
63
+ alignBlock: "center",
64
+ space: "space.100",
65
+ xcss: layoutStyles.titleRow
66
+ }, icon && /*#__PURE__*/React.createElement(Box, {
67
+ as: "span",
68
+ "aria-hidden": "true",
69
+ xcss: layoutStyles.titleIcon
70
+ }, icon), /*#__PURE__*/React.createElement("span", {
71
+ "aria-hidden": "true",
72
+ className: ax([styles.title, shouldClampText && styles.clampedTitle, isDisabled && styles.disabledText])
73
+ }, title), lozenge);
74
+ return /*#__PURE__*/React.createElement("div", {
75
+ id: id,
76
+ className: ax([styles.root])
77
+ }, imageUrl && /*#__PURE__*/React.createElement(PreviewImage, {
78
+ key: imageUrl,
79
+ imageUrl: imageUrl
80
+ }), /*#__PURE__*/React.createElement("div", {
81
+ className: ax([styles.content])
82
+ }, shortcut ? /*#__PURE__*/React.createElement(Inline, {
83
+ alignBlock: "start",
84
+ space: "space.100",
85
+ spread: "space-between"
86
+ }, titleRow, /*#__PURE__*/React.createElement(QuickInsertShortcut, {
87
+ isDisabled: isDisabled,
88
+ shortcut: shortcut
89
+ })) : titleRow, description && /*#__PURE__*/React.createElement("div", {
90
+ className: ax([shouldClampText && styles.description, !shouldClampText && styles.unclampedDescription, isDisabled && styles.disabledText])
91
+ }, description), preview.attribution && /*#__PURE__*/React.createElement("div", {
92
+ className: ax([styles.attribution, shouldClampText && styles.compactAttribution, isDisabled && styles.disabledText])
93
+ }, AttributionIcon && /*#__PURE__*/React.createElement("span", {
94
+ "aria-hidden": "true",
95
+ className: ax([styles.attributionIcon])
96
+ }, /*#__PURE__*/React.createElement(AttributionIcon, null)), /*#__PURE__*/React.createElement("span", {
97
+ className: ax([layoutStyles.attributionText])
98
+ }, /*#__PURE__*/React.createElement(Text, {
99
+ size: "small",
100
+ color: isDisabled ? 'color.text.disabled' : 'color.text.subtle'
101
+ }, AttributionIcon ? formattedAttributionName : formatMessage(messages.previewAttributionBy, {
102
+ name: formattedAttributionName
103
+ }))))));
104
+ };
105
+ var PreviewImage = function PreviewImage(_ref2) {
106
+ var imageUrl = _ref2.imageUrl;
107
+ var _useState = useState(false),
108
+ _useState2 = _slicedToArray(_useState, 2),
109
+ hasFailed = _useState2[0],
110
+ setHasFailed = _useState2[1];
111
+ var _useState3 = useState(false),
112
+ _useState4 = _slicedToArray(_useState3, 2),
113
+ hasLoaded = _useState4[0],
114
+ setHasLoaded = _useState4[1];
115
+ return /*#__PURE__*/React.createElement("div", {
116
+ "aria-hidden": "true",
117
+ "data-testid": "quick-insert-preview-image-area",
118
+ className: ax([styles.imageArea])
119
+ }, !hasFailed && /*#__PURE__*/React.createElement("img", {
120
+ "aria-hidden": "true",
121
+ "data-testid": "quick-insert-hover-preview"
122
+ // Element Browser tiles below the fold load as they scroll into view.
123
+ ,
124
+ loading: "lazy",
125
+ src: imageUrl,
126
+ alt: "",
127
+ onLoad: function onLoad() {
128
+ return setHasLoaded(true);
129
+ },
130
+ onError: function onError() {
131
+ return setHasFailed(true);
132
+ },
133
+ className: ax([styles.image, !hasLoaded && styles.imageHidden])
134
+ }));
135
+ };
@@ -0,0 +1,10 @@
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
+ ._18zr1b66{padding-inline:var(--ds-space-050,4px)}
4
+ ._1rjcv77o{padding-block:var(--ds-space-025,2px)}
5
+ ._1o9zidpf{flex-shrink:0}
6
+ ._bfhk187o{background-color:var(--ds-background-disabled,#0515240f)}
7
+ ._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
8
+ ._o5721q9c{white-space:nowrap}
9
+ ._syaz1gmx{color:var(--ds-text-disabled,#080f214a)}
10
+ ._syazazsu{color:var(--ds-text-subtle,#505258)}
@@ -0,0 +1,21 @@
1
+ /* QuickInsertShortcut.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ import "./QuickInsertShortcut.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ var styles = {
6
+ shortcut: "_2rko12b0 _11c8wadc _1rjcv77o _18zr1b66 _bfhki8nm _syazazsu _1o9zidpf _o5721q9c",
7
+ disabled: "_bfhk187o _syaz1gmx"
8
+ };
9
+
10
+ /**
11
+ * The keyboard or markdown shortcut chip shown beside a Quick Insert item's title, in both the
12
+ * slash-menu row and the Element Browser tile.
13
+ */
14
+ export var QuickInsertShortcut = function QuickInsertShortcut(_ref) {
15
+ var _ref$isDisabled = _ref.isDisabled,
16
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
17
+ shortcut = _ref.shortcut;
18
+ return /*#__PURE__*/React.createElement("span", {
19
+ className: ax([styles.shortcut, isDisabled && styles.disabled])
20
+ }, shortcut);
21
+ };
@@ -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 = "134.7.0";
23
+ var packageVersion = "134.7.1";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005