@atlaskit/editor-common 74.52.0 → 74.52.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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 74.52.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e0f020abea0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e0f020abea0) - created new plugin for unsupported-content, moved code and styles
8
+ - Updated dependencies
9
+
10
+ ## 74.52.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [`dbccd831543`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dbccd831543) - [ux] tokenize ColorPicker, make charts package compatible with tokens, make check mark compatible with tokens
15
+
3
16
  ## 74.52.0
4
17
 
5
18
  ### Minor Changes
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "74.52.0";
19
+ var packageVersion = "74.52.2";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -99,6 +99,12 @@ Object.defineProperty(exports, "TaskDecisionSharedCssClassName", {
99
99
  return _taskDecision.TaskDecisionSharedCssClassName;
100
100
  }
101
101
  });
102
+ Object.defineProperty(exports, "UnsupportedSharedCssClassName", {
103
+ enumerable: true,
104
+ get: function get() {
105
+ return _unsupportedContent.UnsupportedSharedCssClassName;
106
+ }
107
+ });
102
108
  Object.defineProperty(exports, "annotationSharedStyles", {
103
109
  enumerable: true,
104
110
  get: function get() {
@@ -357,6 +363,12 @@ Object.defineProperty(exports, "triggerWrapperStyles", {
357
363
  return _plugins.triggerWrapperStyles;
358
364
  }
359
365
  });
366
+ Object.defineProperty(exports, "unsupportedStyles", {
367
+ enumerable: true,
368
+ get: function get() {
369
+ return _unsupportedContent.unsupportedStyles;
370
+ }
371
+ });
360
372
  Object.defineProperty(exports, "whitespaceSharedStyles", {
361
373
  enumerable: true,
362
374
  get: function get() {
@@ -397,4 +409,5 @@ var _resizer = require("./shared/resizer");
397
409
  var _grid = require("./shared/grid");
398
410
  var _smartCard2 = require("./shared/smartCard");
399
411
  var _embedCard = require("./shared/embedCard");
400
- var _plugins = require("./shared/plugins");
412
+ var _plugins = require("./shared/plugins");
413
+ var _unsupportedContent = require("./shared/unsupported-content");
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.unsupportedStyles = exports.UnsupportedSharedCssClassName = void 0;
8
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
+ var _react = require("@emotion/react");
10
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
11
+ var _templateObject;
12
+ var UnsupportedSharedCssClassName = {
13
+ BLOCK_CONTAINER: 'unsupportedBlockView-content-wrap',
14
+ INLINE_CONTAINER: 'unsupportedInlineView-content-wrap'
15
+ };
16
+ exports.UnsupportedSharedCssClassName = UnsupportedSharedCssClassName;
17
+ var inlineUnsupportedSelector = ".".concat(UnsupportedSharedCssClassName.INLINE_CONTAINER, " > span:nth-of-type(2)");
18
+ var blockUnsupportedSelector = ".".concat(UnsupportedSharedCssClassName.BLOCK_CONTAINER, " > div");
19
+ var unsupportedStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", ", ", " {\n cursor: pointer;\n }\n\n .", "", ",\n .", "", " {\n ", "\n }\n\n .danger {\n .", "", ",\n .", "", " {\n border: ", "px solid\n ", ";\n background-color: ", ";\n }\n }\n"])), blockUnsupportedSelector, inlineUnsupportedSelector, _editorSharedStyles.akEditorSelectedNodeClassName, blockUnsupportedSelector, _editorSharedStyles.akEditorSelectedNodeClassName, inlineUnsupportedSelector, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Background, _editorSharedStyles.SelectionStyle.Border]), _editorSharedStyles.akEditorSelectedNodeClassName, blockUnsupportedSelector, _editorSharedStyles.akEditorSelectedNodeClassName, inlineUnsupportedSelector, _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), "var(--ds-blanket-danger, ".concat(_editorSharedStyles.akEditorDeleteBackgroundWithOpacity, ")"));
20
+ exports.unsupportedStyles = unsupportedStyles;
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
24
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
25
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "74.52.0";
27
+ var packageVersion = "74.52.2";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -21,13 +21,17 @@ var _utils = require("./utils");
21
21
  * For a given color pick the color from a list of colors with
22
22
  * the highest contrast
23
23
  *
24
- * @param color color string, suppports HEX, RGB, RGBA etc.
24
+ * @param color color string, supports HEX, RGB, RGBA etc.
25
+ * @param useIconToken boolean, describes if a token should be used for the icon color
25
26
  * @return Highest contrast color in pool
26
27
  */
27
28
  function getCheckMarkColor(color, useIconToken) {
29
+ var tokenVal = (0, _utils.getTokenCSSVariableValue)(color);
30
+ var colorValue = !!tokenVal ? tokenVal : color;
31
+
28
32
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
29
33
  var contrastColor = [_colors.N0, _colors.N500].sort(function (a, b) {
30
- return _chromatism.default.difference(b, color) - _chromatism.default.difference(a, color);
34
+ return _chromatism.default.difference(b, colorValue) - _chromatism.default.difference(a, colorValue);
31
35
  })[0];
32
36
  if (!useIconToken) {
33
37
  return contrastColor;
@@ -58,13 +62,13 @@ var ColorPalette = function ColorPalette(props) {
58
62
  var colorsPerRow = _react.default.useMemo(function () {
59
63
  return (0, _utils.getColorsPerRowFromPalette)(palette, cols);
60
64
  }, [palette, cols]);
61
- return (0, _react2.jsx)(_react.default.Fragment, null, colorsPerRow.map(function (row, rowIdx) {
65
+ return (0, _react2.jsx)(_react.default.Fragment, null, colorsPerRow.map(function (row) {
62
66
  return (0, _react2.jsx)("div", {
63
67
  css: _styles.colorPaletteWrapper,
64
68
  className: className,
65
69
  key: "row-first-color-".concat(row[0].value),
66
70
  role: "radiogroup"
67
- }, row.map(function (_ref, colorIdx) {
71
+ }, row.map(function (_ref) {
68
72
  var value = _ref.value,
69
73
  label = _ref.label,
70
74
  border = _ref.border,
@@ -7,6 +7,7 @@ exports.DEFAULT_COLOR_PICKER_COLUMNS = void 0;
7
7
  exports.getColorsPerRowFromPalette = getColorsPerRowFromPalette;
8
8
  exports.getSelectedRowAndColumn = getSelectedRowAndColumn;
9
9
  exports.getSelectedRowAndColumnFromPalette = getSelectedRowAndColumnFromPalette;
10
+ exports.getTokenCSSVariableValue = void 0;
10
11
  var DEFAULT_COLOR_PICKER_COLUMNS = 7;
11
12
  exports.DEFAULT_COLOR_PICKER_COLUMNS = DEFAULT_COLOR_PICKER_COLUMNS;
12
13
  function getColorsPerRowFromPalette(palette) {
@@ -39,4 +40,18 @@ function getSelectedRowAndColumnFromPalette(palette, selectedColor) {
39
40
  var cols = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_COLOR_PICKER_COLUMNS;
40
41
  var colorsPerRow = getColorsPerRowFromPalette(palette, cols);
41
42
  return getSelectedRowAndColumn(colorsPerRow, selectedColor);
42
- }
43
+ }
44
+ var getTokenCSSVariableValue = function getTokenCSSVariableValue(variableExpression) {
45
+ var matcher = variableExpression.match(/var\(([^,\)]+)(,.*)?\)/);
46
+ if (matcher) {
47
+ var variable = matcher[1].trim();
48
+ var fallback = matcher[2] ? matcher[2].replace(',', '').trim() : '';
49
+ if (typeof document === 'undefined') {
50
+ return fallback;
51
+ }
52
+ var value = window.getComputedStyle(document.documentElement).getPropertyValue(variable).trim();
53
+ return value || fallback;
54
+ }
55
+ return '';
56
+ };
57
+ exports.getTokenCSSVariableValue = getTokenCSSVariableValue;
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "74.52.0";
3
+ const packageVersion = "74.52.2";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -26,4 +26,5 @@ export { resizerStyles, resizerHandleShadowClassName } from './shared/resizer';
26
26
  export { gridStyles, GRID_GUTTER } from './shared/grid';
27
27
  export { smartCardStyles, FLOATING_TOOLBAR_LINKPICKER_CLASSNAME, DATASOURCE_INNER_CONTAINER_CLASSNAME } from './shared/smartCard';
28
28
  export { embedCardStyles, embedSpacingStyles, editIconStyles } from './shared/embedCard';
29
- export { buttonGroupStyle, separatorStyles, wrapperStyle, triggerWrapperStyles } from './shared/plugins';
29
+ export { buttonGroupStyle, separatorStyles, wrapperStyle, triggerWrapperStyles } from './shared/plugins';
30
+ export { UnsupportedSharedCssClassName, unsupportedStyles } from './shared/unsupported-content';
@@ -0,0 +1,27 @@
1
+ import { css } from '@emotion/react';
2
+ import { akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorSelectedNodeClassName, getSelectionStyles, SelectionStyle } from '@atlaskit/editor-shared-styles';
3
+ export const UnsupportedSharedCssClassName = {
4
+ BLOCK_CONTAINER: 'unsupportedBlockView-content-wrap',
5
+ INLINE_CONTAINER: 'unsupportedInlineView-content-wrap'
6
+ };
7
+ const inlineUnsupportedSelector = `.${UnsupportedSharedCssClassName.INLINE_CONTAINER} > span:nth-of-type(2)`;
8
+ const blockUnsupportedSelector = `.${UnsupportedSharedCssClassName.BLOCK_CONTAINER} > div`;
9
+ export const unsupportedStyles = css`
10
+ ${blockUnsupportedSelector}, ${inlineUnsupportedSelector} {
11
+ cursor: pointer;
12
+ }
13
+
14
+ .${akEditorSelectedNodeClassName}${blockUnsupportedSelector},
15
+ .${akEditorSelectedNodeClassName}${inlineUnsupportedSelector} {
16
+ ${getSelectionStyles([SelectionStyle.Background, SelectionStyle.Border])}
17
+ }
18
+
19
+ .danger {
20
+ .${akEditorSelectedNodeClassName}${blockUnsupportedSelector},
21
+ .${akEditorSelectedNodeClassName}${inlineUnsupportedSelector} {
22
+ border: ${akEditorSelectedBorderSize}px solid
23
+ ${`var(--ds-border-danger, ${akEditorDeleteBorder})`};
24
+ background-color: ${`var(--ds-blanket-danger, ${akEditorDeleteBackgroundWithOpacity})`};
25
+ }
26
+ }
27
+ `;
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
8
8
  import { borderRadius } from '@atlaskit/theme/constants';
9
9
  import Layer from '../Layer';
10
10
  const packageName = "@atlaskit/editor-common";
11
- const packageVersion = "74.52.0";
11
+ const packageVersion = "74.52.2";
12
12
  const halfFocusRing = 1;
13
13
  const dropOffset = '0, 8';
14
14
  class DropList extends Component {
@@ -8,17 +8,21 @@ import { useThemeObserver } from '@atlaskit/tokens';
8
8
  import Color from './Color';
9
9
  import getColorMessage from './Palettes/getColorMessage';
10
10
  import { colorPaletteWrapper } from './styles';
11
- import { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette } from './utils';
11
+ import { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getTokenCSSVariableValue } from './utils';
12
12
  /**
13
13
  * For a given color pick the color from a list of colors with
14
14
  * the highest contrast
15
15
  *
16
- * @param color color string, suppports HEX, RGB, RGBA etc.
16
+ * @param color color string, supports HEX, RGB, RGBA etc.
17
+ * @param useIconToken boolean, describes if a token should be used for the icon color
17
18
  * @return Highest contrast color in pool
18
19
  */
19
20
  function getCheckMarkColor(color, useIconToken) {
21
+ const tokenVal = getTokenCSSVariableValue(color);
22
+ const colorValue = !!tokenVal ? tokenVal : color;
23
+
20
24
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
21
- const contrastColor = [N0, N500].sort((a, b) => chromatism.difference(b, color) - chromatism.difference(a, color))[0];
25
+ const contrastColor = [N0, N500].sort((a, b) => chromatism.difference(b, colorValue) - chromatism.difference(a, colorValue))[0];
22
26
  if (!useIconToken) {
23
27
  return contrastColor;
24
28
  }
@@ -53,7 +57,7 @@ const ColorPalette = props => {
53
57
  const colorsPerRow = React.useMemo(() => {
54
58
  return getColorsPerRowFromPalette(palette, cols);
55
59
  }, [palette, cols]);
56
- return jsx(React.Fragment, null, colorsPerRow.map((row, rowIdx) => jsx("div", {
60
+ return jsx(React.Fragment, null, colorsPerRow.map(row => jsx("div", {
57
61
  css: colorPaletteWrapper,
58
62
  className: className,
59
63
  key: `row-first-color-${row[0].value}`,
@@ -63,7 +67,7 @@ const ColorPalette = props => {
63
67
  label,
64
68
  border,
65
69
  message
66
- }, colorIdx) => {
70
+ }) => {
67
71
  if (showSomewhatSemanticTooltips && paletteColorTooltipMessages) {
68
72
  if (tokenTheme === 'dark') {
69
73
  message = getColorMessage(paletteColorTooltipMessages.dark, value.toUpperCase());
@@ -28,4 +28,17 @@ export function getSelectedRowAndColumn(colorsPerRow, selectedColor) {
28
28
  export function getSelectedRowAndColumnFromPalette(palette, selectedColor, cols = DEFAULT_COLOR_PICKER_COLUMNS) {
29
29
  const colorsPerRow = getColorsPerRowFromPalette(palette, cols);
30
30
  return getSelectedRowAndColumn(colorsPerRow, selectedColor);
31
- }
31
+ }
32
+ export const getTokenCSSVariableValue = variableExpression => {
33
+ const matcher = variableExpression.match(/var\(([^,\)]+)(,.*)?\)/);
34
+ if (matcher) {
35
+ const variable = matcher[1].trim();
36
+ const fallback = matcher[2] ? matcher[2].replace(',', '').trim() : '';
37
+ if (typeof document === 'undefined') {
38
+ return fallback;
39
+ }
40
+ const value = window.getComputedStyle(document.documentElement).getPropertyValue(variable).trim();
41
+ return value || fallback;
42
+ }
43
+ return '';
44
+ };
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "74.52.0";
9
+ var packageVersion = "74.52.2";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -26,4 +26,5 @@ export { resizerStyles, resizerHandleShadowClassName } from './shared/resizer';
26
26
  export { gridStyles, GRID_GUTTER } from './shared/grid';
27
27
  export { smartCardStyles, FLOATING_TOOLBAR_LINKPICKER_CLASSNAME, DATASOURCE_INNER_CONTAINER_CLASSNAME } from './shared/smartCard';
28
28
  export { embedCardStyles, embedSpacingStyles, editIconStyles } from './shared/embedCard';
29
- export { buttonGroupStyle, separatorStyles, wrapperStyle, triggerWrapperStyles } from './shared/plugins';
29
+ export { buttonGroupStyle, separatorStyles, wrapperStyle, triggerWrapperStyles } from './shared/plugins';
30
+ export { UnsupportedSharedCssClassName, unsupportedStyles } from './shared/unsupported-content';
@@ -0,0 +1,11 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject;
3
+ import { css } from '@emotion/react';
4
+ import { akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorSelectedNodeClassName, getSelectionStyles, SelectionStyle } from '@atlaskit/editor-shared-styles';
5
+ export var UnsupportedSharedCssClassName = {
6
+ BLOCK_CONTAINER: 'unsupportedBlockView-content-wrap',
7
+ INLINE_CONTAINER: 'unsupportedInlineView-content-wrap'
8
+ };
9
+ var inlineUnsupportedSelector = ".".concat(UnsupportedSharedCssClassName.INLINE_CONTAINER, " > span:nth-of-type(2)");
10
+ var blockUnsupportedSelector = ".".concat(UnsupportedSharedCssClassName.BLOCK_CONTAINER, " > div");
11
+ export var unsupportedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", ", ", " {\n cursor: pointer;\n }\n\n .", "", ",\n .", "", " {\n ", "\n }\n\n .danger {\n .", "", ",\n .", "", " {\n border: ", "px solid\n ", ";\n background-color: ", ";\n }\n }\n"])), blockUnsupportedSelector, inlineUnsupportedSelector, akEditorSelectedNodeClassName, blockUnsupportedSelector, akEditorSelectedNodeClassName, inlineUnsupportedSelector, getSelectionStyles([SelectionStyle.Background, SelectionStyle.Border]), akEditorSelectedNodeClassName, blockUnsupportedSelector, akEditorSelectedNodeClassName, inlineUnsupportedSelector, akEditorSelectedBorderSize, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), "var(--ds-blanket-danger, ".concat(akEditorDeleteBackgroundWithOpacity, ")"));
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
18
18
  import { borderRadius } from '@atlaskit/theme/constants';
19
19
  import Layer from '../Layer';
20
20
  var packageName = "@atlaskit/editor-common";
21
- var packageVersion = "74.52.0";
21
+ var packageVersion = "74.52.2";
22
22
  var halfFocusRing = 1;
23
23
  var dropOffset = '0, 8';
24
24
  var DropList = /*#__PURE__*/function (_Component) {
@@ -8,18 +8,22 @@ import { useThemeObserver } from '@atlaskit/tokens';
8
8
  import Color from './Color';
9
9
  import getColorMessage from './Palettes/getColorMessage';
10
10
  import { colorPaletteWrapper } from './styles';
11
- import { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette } from './utils';
11
+ import { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getTokenCSSVariableValue } from './utils';
12
12
  /**
13
13
  * For a given color pick the color from a list of colors with
14
14
  * the highest contrast
15
15
  *
16
- * @param color color string, suppports HEX, RGB, RGBA etc.
16
+ * @param color color string, supports HEX, RGB, RGBA etc.
17
+ * @param useIconToken boolean, describes if a token should be used for the icon color
17
18
  * @return Highest contrast color in pool
18
19
  */
19
20
  function getCheckMarkColor(color, useIconToken) {
21
+ var tokenVal = getTokenCSSVariableValue(color);
22
+ var colorValue = !!tokenVal ? tokenVal : color;
23
+
20
24
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
21
25
  var contrastColor = [N0, N500].sort(function (a, b) {
22
- return chromatism.difference(b, color) - chromatism.difference(a, color);
26
+ return chromatism.difference(b, colorValue) - chromatism.difference(a, colorValue);
23
27
  })[0];
24
28
  if (!useIconToken) {
25
29
  return contrastColor;
@@ -50,13 +54,13 @@ var ColorPalette = function ColorPalette(props) {
50
54
  var colorsPerRow = React.useMemo(function () {
51
55
  return getColorsPerRowFromPalette(palette, cols);
52
56
  }, [palette, cols]);
53
- return jsx(React.Fragment, null, colorsPerRow.map(function (row, rowIdx) {
57
+ return jsx(React.Fragment, null, colorsPerRow.map(function (row) {
54
58
  return jsx("div", {
55
59
  css: colorPaletteWrapper,
56
60
  className: className,
57
61
  key: "row-first-color-".concat(row[0].value),
58
62
  role: "radiogroup"
59
- }, row.map(function (_ref, colorIdx) {
63
+ }, row.map(function (_ref) {
60
64
  var value = _ref.value,
61
65
  label = _ref.label,
62
66
  border = _ref.border,
@@ -29,4 +29,17 @@ export function getSelectedRowAndColumnFromPalette(palette, selectedColor) {
29
29
  var cols = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_COLOR_PICKER_COLUMNS;
30
30
  var colorsPerRow = getColorsPerRowFromPalette(palette, cols);
31
31
  return getSelectedRowAndColumn(colorsPerRow, selectedColor);
32
- }
32
+ }
33
+ export var getTokenCSSVariableValue = function getTokenCSSVariableValue(variableExpression) {
34
+ var matcher = variableExpression.match(/var\(([^,\)]+)(,.*)?\)/);
35
+ if (matcher) {
36
+ var variable = matcher[1].trim();
37
+ var fallback = matcher[2] ? matcher[2].replace(',', '').trim() : '';
38
+ if (typeof document === 'undefined') {
39
+ return fallback;
40
+ }
41
+ var value = window.getComputedStyle(document.documentElement).getPropertyValue(variable).trim();
42
+ return value || fallback;
43
+ }
44
+ return '';
45
+ };
@@ -27,3 +27,4 @@ export { gridStyles, GRID_GUTTER } from './shared/grid';
27
27
  export { smartCardStyles, FLOATING_TOOLBAR_LINKPICKER_CLASSNAME, DATASOURCE_INNER_CONTAINER_CLASSNAME, } from './shared/smartCard';
28
28
  export { embedCardStyles, embedSpacingStyles, editIconStyles, } from './shared/embedCard';
29
29
  export { buttonGroupStyle, separatorStyles, wrapperStyle, triggerWrapperStyles, } from './shared/plugins';
30
+ export { UnsupportedSharedCssClassName, unsupportedStyles, } from './shared/unsupported-content';
@@ -0,0 +1,5 @@
1
+ export declare const UnsupportedSharedCssClassName: {
2
+ BLOCK_CONTAINER: string;
3
+ INLINE_CONTAINER: string;
4
+ };
5
+ export declare const unsupportedStyles: import("@emotion/react").SerializedStyles;
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { WrappedComponentProps } from 'react-intl-next';
4
- import { PaletteColor, PaletteTooltipMessages } from './Palettes/type';
3
+ import type { WrappedComponentProps } from 'react-intl-next';
4
+ import type { PaletteColor, PaletteTooltipMessages } from './Palettes/type';
5
5
  interface Props {
6
6
  selectedColor: string | null;
7
7
  onClick: (value: string, label: string) => void;
@@ -27,7 +27,7 @@ interface Props {
27
27
  * tooltip messages. Which is same as palette, where consumer determines which
28
28
  * colors ColorPalette should render.
29
29
  * Same way now consumer will determine which tooltip messages should
30
- * be used using paletteColorTooltipMessages option.
30
+ * be using paletteColorTooltipMessages option.
31
31
  */
32
32
  paletteColorTooltipMessages?: PaletteTooltipMessages;
33
33
  /**
@@ -39,12 +39,6 @@ interface Props {
39
39
  };
40
40
  }
41
41
  declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
42
- WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>; /**
43
- * If hexToPaletteColor is passed, it will be called to convert
44
- * hexCodes passed in palette props to DST token.
45
- * Different color palette will set different mapping function.
46
- * Such as text and background color palette uses different
47
- * mapping function to map tokens.
48
- */
42
+ WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
49
43
  };
50
44
  export default _default;
@@ -1,4 +1,4 @@
1
- import { PaletteColor } from './Palettes/type';
1
+ import type { PaletteColor } from './Palettes/type';
2
2
  export declare const DEFAULT_COLOR_PICKER_COLUMNS = 7;
3
3
  export declare function getColorsPerRowFromPalette(palette: PaletteColor[], cols?: number): PaletteColor[][];
4
4
  export declare function getSelectedRowAndColumn(colorsPerRow: PaletteColor[][], selectedColor: string | null): {
@@ -9,3 +9,4 @@ export declare function getSelectedRowAndColumnFromPalette(palette: PaletteColor
9
9
  selectedRowIndex: number;
10
10
  selectedColumnIndex: number;
11
11
  };
12
+ export declare const getTokenCSSVariableValue: (variableExpression: string) => string;
@@ -27,3 +27,4 @@ export { gridStyles, GRID_GUTTER } from './shared/grid';
27
27
  export { smartCardStyles, FLOATING_TOOLBAR_LINKPICKER_CLASSNAME, DATASOURCE_INNER_CONTAINER_CLASSNAME, } from './shared/smartCard';
28
28
  export { embedCardStyles, embedSpacingStyles, editIconStyles, } from './shared/embedCard';
29
29
  export { buttonGroupStyle, separatorStyles, wrapperStyle, triggerWrapperStyles, } from './shared/plugins';
30
+ export { UnsupportedSharedCssClassName, unsupportedStyles, } from './shared/unsupported-content';
@@ -0,0 +1,5 @@
1
+ export declare const UnsupportedSharedCssClassName: {
2
+ BLOCK_CONTAINER: string;
3
+ INLINE_CONTAINER: string;
4
+ };
5
+ export declare const unsupportedStyles: import("@emotion/react").SerializedStyles;
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { WrappedComponentProps } from 'react-intl-next';
4
- import { PaletteColor, PaletteTooltipMessages } from './Palettes/type';
3
+ import type { WrappedComponentProps } from 'react-intl-next';
4
+ import type { PaletteColor, PaletteTooltipMessages } from './Palettes/type';
5
5
  interface Props {
6
6
  selectedColor: string | null;
7
7
  onClick: (value: string, label: string) => void;
@@ -27,7 +27,7 @@ interface Props {
27
27
  * tooltip messages. Which is same as palette, where consumer determines which
28
28
  * colors ColorPalette should render.
29
29
  * Same way now consumer will determine which tooltip messages should
30
- * be used using paletteColorTooltipMessages option.
30
+ * be using paletteColorTooltipMessages option.
31
31
  */
32
32
  paletteColorTooltipMessages?: PaletteTooltipMessages;
33
33
  /**
@@ -39,12 +39,6 @@ interface Props {
39
39
  };
40
40
  }
41
41
  declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
42
- WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>; /**
43
- * If hexToPaletteColor is passed, it will be called to convert
44
- * hexCodes passed in palette props to DST token.
45
- * Different color palette will set different mapping function.
46
- * Such as text and background color palette uses different
47
- * mapping function to map tokens.
48
- */
42
+ WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
49
43
  };
50
44
  export default _default;
@@ -1,4 +1,4 @@
1
- import { PaletteColor } from './Palettes/type';
1
+ import type { PaletteColor } from './Palettes/type';
2
2
  export declare const DEFAULT_COLOR_PICKER_COLUMNS = 7;
3
3
  export declare function getColorsPerRowFromPalette(palette: PaletteColor[], cols?: number): PaletteColor[][];
4
4
  export declare function getSelectedRowAndColumn(colorsPerRow: PaletteColor[][], selectedColor: string | null): {
@@ -9,3 +9,4 @@ export declare function getSelectedRowAndColumnFromPalette(palette: PaletteColor
9
9
  selectedRowIndex: number;
10
10
  selectedColumnIndex: number;
11
11
  };
12
+ export declare const getTokenCSSVariableValue: (variableExpression: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.52.0",
3
+ "version": "74.52.2",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -105,14 +105,14 @@
105
105
  "@atlaskit/media-client": "^23.1.0",
106
106
  "@atlaskit/media-picker": "^66.1.0",
107
107
  "@atlaskit/mention": "^22.1.0",
108
- "@atlaskit/menu": "^1.9.0",
108
+ "@atlaskit/menu": "^1.10.0",
109
109
  "@atlaskit/platform-feature-flags": "^0.2.0",
110
110
  "@atlaskit/profilecard": "^19.5.0",
111
111
  "@atlaskit/smart-user-picker": "^6.3.0",
112
112
  "@atlaskit/spinner": "^15.5.0",
113
113
  "@atlaskit/task-decision": "^17.7.0",
114
114
  "@atlaskit/theme": "^12.5.0",
115
- "@atlaskit/tokens": "^1.15.0",
115
+ "@atlaskit/tokens": "^1.16.0",
116
116
  "@atlaskit/tooltip": "^17.8.0",
117
117
  "@atlaskit/ufo": "^0.2.0",
118
118
  "@atlaskit/width-detector": "^4.1.0",
@@ -200,4 +200,4 @@
200
200
  "type": "boolean"
201
201
  }
202
202
  }
203
- }
203
+ }