@atlaskit/editor-common 116.46.0 → 116.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/afm-products/tsconfig.json +3 -0
  4. package/dist/cjs/element-browser/components/ViewMore.js +1 -1
  5. package/dist/cjs/extensibility/Extension/Lozenge/ExtensionFloatingLabel.js +1 -1
  6. package/dist/cjs/extensions/UnknownMacroPlaceholder.js +1 -1
  7. package/dist/cjs/icons/shared/PanelErrorIcon.js +1 -1
  8. package/dist/cjs/icons/shared/PanelInfoIcon.js +1 -1
  9. package/dist/cjs/icons/shared/PanelNoteIcon.js +1 -1
  10. package/dist/cjs/icons/shared/PanelSuccessIcon.js +1 -1
  11. package/dist/cjs/icons/shared/PanelWarningIcon.js +1 -1
  12. package/dist/cjs/messages/syncBlock.js +30 -0
  13. package/dist/cjs/monitoring/error.js +1 -1
  14. package/dist/cjs/styles/shared/sync-block.js +7 -1
  15. package/dist/cjs/table/NewSortingIcon.js +1 -1
  16. package/dist/cjs/ui/DropList/index.js +1 -1
  17. package/dist/cjs/ui/Layer/index.js +138 -18
  18. package/dist/cjs/ui/Shortcut/index.js +1 -1
  19. package/dist/cjs/ui/Toolbar/ButtonGroup.js +1 -1
  20. package/dist/cjs/ui/Toolbar/DropdownTriggerWrapper.js +1 -1
  21. package/dist/cjs/ui/Toolbar/DropdownWrapper.js +1 -1
  22. package/dist/cjs/ui/Toolbar/ExpandIcon.js +1 -1
  23. package/dist/cjs/ui/Toolbar/Separator.js +1 -1
  24. package/dist/cjs/ui-color/ColorPalette/Palettes/lightBackgroundPaletteTooltipMessages.js +5 -45
  25. package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessages.js +0 -60
  26. package/dist/cjs/ui-color/ColorPalette/Palettes/panelBackgroundPaletteNew.js +106 -0
  27. package/dist/cjs/ui-color/index.js +7 -7
  28. package/dist/cjs/vanilla-tooltip/index.js +9 -1
  29. package/dist/es2019/element-browser/components/ViewMore.js +1 -1
  30. package/dist/es2019/extensibility/Extension/Lozenge/ExtensionFloatingLabel.js +1 -1
  31. package/dist/es2019/extensions/UnknownMacroPlaceholder.js +1 -1
  32. package/dist/es2019/icons/shared/PanelErrorIcon.js +1 -1
  33. package/dist/es2019/icons/shared/PanelInfoIcon.js +1 -1
  34. package/dist/es2019/icons/shared/PanelNoteIcon.js +1 -1
  35. package/dist/es2019/icons/shared/PanelSuccessIcon.js +1 -1
  36. package/dist/es2019/icons/shared/PanelWarningIcon.js +1 -1
  37. package/dist/es2019/messages/syncBlock.js +30 -0
  38. package/dist/es2019/monitoring/error.js +1 -1
  39. package/dist/es2019/styles/shared/sync-block.js +7 -1
  40. package/dist/es2019/table/NewSortingIcon.js +1 -1
  41. package/dist/es2019/ui/DropList/index.js +1 -1
  42. package/dist/es2019/ui/Layer/index.js +120 -13
  43. package/dist/es2019/ui/Shortcut/index.js +1 -1
  44. package/dist/es2019/ui/Toolbar/ButtonGroup.js +1 -1
  45. package/dist/es2019/ui/Toolbar/DropdownTriggerWrapper.js +1 -1
  46. package/dist/es2019/ui/Toolbar/DropdownWrapper.js +1 -1
  47. package/dist/es2019/ui/Toolbar/ExpandIcon.js +1 -1
  48. package/dist/es2019/ui/Toolbar/Separator.js +1 -1
  49. package/dist/es2019/ui-color/ColorPalette/Palettes/lightBackgroundPaletteTooltipMessages.js +5 -45
  50. package/dist/es2019/ui-color/ColorPalette/Palettes/paletteMessages.js +0 -60
  51. package/dist/es2019/ui-color/ColorPalette/Palettes/panelBackgroundPaletteNew.js +95 -0
  52. package/dist/es2019/ui-color/index.js +1 -1
  53. package/dist/es2019/vanilla-tooltip/index.js +10 -2
  54. package/dist/esm/element-browser/components/ViewMore.js +1 -1
  55. package/dist/esm/extensibility/Extension/Lozenge/ExtensionFloatingLabel.js +1 -1
  56. package/dist/esm/extensions/UnknownMacroPlaceholder.js +1 -1
  57. package/dist/esm/icons/shared/PanelErrorIcon.js +1 -1
  58. package/dist/esm/icons/shared/PanelInfoIcon.js +1 -1
  59. package/dist/esm/icons/shared/PanelNoteIcon.js +1 -1
  60. package/dist/esm/icons/shared/PanelSuccessIcon.js +1 -1
  61. package/dist/esm/icons/shared/PanelWarningIcon.js +1 -1
  62. package/dist/esm/messages/syncBlock.js +30 -0
  63. package/dist/esm/monitoring/error.js +1 -1
  64. package/dist/esm/styles/shared/sync-block.js +7 -1
  65. package/dist/esm/table/NewSortingIcon.js +1 -1
  66. package/dist/esm/ui/DropList/index.js +1 -1
  67. package/dist/esm/ui/Layer/index.js +138 -19
  68. package/dist/esm/ui/Shortcut/index.js +1 -1
  69. package/dist/esm/ui/Toolbar/ButtonGroup.js +1 -1
  70. package/dist/esm/ui/Toolbar/DropdownTriggerWrapper.js +1 -1
  71. package/dist/esm/ui/Toolbar/DropdownWrapper.js +1 -1
  72. package/dist/esm/ui/Toolbar/ExpandIcon.js +1 -1
  73. package/dist/esm/ui/Toolbar/Separator.js +1 -1
  74. package/dist/esm/ui-color/ColorPalette/Palettes/lightBackgroundPaletteTooltipMessages.js +5 -45
  75. package/dist/esm/ui-color/ColorPalette/Palettes/paletteMessages.js +0 -60
  76. package/dist/esm/ui-color/ColorPalette/Palettes/panelBackgroundPaletteNew.js +99 -0
  77. package/dist/esm/ui-color/index.js +1 -1
  78. package/dist/esm/vanilla-tooltip/index.js +10 -2
  79. package/dist/types/messages/syncBlock.d.ts +30 -0
  80. package/dist/types/styles/shared/sync-block.d.ts +6 -5
  81. package/dist/types/ui/Layer/index.d.ts +3 -26
  82. package/dist/types/ui/Layer/internal/helpers.d.ts +1 -1
  83. package/dist/types/ui-color/ColorPalette/Palettes/lightBackgroundPaletteTooltipMessages.d.ts +1 -41
  84. package/dist/types/ui-color/ColorPalette/Palettes/paletteMessages.d.ts +0 -60
  85. package/dist/types/ui-color/ColorPalette/Palettes/panelBackgroundPaletteNew.d.ts +2 -0
  86. package/dist/types/ui-color/index.d.ts +1 -1
  87. package/package.json +12 -4
  88. package/ui-color/ColorPalette/panelBackgroundPaletteNew/package.json +10 -0
  89. package/dist/cjs/ui-color/ColorPalette/Palettes/cellBackgroundColorPaletteNew.js +0 -28
  90. package/dist/es2019/ui-color/ColorPalette/Palettes/cellBackgroundColorPaletteNew.js +0 -21
  91. package/dist/esm/ui-color/ColorPalette/Palettes/cellBackgroundColorPaletteNew.js +0 -21
  92. package/dist/types/ui-color/ColorPalette/Palettes/cellBackgroundColorPaletteNew.d.ts +0 -8
@@ -0,0 +1,95 @@
1
+ // new palette for platform_editor_lovability_text_bg_color experiment
2
+ export const panelBackgroundPaletteNew = [{
3
+ label: 'White',
4
+ value: '#FFFFFF'
5
+ }, {
6
+ label: 'Subtle blue',
7
+ value: '#DEEBFF'
8
+ }, {
9
+ label: 'Subtle teal',
10
+ value: '#E6FCFF'
11
+ }, {
12
+ label: 'Subtle green',
13
+ value: '#E3FCEF'
14
+ }, {
15
+ label: 'Subtle lime',
16
+ value: '#EFFFD6'
17
+ }, {
18
+ label: 'Subtle yellow',
19
+ value: '#FFFAE6'
20
+ }, {
21
+ label: 'Subtle orange',
22
+ value: '#FFF5DB'
23
+ }, {
24
+ label: 'Subtle red',
25
+ value: '#FFEBE6'
26
+ }, {
27
+ label: 'Subtle magenta',
28
+ value: '#FFECF8'
29
+ }, {
30
+ label: 'Subtle purple',
31
+ value: '#EAE6FF'
32
+ }, {
33
+ label: 'Gray',
34
+ value: '#F4F5F7'
35
+ }, {
36
+ label: 'Blue',
37
+ value: '#B3D4FF'
38
+ }, {
39
+ label: 'Teal',
40
+ value: '#B3F5FF'
41
+ }, {
42
+ label: 'Green',
43
+ value: '#ABF5D1'
44
+ }, {
45
+ label: 'Lime',
46
+ value: '#D3F1A7'
47
+ }, {
48
+ label: 'Yellow',
49
+ value: '#FFF0B3'
50
+ }, {
51
+ label: 'Orange',
52
+ value: '#FCE4A6'
53
+ }, {
54
+ label: 'Red',
55
+ value: '#FFBDAD'
56
+ }, {
57
+ label: 'Magenta',
58
+ value: '#FDD0EC'
59
+ }, {
60
+ label: 'Purple',
61
+ value: '#C0B6F2'
62
+ }, {
63
+ label: 'Bold gray',
64
+ value: '#B7B9BE'
65
+ }, {
66
+ label: 'Bold blue',
67
+ value: '#ADCBFB'
68
+ }, {
69
+ label: 'Bold teal',
70
+ value: '#B1E4F7'
71
+ }, {
72
+ label: 'Bold green',
73
+ value: '#97EDC9'
74
+ }, {
75
+ label: 'Bold lime',
76
+ value: '#BDE97C'
77
+ }, {
78
+ label: 'Bold yellow',
79
+ value: '#EFDD4E'
80
+ }, {
81
+ label: 'Bold orange',
82
+ value: '#FBD779'
83
+ }, {
84
+ label: 'Bold red',
85
+ value: '#FFB8B2'
86
+ }, {
87
+ label: 'Bold magenta',
88
+ value: '#FCB6E1'
89
+ }, {
90
+ label: 'Bold purple',
91
+ value: '#E3BDFA'
92
+ }].map(color => ({
93
+ ...color,
94
+ border: "var(--ds-border, #0B120E24)"
95
+ }));
@@ -10,9 +10,9 @@ export { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getSelectedRo
10
10
  export { getHighlightColorInNonActiveTheme } from './ColorPalette/getHighlightColorInNonActiveTheme';
11
11
  export { getTextColorInNonActiveTheme } from './ColorPalette/getTextColorInNonActiveTheme';
12
12
  export { default as cellBackgroundColorPalette } from './ColorPalette/Palettes/cellBackgroundColorPalette';
13
- export { default as cellBackgroundColorPaletteNew } from './ColorPalette/Palettes/cellBackgroundColorPaletteNew';
14
13
  export { default as colorPaletteMessages } from './ColorPalette/Palettes/paletteMessages';
15
14
  export { panelBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
15
+ export { panelBackgroundPaletteNew } from './ColorPalette/Palettes/panelBackgroundPaletteNew';
16
16
  export { textColorPalette } from './ColorPalette/Palettes/textColorPalette';
17
17
  export { textColorPaletteNew } from './ColorPalette/Palettes/textColorPaletteNew';
18
18
  export { highlightColorPalette, REMOVE_HIGHLIGHT_COLOR } from './ColorPalette/Palettes/highlightColorPalette';
@@ -1,6 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { createPopper } from '@popperjs/core';
2
+ import { createPopper as createLegacyPopper } from '@popperjs/core';
3
3
  import { bind } from 'bind-event-listener';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
5
+ import { createPopper as createWrappedPopper } from '@atlaskit/popper/unsafe-imperative';
4
6
  const startingOffset = {
5
7
  name: 'offset',
6
8
  options: {
@@ -13,6 +15,12 @@ const endingOffset = {
13
15
  offset: [0, 8]
14
16
  }
15
17
  };
18
+ function getCreatePopper() {
19
+ if (fg('platform-dst-popper-consolidation')) {
20
+ return createWrappedPopper;
21
+ }
22
+ return createLegacyPopper;
23
+ }
16
24
 
17
25
  /**
18
26
  * A tooltip component similar to "@atlaskit/tooltip" but built for vanilla scenarios
@@ -88,7 +96,7 @@ export class VanillaTooltip {
88
96
  };
89
97
  }
90
98
  createPopperInstance() {
91
- this.popperInstance = createPopper(this.button, this.tooltip, {
99
+ this.popperInstance = getCreatePopper()(this.button, this.tooltip, {
92
100
  placement: 'top',
93
101
  modifiers: [startingOffset]
94
102
  });
@@ -1,4 +1,4 @@
1
- /* ViewMore.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* ViewMore.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./ViewMore.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* ExtensionFloatingLabel.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* ExtensionFloatingLabel.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./ExtensionFloatingLabel.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* UnknownMacroPlaceholder.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* UnknownMacroPlaceholder.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import "./UnknownMacroPlaceholder.compiled.css";
4
4
  import * as React from 'react';
@@ -1,4 +1,4 @@
1
- /* PanelErrorIcon.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* PanelErrorIcon.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./PanelErrorIcon.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* PanelInfoIcon.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* PanelInfoIcon.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./PanelInfoIcon.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* PanelNoteIcon.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* PanelNoteIcon.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./PanelNoteIcon.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* PanelSuccessIcon.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* PanelSuccessIcon.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./PanelSuccessIcon.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* PanelWarningIcon.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* PanelWarningIcon.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./PanelWarningIcon.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -40,6 +40,11 @@ export var syncBlockMessages = defineMessages({
40
40
  defaultMessage: 'Synced block',
41
41
  description: 'Label which appears above the synced block when it is selected'
42
42
  },
43
+ sourceSyncedBlockLabel: {
44
+ id: 'fabric.editor.sourceSyncedBlock.label.text',
45
+ defaultMessage: 'Source synced block',
46
+ description: 'Label which identifies the editable source synced block when it is selected'
47
+ },
43
48
  unsyncedBlockLabel: {
44
49
  id: 'fabric.editor.unsyncedBlock.label.text',
45
50
  defaultMessage: 'Unsynced block',
@@ -200,6 +205,26 @@ export var syncBlockMessages = defineMessages({
200
205
  defaultMessage: 'You appear to be offline. Please connect to the internet to create synced content.',
201
206
  description: 'Description in flag which appears when a sync block cannot be created in offline mode'
202
207
  },
208
+ feedbackFlagTitle: {
209
+ id: 'editor-common.messages.syncBlock.feedbackFlagTitle',
210
+ defaultMessage: 'Help us improve Synced blocks',
211
+ description: 'Title of the flag inviting users to give feedback about synced blocks'
212
+ },
213
+ feedbackFlagDescription: {
214
+ id: 'editor-common.messages.syncBlock.feedbackFlagDescription',
215
+ defaultMessage: 'We’d love your feedback. This quick survey should take less than a minute.',
216
+ description: 'Description of the flag inviting users to give feedback about synced blocks'
217
+ },
218
+ feedbackFlagGiveFeedback: {
219
+ id: 'editor-common.messages.syncBlock.feedbackFlagGiveFeedback',
220
+ defaultMessage: 'Give feedback',
221
+ description: 'Action that opens the synced blocks feedback collector'
222
+ },
223
+ feedbackFlagNoThanks: {
224
+ id: 'editor-common.messages.syncBlock.feedbackFlagNoThanks',
225
+ defaultMessage: 'No thanks',
226
+ description: 'Action that dismisses the synced blocks feedback invitation'
227
+ },
203
228
  loadingSyncedContent: {
204
229
  id: 'fabric.editor.syncedBlockLoadingSyncedContent',
205
230
  defaultMessage: 'Loading synced content',
@@ -315,6 +340,11 @@ export var syncBlockMessages = defineMessages({
315
340
  defaultMessage: 'Copy and paste synced blocks to reuse in other locations.',
316
341
  description: 'Message shown in the synced location dropdown menu when no shared locations are found'
317
342
  },
343
+ syncedLocationDropdownActivationNoResults: {
344
+ id: 'editor-common.messages.syncBlock.syncedLocationDropdownActivationNoResults',
345
+ defaultMessage: 'To reuse content, copy and paste this block to sync to other locations',
346
+ description: 'Instruction shown in the activation synced locations dropdown when a synced block has no references. It explains how to create the first reference.'
347
+ },
318
348
  syncedLocationDropdownLearnMoreLink: {
319
349
  id: 'fabric.editor.syncedLocationDropdownLearnMoreLink',
320
350
  defaultMessage: 'Learn more about synced blocks',
@@ -20,7 +20,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
20
20
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
21
21
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
22
22
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
23
- var packageVersion = "116.45.0";
23
+ var packageVersion = "116.47.0";
24
24
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
25
25
  // Remove URL as it has UGC
26
26
  // Ignored via go/ees007
@@ -14,7 +14,13 @@ export var BodiedSyncBlockSharedCssClassName = {
14
14
  prefix: bodiedPrefix,
15
15
  renderer: "".concat(bodiedPrefix, "__renderer"),
16
16
  content: "".concat(bodiedPrefix, "__content"),
17
- selectionInside: "".concat(bodiedPrefix, "__selection_inside")
17
+ selectionInside: "".concat(bodiedPrefix, "__selection_inside"),
18
+ // Applied by the node view when the block holds nothing but a single empty paragraph.
19
+ // Emptiness is derived from the ProseMirror document rather than the rendered DOM, because
20
+ // decorations (for example the selection marker's cursor widget) and ProseMirror's own
21
+ // separator/trailing-break hack nodes are injected as children of that paragraph and make
22
+ // DOM-shape heuristics unreliable. See EDITOR-8327.
23
+ empty: "".concat(bodiedPrefix, "__empty")
18
24
  };
19
25
 
20
26
  // Constant labelClassName value here has been inlined in css from EditorContentContainer, if you need to make
@@ -1,4 +1,4 @@
1
- /* NewSortingIcon.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* NewSortingIcon.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./NewSortingIcon.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "116.45.0";
24
+ var packageVersion = "116.47.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -1,3 +1,4 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
1
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/createClass";
3
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
@@ -8,10 +9,12 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
8
9
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
10
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
10
11
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
- import React, { Component } from 'react';
12
+ import React, { Component, useLayoutEffect, useMemo, useRef, useState } from 'react';
12
13
  import Popper from 'popper.js';
13
14
  // eslint-disable-line import/extensions
14
15
  import rafSchedule from 'raf-schd';
16
+ import { fg } from '@atlaskit/platform-feature-flags';
17
+ import { Popper as WrappedPopper } from '@atlaskit/popper/popper';
15
18
  import { positionPropToPopperPosition } from './internal/helpers';
16
19
  var defaultState = {
17
20
  hasExtractedStyles: false,
@@ -28,14 +31,26 @@ var defaultState = {
28
31
  originalHeight: null,
29
32
  maxHeight: null
30
33
  };
34
+ function defaultOnPositioned() {}
35
+ var defaultProps = {
36
+ boundariesElement: 'viewport',
37
+ children: null,
38
+ content: null,
39
+ offset: '0, 0',
40
+ position: 'right middle',
41
+ zIndex: 400,
42
+ lockScroll: false,
43
+ isAlwaysFixed: false,
44
+ onPositioned: defaultOnPositioned
45
+ };
31
46
 
32
47
  // Ignored via go/ees005
33
48
  // eslint-disable-next-line @repo/internal/react/no-class-components
34
- var Layer = /*#__PURE__*/function (_Component) {
35
- function Layer(props) {
49
+ var LegacyLayer = /*#__PURE__*/function (_Component) {
50
+ function LegacyLayer(props) {
36
51
  var _this;
37
- _classCallCheck(this, Layer);
38
- _this = _callSuper(this, Layer, [props]);
52
+ _classCallCheck(this, LegacyLayer);
53
+ _this = _callSuper(this, LegacyLayer, [props]);
39
54
  _defineProperty(_this, "targetRef", /*#__PURE__*/React.createRef());
40
55
  _defineProperty(_this, "contentRef", /*#__PURE__*/React.createRef());
41
56
  _defineProperty(_this, "extractStyles", function (state) {
@@ -60,8 +75,8 @@ var Layer = /*#__PURE__*/function (_Component) {
60
75
  _this.extractStyles = rafSchedule(_this.extractStyles.bind(_this));
61
76
  return _this;
62
77
  }
63
- _inherits(Layer, _Component);
64
- return _createClass(Layer, [{
78
+ _inherits(LegacyLayer, _Component);
79
+ return _createClass(LegacyLayer, [{
65
80
  key: "componentDidMount",
66
81
  value: function componentDidMount() {
67
82
  this.applyPopper(this.props);
@@ -191,15 +206,119 @@ var Layer = /*#__PURE__*/function (_Component) {
191
206
  }]);
192
207
  }(Component);
193
208
  // working with extract-react-types
194
- _defineProperty(Layer, "defaultProps", {
195
- boundariesElement: 'viewport',
196
- children: null,
197
- content: null,
198
- offset: '0, 0',
199
- position: 'right middle',
200
- zIndex: 400,
201
- lockScroll: false,
202
- isAlwaysFixed: false,
203
- onPositioned: function onPositioned() {}
204
- });
205
- export { Layer as default };
209
+ _defineProperty(LegacyLayer, "defaultProps", defaultProps);
210
+ function parseOffset(_ref) {
211
+ var offset = _ref.offset;
212
+ var _offset$split = offset.split(','),
213
+ _offset$split2 = _slicedToArray(_offset$split, 2),
214
+ rawSkidding = _offset$split2[0],
215
+ rawDistance = _offset$split2[1];
216
+ var skidding = Number.parseFloat(rawSkidding);
217
+ var distance = Number.parseFloat(rawDistance);
218
+ return [Number.isFinite(skidding) ? skidding : 0, Number.isFinite(distance) ? distance : 0];
219
+ }
220
+ var popperInteropModifiers = [{
221
+ name: 'flip',
222
+ enabled: false
223
+ }, {
224
+ name: 'preventOverflow',
225
+ enabled: false
226
+ }, {
227
+ name: 'hide',
228
+ enabled: false
229
+ }];
230
+ function usePopperInteropModifiers(_ref2) {
231
+ var onPositioned = _ref2.onPositioned;
232
+ var onPositionedRef = useRef(onPositioned);
233
+ var hasPositionedRef = useRef(false);
234
+ useLayoutEffect(function () {
235
+ onPositionedRef.current = onPositioned;
236
+ }, [onPositioned]);
237
+ return useMemo(function () {
238
+ return [].concat(popperInteropModifiers, [{
239
+ name: 'editorLayerFirstPositioned',
240
+ enabled: true,
241
+ // React Popper commits calculated styles in `write`; the legacy callback ran afterwards.
242
+ phase: 'afterWrite',
243
+ fn: function fn() {
244
+ if (hasPositionedRef.current) {
245
+ return;
246
+ }
247
+ hasPositionedRef.current = true;
248
+ onPositionedRef.current();
249
+ }
250
+ }]);
251
+ }, []);
252
+ }
253
+ function PopperInterop(_ref3) {
254
+ var children = _ref3.children,
255
+ content = _ref3.content,
256
+ offset = _ref3.offset,
257
+ onPositioned = _ref3.onPositioned,
258
+ position = _ref3.position,
259
+ strategy = _ref3.strategy;
260
+ var targetRef = useRef(null);
261
+ var _useState = useState(null),
262
+ _useState2 = _slicedToArray(_useState, 2),
263
+ referenceElement = _useState2[0],
264
+ setReferenceElement = _useState2[1];
265
+ var modifiers = usePopperInteropModifiers({
266
+ onPositioned: onPositioned
267
+ });
268
+ // Popper v2 compares the offset prop by reference, so memoise to avoid re-running positioning every render.
269
+ var parsedOffset = useMemo(function () {
270
+ return parseOffset({
271
+ offset: offset
272
+ });
273
+ }, [offset]);
274
+ useLayoutEffect(function () {
275
+ var _targetRef$current;
276
+ var actualTarget = (_targetRef$current = targetRef.current) === null || _targetRef$current === void 0 ? void 0 : _targetRef$current.children[0];
277
+ setReferenceElement(actualTarget instanceof HTMLElement ? actualTarget : null);
278
+ }, [children]);
279
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
280
+ ref: targetRef
281
+ }, children), content && referenceElement ? /*#__PURE__*/React.createElement(WrappedPopper, {
282
+ modifiers: modifiers,
283
+ offset: parsedOffset,
284
+ placement: positionPropToPopperPosition(position),
285
+ referenceElement: referenceElement,
286
+ strategy: strategy
287
+ }, function (_ref4) {
288
+ var ref = _ref4.ref,
289
+ style = _ref4.style;
290
+ return /*#__PURE__*/React.createElement("div", {
291
+ ref: ref,
292
+ style: style
293
+ }, content);
294
+ }) : /*#__PURE__*/React.createElement("div", null));
295
+ }
296
+
297
+ /** Selects the reversible Popper v1 or ADS wrapper implementation. */
298
+ export default function Layer(_ref5) {
299
+ var _ref5$children = _ref5.children,
300
+ children = _ref5$children === void 0 ? defaultProps.children : _ref5$children,
301
+ _ref5$content = _ref5.content,
302
+ content = _ref5$content === void 0 ? defaultProps.content : _ref5$content,
303
+ _ref5$offset = _ref5.offset,
304
+ offset = _ref5$offset === void 0 ? defaultProps.offset : _ref5$offset,
305
+ _ref5$onPositioned = _ref5.onPositioned,
306
+ onPositioned = _ref5$onPositioned === void 0 ? defaultProps.onPositioned : _ref5$onPositioned,
307
+ _ref5$position = _ref5.position,
308
+ position = _ref5$position === void 0 ? defaultProps.position : _ref5$position;
309
+ if (fg('platform-dst-popper-consolidation')) {
310
+ return /*#__PURE__*/React.createElement(PopperInterop, {
311
+ content: content,
312
+ offset: offset,
313
+ onPositioned: onPositioned,
314
+ position: position,
315
+ strategy: "absolute"
316
+ }, children);
317
+ }
318
+ return /*#__PURE__*/React.createElement(LegacyLayer, {
319
+ content: content,
320
+ offset: offset,
321
+ onPositioned: onPositioned,
322
+ position: position
323
+ }, children);
324
+ }
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* index.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./index.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
@@ -1,4 +1,4 @@
1
- /* ButtonGroup.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* ButtonGroup.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./ButtonGroup.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
@@ -1,4 +1,4 @@
1
- /* DropdownTriggerWrapper.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* DropdownTriggerWrapper.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./DropdownTriggerWrapper.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
@@ -1,4 +1,4 @@
1
- /* DropdownWrapper.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* DropdownWrapper.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./DropdownWrapper.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
@@ -1,4 +1,4 @@
1
- /* ExpandIcon.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* ExpandIcon.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./ExpandIcon.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* Separator.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* Separator.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import "./Separator.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -60,6 +60,11 @@ export var lightBackgroundPaletteTooltipMessages = defineMessages({
60
60
  defaultMessage: 'Bold yellow',
61
61
  description: 'The text is shown as a tooltip label for a color swatch in the editor background color picker when the user hovers over the bold yellow color option.'
62
62
  },
63
+ '#EFDD4E': {
64
+ id: 'fabric.theme.bold-yellow-new',
65
+ defaultMessage: 'Bold yellow',
66
+ description: 'The text is shown as a tooltip label for a color swatch in the editor background color picker when the user hovers over the bold yellow color option.'
67
+ },
63
68
  '#FFEBE6': {
64
69
  id: 'fabric.theme.subtle-red',
65
70
  defaultMessage: 'Subtle red',
@@ -104,50 +109,5 @@ export var lightBackgroundPaletteTooltipMessages = defineMessages({
104
109
  id: 'fabric.theme.bold-gray',
105
110
  defaultMessage: 'Bold gray',
106
111
  description: 'The text is shown as a tooltip label for a color swatch in the editor background color picker when the user hovers over the bold gray color option.'
107
- },
108
- '#EFFFD6': {
109
- id: 'fabric.theme.subtle-lime',
110
- defaultMessage: 'Subtle lime',
111
- description: 'The text is shown as a tooltip label for a color swatch in the editor background color picker when the user hovers over the subtle lime color option.'
112
- },
113
- '#D3F1A7': {
114
- id: 'fabric.theme.lime',
115
- defaultMessage: 'Lime',
116
- description: 'The text is shown as a tooltip label for a color swatch in the editor background color picker when the user hovers over the lime color option.'
117
- },
118
- '#BDE97C': {
119
- id: 'fabric.theme.bold-lime',
120
- defaultMessage: 'Bold lime',
121
- description: 'The text is shown as a tooltip label for a color swatch in the editor background color picker when the user hovers over the bold lime color option.'
122
- },
123
- '#FFF5DB': {
124
- id: 'fabric.theme.subtle-orange',
125
- defaultMessage: 'Subtle orange',
126
- description: 'The text is shown as a tooltip label for a color swatch in the editor background color picker when the user hovers over the subtle orange color option.'
127
- },
128
- '#FCE4A6': {
129
- id: 'fabric.theme.orange',
130
- defaultMessage: 'Orange',
131
- description: 'The text is shown as a tooltip label for a color swatch in the editor background color picker when the user hovers over the orange color option.'
132
- },
133
- '#FBD779': {
134
- id: 'fabric.theme.bold-orange',
135
- defaultMessage: 'Bold orange',
136
- description: 'The text is shown as a tooltip label for a color swatch in the editor background color picker when the user hovers over the bold orange color option.'
137
- },
138
- '#FFECF8': {
139
- id: 'fabric.theme.subtle-magenta',
140
- defaultMessage: 'Subtle magenta',
141
- description: 'The text is shown as a tooltip label for a color swatch in the editor background color picker when the user hovers over the subtle magenta color option.'
142
- },
143
- '#FDD0EC': {
144
- id: 'fabric.theme.magenta',
145
- defaultMessage: 'Magenta',
146
- description: 'The text is shown as a tooltip label for a color swatch in the editor background color picker when the user hovers over the magenta color option.'
147
- },
148
- '#FCB6E1': {
149
- id: 'fabric.theme.bold-magenta',
150
- defaultMessage: 'Bold magenta',
151
- description: 'The text is shown as a tooltip label for a color swatch in the editor background color picker when the user hovers over the bold magenta color option.'
152
112
  }
153
113
  });