@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.
- package/CHANGELOG.md +22 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
- package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.js +6 -6
- package/dist/cjs/quick-insert/ElementBrowserQuickInsertMenuItem.js +76 -103
- package/dist/cjs/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
- package/dist/cjs/quick-insert/QuickInsertHoverPreview.js +9 -93
- package/dist/cjs/quick-insert/QuickInsertMenuItem.js +2 -1
- package/dist/cjs/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
- package/dist/cjs/quick-insert/QuickInsertPreviewContent.js +142 -0
- package/dist/cjs/quick-insert/QuickInsertShortcut.compiled.css +10 -0
- package/dist/cjs/quick-insert/QuickInsertShortcut.js +28 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/Layer/index.js +14 -208
- package/dist/cjs/vanilla-tooltip/index.js +5 -14
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
- package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.js +6 -6
- package/dist/es2019/quick-insert/ElementBrowserQuickInsertMenuItem.js +74 -101
- package/dist/es2019/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
- package/dist/es2019/quick-insert/QuickInsertHoverPreview.js +10 -86
- package/dist/es2019/quick-insert/QuickInsertMenuItem.js +2 -1
- package/dist/es2019/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
- package/dist/es2019/quick-insert/QuickInsertPreviewContent.js +126 -0
- package/dist/es2019/quick-insert/QuickInsertShortcut.compiled.css +10 -0
- package/dist/es2019/quick-insert/QuickInsertShortcut.js +19 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/Layer/index.js +15 -192
- package/dist/es2019/vanilla-tooltip/index.js +7 -15
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
- package/dist/esm/quick-insert/CompactQuickInsertMenuItem.js +6 -6
- package/dist/esm/quick-insert/ElementBrowserQuickInsertMenuItem.js +77 -104
- package/dist/esm/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
- package/dist/esm/quick-insert/QuickInsertHoverPreview.js +10 -93
- package/dist/esm/quick-insert/QuickInsertMenuItem.js +2 -1
- package/dist/esm/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
- package/dist/esm/quick-insert/QuickInsertPreviewContent.js +135 -0
- package/dist/esm/quick-insert/QuickInsertShortcut.compiled.css +10 -0
- package/dist/esm/quick-insert/QuickInsertShortcut.js +21 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/Layer/index.js +15 -211
- package/dist/esm/vanilla-tooltip/index.js +7 -15
- package/dist/types/quick-insert/ElementBrowserQuickInsertMenuItem.d.ts +7 -1
- package/dist/types/quick-insert/QuickInsertHoverPreview.d.ts +0 -1
- package/dist/types/quick-insert/QuickInsertPreviewContent.d.ts +24 -0
- package/dist/types/quick-insert/QuickInsertShortcut.d.ts +13 -0
- package/dist/types/ui/Layer/index.d.ts +1 -15
- package/dist/types/vanilla-tooltip/index.d.ts +1 -1
- package/package.json +2 -7
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "134.7.
|
|
16
|
+
const packageVersion = "134.7.1";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { Component, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
// eslint-disable-next-line @atlaskit/design-system/no-third-party-layering -- existing usage from before this rule was added
|
|
4
|
-
import Popper from 'popper.js';
|
|
5
|
-
// eslint-disable-next-line @atlaskit/design-system/no-third-party-layering -- existing usage from before this rule was added
|
|
6
|
-
|
|
7
|
-
// eslint-disable-line import/extensions
|
|
8
|
-
import rafSchedule from 'raf-schd';
|
|
1
|
+
import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
9
2
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
3
|
import { Popper as WrappedPopper } from '@atlaskit/popper/main';
|
|
4
|
+
import { Manager } from '@atlaskit/popper/manager';
|
|
11
5
|
import { positionPropToPopperPosition } from './internal/helpers';
|
|
12
|
-
const defaultState = {
|
|
13
|
-
hasExtractedStyles: false,
|
|
14
|
-
// We set these default offsets to prevent a flash of popper content in the wrong position
|
|
15
|
-
// which can cause incorrect height calculations. Popper will calculate these values
|
|
16
|
-
offsets: {
|
|
17
|
-
popper: {
|
|
18
|
-
left: -9999,
|
|
19
|
-
top: -9999,
|
|
20
|
-
position: null
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
cssPosition: 'absolute',
|
|
24
|
-
originalHeight: null,
|
|
25
|
-
maxHeight: null
|
|
26
|
-
};
|
|
27
6
|
function defaultOnPositioned() {}
|
|
28
7
|
const defaultProps = {
|
|
29
8
|
boundariesElement: 'viewport',
|
|
@@ -36,160 +15,6 @@ const defaultProps = {
|
|
|
36
15
|
isAlwaysFixed: false,
|
|
37
16
|
onPositioned: defaultOnPositioned
|
|
38
17
|
};
|
|
39
|
-
|
|
40
|
-
// Ignored via go/ees005
|
|
41
|
-
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
42
|
-
class LegacyLayer extends Component {
|
|
43
|
-
constructor(props) {
|
|
44
|
-
super(props);
|
|
45
|
-
_defineProperty(this, "targetRef", /*#__PURE__*/React.createRef());
|
|
46
|
-
_defineProperty(this, "contentRef", /*#__PURE__*/React.createRef());
|
|
47
|
-
_defineProperty(this, "extractStyles", state => {
|
|
48
|
-
if (state) {
|
|
49
|
-
const popperHeight = state.offsets.popper.height;
|
|
50
|
-
const left = Math.round(state.offsets.popper.left);
|
|
51
|
-
const top = Math.round(state.offsets.popper.top);
|
|
52
|
-
const cssPosition = 'absolute';
|
|
53
|
-
const originalHeight = this.state.originalHeight || popperHeight;
|
|
54
|
-
const maxHeight = this.calculateMaxHeight(originalHeight, popperHeight, top, cssPosition);
|
|
55
|
-
this.setState({
|
|
56
|
-
// position: fixed or absolute
|
|
57
|
-
cssPosition,
|
|
58
|
-
hasExtractedStyles: true,
|
|
59
|
-
transform: `translate3d(${left}px, ${top}px, 0px)`,
|
|
60
|
-
originalHeight,
|
|
61
|
-
maxHeight
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
this.state = defaultState;
|
|
66
|
-
this.extractStyles = rafSchedule(this.extractStyles.bind(this));
|
|
67
|
-
}
|
|
68
|
-
componentDidMount() {
|
|
69
|
-
this.applyPopper(this.props);
|
|
70
|
-
}
|
|
71
|
-
componentDidUpdate(prevProps, prevState) {
|
|
72
|
-
const {
|
|
73
|
-
onPositioned
|
|
74
|
-
} = this.props;
|
|
75
|
-
const {
|
|
76
|
-
hasExtractedStyles
|
|
77
|
-
} = this.state;
|
|
78
|
-
if (this.props !== prevProps) {
|
|
79
|
-
this.applyPopper(this.props);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// This flag is set the first time the position is calculated from Popper and applied to the content
|
|
83
|
-
if (!prevState.hasExtractedStyles && hasExtractedStyles && onPositioned) {
|
|
84
|
-
onPositioned();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
componentWillUnmount() {
|
|
88
|
-
// this.extractStyles.cancel();
|
|
89
|
-
if (this.popper) {
|
|
90
|
-
this.popper.destroy();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/* Calculate the max height of the popper if it's height is greater than the viewport to prevent
|
|
95
|
-
* the bottom of the popper not being viewable.
|
|
96
|
-
* Only works if the popper uses viewport as the boundary and has a fixed position ancestor.
|
|
97
|
-
*/
|
|
98
|
-
calculateMaxHeight(originalHeight, currentHeight, positionTop, cssPosition) {
|
|
99
|
-
let DocumentElementClientHeight = 0;
|
|
100
|
-
if (document.documentElement) {
|
|
101
|
-
DocumentElementClientHeight = document.documentElement.clientHeight;
|
|
102
|
-
}
|
|
103
|
-
if (cssPosition !== 'fixed') {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
const viewportHeight = Math.max(DocumentElementClientHeight, window.innerHeight || 0);
|
|
107
|
-
return viewportHeight < originalHeight && currentHeight + positionTop >= viewportHeight - 50 ?
|
|
108
|
-
// allow some spacing either side of viewport height
|
|
109
|
-
viewportHeight - 12 : null;
|
|
110
|
-
}
|
|
111
|
-
applyPopper(props) {
|
|
112
|
-
if (!this.targetRef.current || !this.contentRef.current) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if (this.popper) {
|
|
116
|
-
this.popper.destroy();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// "new Popper(...)" operation is very expensive when called on virtual DOM.
|
|
120
|
-
// This condition reduces the number of calls so we can run our tests faster
|
|
121
|
-
// (time was reduced from 100s to 13s).
|
|
122
|
-
if (!props.content) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// we wrap our target in a div so that we can safely get a reference to it, but we pass the
|
|
127
|
-
// actual target to popper
|
|
128
|
-
const isAlwaysFixed = false;
|
|
129
|
-
const actualTarget = this.targetRef.current.children[0];
|
|
130
|
-
const popperOpts = {
|
|
131
|
-
placement: positionPropToPopperPosition(props.position),
|
|
132
|
-
onCreate: this.extractStyles,
|
|
133
|
-
onUpdate: this.extractStyles,
|
|
134
|
-
modifiers: {
|
|
135
|
-
applyStyle: {
|
|
136
|
-
enabled: false
|
|
137
|
-
},
|
|
138
|
-
hide: {
|
|
139
|
-
enabled: false
|
|
140
|
-
},
|
|
141
|
-
offset: {
|
|
142
|
-
enabled: true,
|
|
143
|
-
offset: this.props.offset
|
|
144
|
-
},
|
|
145
|
-
flip: {
|
|
146
|
-
enabled: false,
|
|
147
|
-
flipVariations: true,
|
|
148
|
-
boundariesElement: 'viewport',
|
|
149
|
-
padding: 0 // leave 0 pixels between popper and the boundariesElement
|
|
150
|
-
},
|
|
151
|
-
preventOverflow: {
|
|
152
|
-
enabled: false,
|
|
153
|
-
escapeWithReference: true
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
positionFixed: isAlwaysFixed
|
|
157
|
-
};
|
|
158
|
-
if (actualTarget) {
|
|
159
|
-
this.popper = new Popper(actualTarget, this.contentRef.current, popperOpts);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
render() {
|
|
163
|
-
const {
|
|
164
|
-
transform,
|
|
165
|
-
hasExtractedStyles,
|
|
166
|
-
maxHeight
|
|
167
|
-
} = this.state;
|
|
168
|
-
const opacity = hasExtractedStyles ? {} : {
|
|
169
|
-
opacity: 0
|
|
170
|
-
};
|
|
171
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
172
|
-
ref: this.targetRef
|
|
173
|
-
}, this.props.children), /*#__PURE__*/React.createElement("div", {
|
|
174
|
-
ref: this.contentRef,
|
|
175
|
-
style: {
|
|
176
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
177
|
-
top: 0,
|
|
178
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
179
|
-
left: 0,
|
|
180
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
181
|
-
position: 'absolute',
|
|
182
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
183
|
-
transform,
|
|
184
|
-
maxHeight: maxHeight ? maxHeight : 'auto',
|
|
185
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
186
|
-
...opacity
|
|
187
|
-
}
|
|
188
|
-
}, this.props.content));
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
// working with extract-react-types
|
|
192
|
-
_defineProperty(LegacyLayer, "defaultProps", defaultProps);
|
|
193
18
|
function parseOffset({
|
|
194
19
|
offset
|
|
195
20
|
}) {
|
|
@@ -267,11 +92,17 @@ function PopperInterop({
|
|
|
267
92
|
}, [children]);
|
|
268
93
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
269
94
|
ref: targetRef
|
|
270
|
-
}, children), content
|
|
95
|
+
}, children), content ?
|
|
96
|
+
/*#__PURE__*/
|
|
97
|
+
// Mount `content` in the same commit as the Layer, before `referenceElement` resolves.
|
|
98
|
+
// Callers act on the content DOM in that commit: DropList focuses it, and menus
|
|
99
|
+
// dispatch `ArrowDown` to focus their first item. The `Manager` stops Popper from
|
|
100
|
+
// using an ancestor `Manager`'s reference until `referenceElement` is set.
|
|
101
|
+
React.createElement(Manager, null, /*#__PURE__*/React.createElement(WrappedPopper, {
|
|
271
102
|
modifiers: modifiers,
|
|
272
103
|
offset: parsedOffset,
|
|
273
104
|
placement: positionPropToPopperPosition(position),
|
|
274
|
-
referenceElement: referenceElement,
|
|
105
|
+
referenceElement: referenceElement !== null && referenceElement !== void 0 ? referenceElement : undefined,
|
|
275
106
|
strategy: strategy
|
|
276
107
|
}, ({
|
|
277
108
|
ref,
|
|
@@ -279,10 +110,10 @@ function PopperInterop({
|
|
|
279
110
|
}) => /*#__PURE__*/React.createElement("div", {
|
|
280
111
|
ref: ref,
|
|
281
112
|
style: style
|
|
282
|
-
}, content)) : /*#__PURE__*/React.createElement("div", null));
|
|
113
|
+
}, content))) : /*#__PURE__*/React.createElement("div", null));
|
|
283
114
|
}
|
|
284
115
|
|
|
285
|
-
/**
|
|
116
|
+
/** Positions `content` next to `children` with the ADS Popper wrapper. */
|
|
286
117
|
export default function Layer({
|
|
287
118
|
children = defaultProps.children,
|
|
288
119
|
content = defaultProps.content,
|
|
@@ -290,19 +121,11 @@ export default function Layer({
|
|
|
290
121
|
onPositioned = defaultProps.onPositioned,
|
|
291
122
|
position = defaultProps.position
|
|
292
123
|
}) {
|
|
293
|
-
|
|
294
|
-
return /*#__PURE__*/React.createElement(PopperInterop, {
|
|
295
|
-
content: content,
|
|
296
|
-
offset: offset,
|
|
297
|
-
onPositioned: onPositioned,
|
|
298
|
-
position: position,
|
|
299
|
-
strategy: "absolute"
|
|
300
|
-
}, children);
|
|
301
|
-
}
|
|
302
|
-
return /*#__PURE__*/React.createElement(LegacyLayer, {
|
|
124
|
+
return /*#__PURE__*/React.createElement(PopperInterop, {
|
|
303
125
|
content: content,
|
|
304
126
|
offset: offset,
|
|
305
127
|
onPositioned: onPositioned,
|
|
306
|
-
position: position
|
|
128
|
+
position: position,
|
|
129
|
+
strategy: "absolute"
|
|
307
130
|
}, children);
|
|
308
131
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
// eslint-disable-next-line @atlaskit/design-system/no-third-party-layering -- existing usage from before this rule was added
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { bind } from 'bind-event-listener';
|
|
5
5
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
6
|
-
import {
|
|
7
|
-
import { createPopper as createWrappedPopper } from '@atlaskit/popper/unsafe-imperative';
|
|
6
|
+
import { createPopper } from '@atlaskit/popper/unsafe-imperative';
|
|
8
7
|
import { logException } from '../monitoring/error';
|
|
9
8
|
const startingOffset = {
|
|
10
9
|
name: 'offset',
|
|
@@ -42,12 +41,6 @@ const generateTooltipId = (() => {
|
|
|
42
41
|
let count = 0;
|
|
43
42
|
return () => typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function' ? `${TOOLTIP_ID_PREFIX}-${crypto.randomUUID()}` : `${TOOLTIP_ID_PREFIX}-${count += 1}`;
|
|
44
43
|
})();
|
|
45
|
-
function getCreatePopper() {
|
|
46
|
-
if (fg('platform-dst-popper-consolidation')) {
|
|
47
|
-
return createWrappedPopper;
|
|
48
|
-
}
|
|
49
|
-
return createLegacyPopper;
|
|
50
|
-
}
|
|
51
44
|
|
|
52
45
|
/**
|
|
53
46
|
* A tooltip component similar to "@atlaskit/tooltip" but built for vanilla scenarios
|
|
@@ -263,7 +256,7 @@ export class VanillaTooltip {
|
|
|
263
256
|
}
|
|
264
257
|
}
|
|
265
258
|
createPopperInstance() {
|
|
266
|
-
this.popperInstance =
|
|
259
|
+
this.popperInstance = createPopper(this.trigger, this.tooltip, {
|
|
267
260
|
placement: this.placement,
|
|
268
261
|
modifiers: [startingOffset]
|
|
269
262
|
});
|
|
@@ -341,13 +334,12 @@ export class VanillaTooltip {
|
|
|
341
334
|
var _this$popperInstance2;
|
|
342
335
|
// Released rather than reconfigured. The instance was previously kept for the
|
|
343
336
|
// trigger's whole lifetime, so every element the pointer passed over retained
|
|
344
|
-
// one — and
|
|
345
|
-
//
|
|
337
|
+
// one — and an instance owns a detached React root, so that was a retained
|
|
338
|
+
// root per hovered trigger.
|
|
346
339
|
//
|
|
347
340
|
// Destroying is also the only way to release that root's capture-phase
|
|
348
|
-
// `scroll`/`resize` listeners
|
|
349
|
-
//
|
|
350
|
-
// does nothing.
|
|
341
|
+
// `scroll`/`resize` listeners, where the `eventListeners: false`
|
|
342
|
+
// reconfiguration in the control arm is accepted but does nothing.
|
|
351
343
|
(_this$popperInstance2 = this.popperInstance) === null || _this$popperInstance2 === void 0 ? void 0 : _this$popperInstance2.destroy();
|
|
352
344
|
this.popperInstance = undefined;
|
|
353
345
|
this.tooltip.style.opacity = '0';
|
|
@@ -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 = "134.7.
|
|
22
|
+
var packageVersion = "134.7.1";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// 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)}
|
|
@@ -12,12 +12,12 @@ import { Pressable } from '@atlaskit/primitives/pressable';
|
|
|
12
12
|
import { xcss } from '@atlaskit/primitives/xcss/xcss';
|
|
13
13
|
import { QuickInsertHoverPreview } from './QuickInsertHoverPreview';
|
|
14
14
|
import { useQuickInsertMenuItemSelection } from './quickInsertMenuItemUtils';
|
|
15
|
+
import { QuickInsertShortcut } from './QuickInsertShortcut';
|
|
15
16
|
import { useQuickInsertContext } from './useQuickInsertContext';
|
|
16
17
|
var styles = {
|
|
17
18
|
iconContainer: "_4cvr1h6o _1e0c1txw _1o9zidpf _1bah1h6o _1tke1tcg _1ul91tcg",
|
|
18
19
|
content: "_16jlkb7n _1o9zkb7n _i0dlidpf _1ul9idpf",
|
|
19
|
-
iconLarge: "_2rko1mok _1reo15vq _18m915vq _1h6d1l7x _1dqonqa1 _189ee4h9 _4cvr1h6o _bfhk1bhr _1e0c1txw _4t3izwfg _1bah1h6o _1bsbzwfg"
|
|
20
|
-
shortcut: "_2rko12b0 _11c8wadc _1rjcv77o _18zr1b66 _bfhki8nm _syazazsu"
|
|
20
|
+
iconLarge: "_2rko1mok _1reo15vq _18m915vq _1h6d1l7x _1dqonqa1 _189ee4h9 _4cvr1h6o _bfhk1bhr _1e0c1txw _4t3izwfg _1bah1h6o _1bsbzwfg"
|
|
21
21
|
};
|
|
22
22
|
var iconColorStyles = null;
|
|
23
23
|
|
|
@@ -156,10 +156,10 @@ export var CompactQuickInsertMenuItem = function CompactQuickInsertMenuItem(_ref
|
|
|
156
156
|
}, lozenge ? /*#__PURE__*/React.createElement(Inline, {
|
|
157
157
|
alignBlock: "center",
|
|
158
158
|
space: "space.100"
|
|
159
|
-
}, rowTitle, lozenge) : rowTitle, shortcut && /*#__PURE__*/React.createElement(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
159
|
+
}, rowTitle, lozenge) : rowTitle, shortcut && /*#__PURE__*/React.createElement(QuickInsertShortcut, {
|
|
160
|
+
isDisabled: isDisabled,
|
|
161
|
+
shortcut: shortcut
|
|
162
|
+
}))), shouldRenderPreview && referenceElement && /*#__PURE__*/React.createElement(QuickInsertHoverPreview, {
|
|
163
163
|
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,
|
|
164
164
|
id: previewId,
|
|
165
165
|
description: resolvedDescription,
|
|
@@ -1,88 +1,76 @@
|
|
|
1
1
|
/* ElementBrowserQuickInsertMenuItem.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
2
|
import "./ElementBrowserQuickInsertMenuItem.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import React, { useMemo } from 'react';
|
|
5
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
|
+
import React, { useId, useMemo } from 'react';
|
|
6
5
|
/* eslint-disable @atlaskit/design-system/no-emotion-primitives -- Compiled primitives do not provide Pressable. */
|
|
7
6
|
import { Box } from '@atlaskit/primitives/box';
|
|
8
|
-
import { Inline } from '@atlaskit/primitives/inline';
|
|
9
7
|
import { Pressable } from '@atlaskit/primitives/pressable';
|
|
10
|
-
import { Stack } from '@atlaskit/primitives/stack';
|
|
11
|
-
import { Text } from '@atlaskit/primitives/text';
|
|
12
8
|
import { xcss } from '@atlaskit/primitives/xcss/xcss';
|
|
13
9
|
import { useQuickInsertMenuItemSelection } from './quickInsertMenuItemUtils';
|
|
10
|
+
import { QuickInsertPreviewContent } from './QuickInsertPreviewContent';
|
|
14
11
|
import { useQuickInsertContext } from './useQuickInsertContext';
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
borderRadius: 'radius.
|
|
12
|
+
var cardStyles = xcss({
|
|
13
|
+
backgroundColor: 'elevation.surface',
|
|
14
|
+
borderColor: 'color.border',
|
|
15
|
+
borderRadius: 'radius.large',
|
|
16
|
+
borderStyle: 'solid',
|
|
17
|
+
borderWidth: 'border.width',
|
|
19
18
|
color: 'color.text',
|
|
20
19
|
cursor: 'pointer',
|
|
21
20
|
display: 'flex',
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
gap: 'space.100',
|
|
23
|
+
// Fills the grid row so every tile in a row is as tall as the tallest one.
|
|
24
|
+
height: '100%',
|
|
24
25
|
padding: 'space.150',
|
|
25
26
|
textAlign: 'start',
|
|
26
|
-
width: '100%'
|
|
27
|
+
width: '100%',
|
|
28
|
+
':hover': {
|
|
29
|
+
backgroundColor: 'elevation.surface.hovered'
|
|
30
|
+
}
|
|
27
31
|
});
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
|
|
33
|
+
// Each state is a complete style so the tile can pick one without composing styles at render.
|
|
34
|
+
var selectedCardStyles = xcss({
|
|
30
35
|
backgroundColor: 'color.background.selected',
|
|
31
|
-
|
|
36
|
+
borderColor: 'color.border.selected',
|
|
37
|
+
borderRadius: 'radius.large',
|
|
38
|
+
borderStyle: 'solid',
|
|
39
|
+
borderWidth: 'border.width',
|
|
32
40
|
color: 'color.text',
|
|
33
41
|
cursor: 'pointer',
|
|
34
42
|
display: 'flex',
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
flexDirection: 'column',
|
|
44
|
+
gap: 'space.100',
|
|
45
|
+
height: '100%',
|
|
37
46
|
padding: 'space.150',
|
|
38
|
-
position: 'relative',
|
|
39
47
|
textAlign: 'start',
|
|
40
48
|
width: '100%',
|
|
41
|
-
'
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
insetInlineStart: 'space.0',
|
|
48
|
-
pointerEvents: 'none',
|
|
49
|
-
position: 'absolute'
|
|
49
|
+
':hover': {
|
|
50
|
+
backgroundColor: 'color.background.selected.hovered'
|
|
51
|
+
},
|
|
52
|
+
// Keyboard focus draws the focus ring, so drop the selected border to avoid a double outline.
|
|
53
|
+
':focus-visible': {
|
|
54
|
+
borderColor: 'color.border'
|
|
50
55
|
}
|
|
51
56
|
});
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
borderRadius: 'radius.
|
|
57
|
+
var disabledCardStyles = xcss({
|
|
58
|
+
backgroundColor: 'elevation.surface',
|
|
59
|
+
borderColor: 'color.border',
|
|
60
|
+
borderRadius: 'radius.large',
|
|
61
|
+
borderStyle: 'solid',
|
|
62
|
+
borderWidth: 'border.width',
|
|
56
63
|
color: 'color.text.disabled',
|
|
57
64
|
cursor: 'not-allowed',
|
|
58
65
|
display: 'flex',
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
flexDirection: 'column',
|
|
67
|
+
gap: 'space.100',
|
|
68
|
+
height: '100%',
|
|
61
69
|
padding: 'space.150',
|
|
62
70
|
textAlign: 'start',
|
|
63
71
|
width: '100%'
|
|
64
72
|
});
|
|
65
|
-
var hoveredItemStyles = xcss({
|
|
66
|
-
':hover': {
|
|
67
|
-
backgroundColor: 'elevation.surface.hovered',
|
|
68
|
-
borderRadius: 'radius.medium'
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
73
|
var iconStyles = xcss({
|
|
72
|
-
alignItems: 'center',
|
|
73
|
-
backgroundColor: 'elevation.surface.overlay',
|
|
74
|
-
borderColor: 'color.border',
|
|
75
|
-
borderRadius: 'radius.medium',
|
|
76
|
-
borderStyle: 'solid',
|
|
77
|
-
borderWidth: 'border.width',
|
|
78
|
-
display: 'flex',
|
|
79
|
-
flexShrink: 0,
|
|
80
|
-
height: '40px',
|
|
81
|
-
justifyContent: 'center',
|
|
82
|
-
overflow: 'hidden',
|
|
83
|
-
width: '40px'
|
|
84
|
-
});
|
|
85
|
-
var iconLargeStyles = xcss({
|
|
86
74
|
alignItems: 'center',
|
|
87
75
|
backgroundColor: 'elevation.surface.overlay',
|
|
88
76
|
borderColor: 'color.border',
|
|
@@ -91,10 +79,10 @@ var iconLargeStyles = xcss({
|
|
|
91
79
|
borderWidth: 'border.width',
|
|
92
80
|
display: 'flex',
|
|
93
81
|
flexShrink: 0,
|
|
94
|
-
height: '
|
|
82
|
+
height: '32px',
|
|
95
83
|
justifyContent: 'center',
|
|
96
84
|
overflow: 'hidden',
|
|
97
|
-
width: '
|
|
85
|
+
width: '32px'
|
|
98
86
|
});
|
|
99
87
|
var iconColorStyles = null;
|
|
100
88
|
|
|
@@ -107,25 +95,24 @@ var iconColorStyles = null;
|
|
|
107
95
|
var pinnedIconColorResetStyles = null;
|
|
108
96
|
/* eslint-enable @atlaskit/design-system/no-unsafe-design-token-usage, @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-important-styles */
|
|
109
97
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
paddingInline: 'space.050'
|
|
117
|
-
});
|
|
98
|
+
/**
|
|
99
|
+
* An Element Browser tile: the item's hover preview card (image, title, full description, and
|
|
100
|
+
* attribution), with its shortcut beside the title. Items without a preview image show their icon,
|
|
101
|
+
* always in a bordered box, above the title instead. The hover card's small title icon
|
|
102
|
+
* (`previewIcon`) is not shown, so a tile never repeats its icon.
|
|
103
|
+
*/
|
|
118
104
|
export var ElementBrowserQuickInsertMenuItem = function ElementBrowserQuickInsertMenuItem(_ref) {
|
|
119
105
|
var ariaLabel = _ref.ariaLabel,
|
|
120
106
|
description = _ref.description,
|
|
121
107
|
iconBefore = _ref.iconBefore,
|
|
122
|
-
isDisabled = _ref.isDisabled,
|
|
108
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
109
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
123
110
|
lozenge = _ref.lozenge,
|
|
124
111
|
onSelect = _ref.onSelect,
|
|
112
|
+
preview = _ref.preview,
|
|
113
|
+
previewImageUrls = _ref.previewImageUrls,
|
|
125
114
|
shortcut = _ref.shortcut,
|
|
126
115
|
titleContent = _ref.titleContent,
|
|
127
|
-
_ref$shouldWrapIcon = _ref.shouldWrapIcon,
|
|
128
|
-
shouldWrapIcon = _ref$shouldWrapIcon === void 0 ? true : _ref$shouldWrapIcon,
|
|
129
116
|
title = _ref.title;
|
|
130
117
|
var _useQuickInsertContex = useQuickInsertContext(),
|
|
131
118
|
item = _useQuickInsertContex.item;
|
|
@@ -137,50 +124,36 @@ export var ElementBrowserQuickInsertMenuItem = function ElementBrowserQuickInser
|
|
|
137
124
|
isSelected = _ref2.isSelected;
|
|
138
125
|
var itemDescription = description !== null && description !== void 0 ? description : item === null || item === void 0 ? void 0 : item.description;
|
|
139
126
|
var handleClick = useQuickInsertMenuItemSelection(onSelect);
|
|
140
|
-
var
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
weight: "medium"
|
|
148
|
-
}, title);
|
|
149
|
-
|
|
150
|
-
// Disabled items keep the dimmed colour inherited from the item.
|
|
127
|
+
var descriptionId = useId();
|
|
128
|
+
var resolvedPreview = useMemo(function () {
|
|
129
|
+
return preview !== null && preview !== void 0 ? preview : previewImageUrls ? {
|
|
130
|
+
image: previewImageUrls
|
|
131
|
+
} : {};
|
|
132
|
+
}, [preview, previewImageUrls]);
|
|
133
|
+
var hasDescription = Boolean(itemDescription || resolvedPreview.attribution || shortcut);
|
|
151
134
|
var icon = iconBefore ? /*#__PURE__*/React.createElement("span", {
|
|
152
135
|
className: ax(["_rpzpjdj5 _1pgcjdj5", !isDisabled && "_syaz1q3r"])
|
|
153
|
-
}, iconBefore) :
|
|
136
|
+
}, iconBefore) : undefined;
|
|
154
137
|
return /*#__PURE__*/React.createElement(Pressable, {
|
|
155
|
-
"aria-
|
|
138
|
+
"aria-describedby": hasDescription ? descriptionId : undefined,
|
|
139
|
+
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : title,
|
|
156
140
|
"aria-selected": isSelected,
|
|
157
141
|
id: id,
|
|
158
142
|
isDisabled: isDisabled,
|
|
159
143
|
onClick: handleClick,
|
|
160
144
|
role: "option",
|
|
161
|
-
tabIndex: isSelected ? 0 : -1
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
xcss:
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
alignBlock: "center",
|
|
176
|
-
space: "space.100"
|
|
177
|
-
}, itemTitle, lozenge) : itemTitle, shortcut && /*#__PURE__*/React.createElement(Box, {
|
|
178
|
-
as: "span",
|
|
179
|
-
xcss: shortcutStyles
|
|
180
|
-
}, shortcut)), itemDescription && /*#__PURE__*/React.createElement(Text, {
|
|
181
|
-
color: "color.text.subtlest",
|
|
182
|
-
maxLines: 2,
|
|
183
|
-
size: "small",
|
|
184
|
-
weight: "regular"
|
|
185
|
-
}, itemDescription)));
|
|
145
|
+
tabIndex: isSelected ? 0 : -1,
|
|
146
|
+
xcss: isDisabled ? disabledCardStyles : isSelected ? selectedCardStyles : cardStyles
|
|
147
|
+
}, !resolvedPreview.image && icon && /*#__PURE__*/React.createElement(Box, {
|
|
148
|
+
xcss: iconStyles
|
|
149
|
+
}, icon), /*#__PURE__*/React.createElement(QuickInsertPreviewContent, {
|
|
150
|
+
description: itemDescription,
|
|
151
|
+
id: hasDescription ? descriptionId : undefined,
|
|
152
|
+
isDisabled: isDisabled,
|
|
153
|
+
lozenge: lozenge,
|
|
154
|
+
preview: resolvedPreview,
|
|
155
|
+
shortcut: shortcut,
|
|
156
|
+
shouldClampText: false,
|
|
157
|
+
title: titleContent !== null && titleContent !== void 0 ? titleContent : title
|
|
158
|
+
}));
|
|
186
159
|
};
|