@atlaskit/editor-common 71.0.2 → 72.0.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.
- package/CHANGELOG.md +77 -0
- package/dist/cjs/analytics/types/enums.js +20 -1
- package/dist/cjs/i18n/index.js +13 -5
- package/dist/cjs/i18n/languages.js +42 -0
- package/dist/cjs/keymaps/index.js +55 -3
- package/dist/cjs/styles/index.js +8 -2
- package/dist/cjs/styles/shared/annotation.js +4 -7
- package/dist/cjs/styles/shared/block-marks.js +1 -1
- package/dist/cjs/styles/shared/code-block.js +3 -4
- package/dist/cjs/styles/shared/lists.js +55 -4
- package/dist/cjs/styles/shared/panel.js +6 -12
- package/dist/cjs/styles/shared/shadow.js +3 -1
- package/dist/cjs/styles/shared/table.js +2 -2
- package/dist/cjs/types/next-editor-plugin.js +5 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/Emoji/index.js +11 -2
- package/dist/cjs/ui/Popup/index.js +72 -2
- package/dist/cjs/ui/Popup/utils.js +13 -6
- package/dist/cjs/ui/UnsupportedBlock/index.js +2 -2
- package/dist/cjs/ui/UnsupportedInline/index.js +2 -2
- package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +138 -0
- package/dist/cjs/ui-color/ColorPalette/index.js +19 -1
- package/dist/cjs/ui-menu/DropdownMenu/index.js +2 -0
- package/dist/cjs/ui-menu/ToolbarButton/index.js +3 -1
- package/dist/cjs/utils/analytics.js +1 -38
- package/dist/cjs/utils/builder.js +44 -0
- package/dist/cjs/utils/compareNodes.js +86 -33
- package/dist/cjs/utils/index.js +47 -1
- package/dist/cjs/utils/list.js +47 -0
- package/dist/cjs/utils/plugin-state-factory.js +9 -9
- package/dist/cjs/utils/referentiality.js +281 -2
- package/dist/cjs/utils/track-unsupported-content.js +19 -20
- package/dist/cjs/utils/validate-using-spec.js +8 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/types/enums.js +20 -1
- package/dist/es2019/i18n/index.js +4 -3
- package/dist/es2019/i18n/languages.js +34 -0
- package/dist/es2019/keymaps/index.js +47 -0
- package/dist/es2019/styles/index.js +1 -1
- package/dist/es2019/styles/shared/annotation.js +4 -7
- package/dist/es2019/styles/shared/block-marks.js +8 -1
- package/dist/es2019/styles/shared/code-block.js +7 -6
- package/dist/es2019/styles/shared/lists.js +44 -2
- package/dist/es2019/styles/shared/panel.js +6 -11
- package/dist/es2019/styles/shared/shadow.js +21 -6
- package/dist/es2019/styles/shared/table.js +2 -3
- package/dist/es2019/types/next-editor-plugin.js +1 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/Emoji/index.js +11 -2
- package/dist/es2019/ui/Popup/index.js +68 -2
- package/dist/es2019/ui/Popup/utils.js +13 -6
- package/dist/es2019/ui/UnsupportedBlock/index.js +1 -1
- package/dist/es2019/ui/UnsupportedInline/index.js +1 -1
- package/dist/es2019/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +120 -0
- package/dist/es2019/ui-color/ColorPalette/index.js +28 -12
- package/dist/es2019/ui-menu/DropdownMenu/index.js +2 -0
- package/dist/es2019/ui-menu/ToolbarButton/index.js +3 -1
- package/dist/es2019/utils/analytics.js +0 -33
- package/dist/es2019/utils/builder.js +16 -0
- package/dist/es2019/utils/compareNodes.js +79 -28
- package/dist/es2019/utils/index.js +4 -2
- package/dist/es2019/utils/list.js +31 -0
- package/dist/es2019/utils/plugin-state-factory.js +9 -9
- package/dist/es2019/utils/referentiality.js +240 -0
- package/dist/es2019/utils/track-unsupported-content.js +20 -16
- package/dist/es2019/utils/validate-using-spec.js +8 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/types/enums.js +20 -1
- package/dist/esm/i18n/index.js +4 -3
- package/dist/esm/i18n/languages.js +34 -0
- package/dist/esm/keymaps/index.js +48 -0
- package/dist/esm/styles/index.js +1 -1
- package/dist/esm/styles/shared/annotation.js +4 -7
- package/dist/esm/styles/shared/block-marks.js +1 -1
- package/dist/esm/styles/shared/code-block.js +3 -4
- package/dist/esm/styles/shared/lists.js +49 -2
- package/dist/esm/styles/shared/panel.js +6 -11
- package/dist/esm/styles/shared/shadow.js +2 -2
- package/dist/esm/styles/shared/table.js +2 -3
- package/dist/esm/types/next-editor-plugin.js +1 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/Emoji/index.js +11 -2
- package/dist/esm/ui/Popup/index.js +73 -2
- package/dist/esm/ui/Popup/utils.js +13 -6
- package/dist/esm/ui/UnsupportedBlock/index.js +1 -1
- package/dist/esm/ui/UnsupportedInline/index.js +1 -1
- package/dist/esm/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +124 -0
- package/dist/esm/ui-color/ColorPalette/index.js +18 -2
- package/dist/esm/ui-menu/DropdownMenu/index.js +2 -0
- package/dist/esm/ui-menu/ToolbarButton/index.js +3 -1
- package/dist/esm/utils/analytics.js +0 -33
- package/dist/esm/utils/builder.js +30 -0
- package/dist/esm/utils/compareNodes.js +83 -32
- package/dist/esm/utils/index.js +4 -2
- package/dist/esm/utils/list.js +31 -0
- package/dist/esm/utils/plugin-state-factory.js +9 -9
- package/dist/esm/utils/referentiality.js +269 -0
- package/dist/esm/utils/track-unsupported-content.js +19 -20
- package/dist/esm/utils/validate-using-spec.js +8 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/types/enums.d.ts +23 -4
- package/dist/types/collab/types.d.ts +1 -1
- package/dist/types/i18n/index.d.ts +4 -3
- package/dist/types/i18n/languages.d.ts +35 -0
- package/dist/types/keymaps/index.d.ts +1 -0
- package/dist/types/styles/index.d.ts +1 -1
- package/dist/types/styles/shared/lists.d.ts +3 -1
- package/dist/types/types/collab.d.ts +1 -1
- package/dist/types/types/copy-button.d.ts +4 -0
- package/dist/types/types/feature-flags.d.ts +30 -25
- package/dist/types/types/floating-toolbar.d.ts +26 -1
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/types/next-editor-plugin.d.ts +61 -0
- package/dist/types/ui/Emoji/index.d.ts +2 -0
- package/dist/types/ui/Popup/index.d.ts +19 -0
- package/dist/types/ui/Popup/utils.d.ts +3 -3
- package/dist/types/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.d.ts +214 -0
- package/dist/types/ui-color/ColorPalette/index.d.ts +7 -0
- package/dist/types/ui-menu/DropdownMenu/types.d.ts +1 -0
- package/dist/types/ui-menu/ToolbarButton/index.d.ts +3 -1
- package/dist/types/utils/analytics.d.ts +1 -21
- package/dist/types/utils/builder.d.ts +8 -0
- package/dist/types/utils/compareNodes.d.ts +16 -0
- package/dist/types/utils/index.d.ts +3 -1
- package/dist/types/utils/list.d.ts +10 -0
- package/dist/types/utils/plugin-state-factory.d.ts +1 -1
- package/dist/types/utils/referentiality.d.ts +4 -0
- package/dist/types/utils/track-unsupported-content.d.ts +14 -2
- package/package.json +15 -12
- package/report.api.md +1 -1
|
@@ -1,9 +1,56 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
4
|
|
|
3
5
|
var _templateObject;
|
|
4
6
|
|
|
5
7
|
import { css } from '@emotion/react';
|
|
6
8
|
import { bulletListSelector, orderedListSelector } from '@atlaskit/adf-schema';
|
|
7
9
|
import browser from '../../utils/browser';
|
|
8
|
-
export var
|
|
9
|
-
|
|
10
|
+
export var listItemCounterPadding = 24;
|
|
11
|
+
var CSS_VAR_NAMES;
|
|
12
|
+
|
|
13
|
+
(function (CSS_VAR_NAMES) {
|
|
14
|
+
CSS_VAR_NAMES["ITEM_COUNTER_PADDING"] = "--ed--list--item-counter--padding";
|
|
15
|
+
})(CSS_VAR_NAMES || (CSS_VAR_NAMES = {}));
|
|
16
|
+
|
|
17
|
+
var getItemCounterLeftPadding = function getItemCounterLeftPadding(itemCounterDigitsSize) {
|
|
18
|
+
// Previous padding-left was approximately 24px. We approximate that
|
|
19
|
+
// same value using "ch" units (which represent the width of a "0" digit
|
|
20
|
+
// character). We use "ch" so that this computed padding can now grow if
|
|
21
|
+
// the font-size ever enlarges.
|
|
22
|
+
var paddingLeft = "2.385ch";
|
|
23
|
+
|
|
24
|
+
if (itemCounterDigitsSize >= 3) {
|
|
25
|
+
// When there are 3 or more digits, we use a combination of "ch" units and
|
|
26
|
+
// pixel values so that while the computed padding grows if font-size ever
|
|
27
|
+
// enlarges, it doesn't over-scale with each digit (because of the fixed pixel
|
|
28
|
+
// portion of the computed value). This way, very large item counters will not
|
|
29
|
+
// become overly left-padded.
|
|
30
|
+
var fixedBasePx = 2;
|
|
31
|
+
paddingLeft = "calc(".concat(itemCounterDigitsSize + 1, "ch - ").concat(fixedBasePx, "px)");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return paddingLeft;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var stringifyStyle = function stringifyStyle(style) {
|
|
38
|
+
return Object.entries(style).reduce(function (str, _ref) {
|
|
39
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
40
|
+
key = _ref2[0],
|
|
41
|
+
value = _ref2[1];
|
|
42
|
+
|
|
43
|
+
return "".concat(str).concat(key, ":").concat(value, ";");
|
|
44
|
+
}, "");
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export function getOrderedListInlineStyles(itemCounterDigitsSize, styleFormat) {
|
|
48
|
+
var style = _defineProperty({}, CSS_VAR_NAMES.ITEM_COUNTER_PADDING, getItemCounterLeftPadding(itemCounterDigitsSize));
|
|
49
|
+
|
|
50
|
+
if (styleFormat === 'string') {
|
|
51
|
+
return stringifyStyle(style);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return style;
|
|
55
|
+
}
|
|
56
|
+
export var listsSharedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* =============== INDENTATION SPACING ========= */\n\n ul,\n ol {\n box-sizing: border-box;\n padding-left: var(\n ", ",\n ", "px\n );\n\n /*\n Firefox does not handle empty block element inside li tag.\n If there is not block element inside li tag,\n then firefox sets inherited height to li\n However, if there is any block element and if it's empty\n (or has empty inline element) then\n firefox sets li tag height to zero.\n More details at\n https://product-fabric.atlassian.net/wiki/spaces/~455502413/pages/3149365890/ED-14110+Investigation\n */\n li p:empty,\n li p > span:empty {\n ", "\n }\n }\n\n ", ", ", " {\n /*\n Ensures list item content adheres to the list's margin instead\n of filling the entire block row. This is important to allow\n clicking interactive elements which are floated next to a list.\n\n For some history and context on this block, see PRs related to tickets.:\n @see ED-6551 - original issue.\n @see ED-7015 - follow up issue.\n @see ED-7447 - flow-root change.\n\n We use 'display: table' (old clear fix / new block formatting context hack)\n for older browsers and 'flow-root' for modern browsers.\n\n @see https://css-tricks.com/display-flow-root/\n */\n // For older browsers the do not support flow-root.\n /* stylelint-disable declaration-block-no-duplicate-properties */\n display: table;\n display: flow-root;\n /* stylelint-enable declaration-block-no-duplicate-properties */\n }\n\n /* =============== INDENTATION AESTHETICS ========= */\n\n /**\n We support nested lists up to six levels deep.\n **/\n\n /* LEGACY LISTS */\n\n ul,\n ul ul ul ul {\n list-style-type: disc;\n }\n\n ul ul,\n ul ul ul ul ul {\n list-style-type: circle;\n }\n\n ul ul ul,\n ul ul ul ul ul ul {\n list-style-type: square;\n }\n\n ol,\n ol ol ol ol {\n list-style-type: decimal;\n }\n ol ol,\n ol ol ol ol ol {\n list-style-type: lower-alpha;\n }\n ol ol ol,\n ol ol ol ol ol ol {\n list-style-type: lower-roman;\n }\n\n /* PREDICTABLE LISTS */\n\n ol[data-indent-level='1'],\n ol[data-indent-level='4'] {\n list-style-type: decimal;\n }\n\n ol[data-indent-level='2'],\n ol[data-indent-level='5'] {\n list-style-type: lower-alpha;\n }\n\n ol[data-indent-level='3'],\n ol[data-indent-level='6'] {\n list-style-type: lower-roman;\n }\n\n ul[data-indent-level='1'],\n ul[data-indent-level='4'] {\n list-style-type: disc;\n }\n\n ul[data-indent-level='2'],\n ul[data-indent-level='5'] {\n list-style-type: circle;\n }\n\n ul[data-indent-level='3'],\n ul[data-indent-level='6'] {\n list-style-type: square;\n }\n"])), CSS_VAR_NAMES.ITEM_COUNTER_PADDING, listItemCounterPadding, browser.gecko ? 'display: inline-block;' : '', orderedListSelector, bulletListSelector);
|
|
@@ -3,8 +3,10 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
|
|
4
4
|
var _templateObject, _templateObject2;
|
|
5
5
|
|
|
6
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
6
7
|
import { css } from '@emotion/react';
|
|
7
8
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
9
|
+
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
8
10
|
import { akEditorTableCellMinWidth, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
|
|
9
11
|
import { akEditorCustomIconSize } from '@atlaskit/editor-shared-styles/consts';
|
|
10
12
|
import { emojiImage, emojiSprite } from '@atlaskit/emoji';
|
|
@@ -21,9 +23,6 @@ var tokenPanelColor = {
|
|
|
21
23
|
error: 'color.background.danger'
|
|
22
24
|
};
|
|
23
25
|
var lightPanelColor = {
|
|
24
|
-
// TODO: https://product-fabric.atlassian.net/browse/DSP-4066
|
|
25
|
-
|
|
26
|
-
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
27
26
|
info: colors.B50,
|
|
28
27
|
note: colors.P50,
|
|
29
28
|
tip: colors.G50,
|
|
@@ -93,8 +92,6 @@ export var darkPanelColors = {
|
|
|
93
92
|
LightGray: '#5A6977',
|
|
94
93
|
TextColor: '#D9DDE3'
|
|
95
94
|
};
|
|
96
|
-
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
97
|
-
|
|
98
95
|
var lightIconColor = {
|
|
99
96
|
info: token('color.icon.information', colors.B400),
|
|
100
97
|
note: token('color.icon.discovery', colors.P400),
|
|
@@ -116,15 +113,15 @@ var darkIconColor = {
|
|
|
116
113
|
var panelEmojiSpriteVerticalAlignment = -(gridSize() * 3 - akEditorCustomIconSize) / 2;
|
|
117
114
|
var panelEmojiImageVerticalAlignment = panelEmojiSpriteVerticalAlignment - 1; // TODO: https://product-fabric.atlassian.net/browse/DSP-4066
|
|
118
115
|
|
|
119
|
-
|
|
116
|
+
var panelDarkModeColors = [[colors.B50, darkPanelColors.B1200S], [colors.B75, darkPanelColors.B900], [colors.B100, darkPanelColors.B800S], [colors.N0, darkPanelColors.LightGray], [colors.N20, darkPanelColors.Gray], [colors.N60, darkPanelColors.DarkGray], [colors.T50, darkPanelColors.T1200S], [colors.T75, darkPanelColors.T900], [colors.T100, darkPanelColors.T900S], [colors.G50, darkPanelColors.G1200S], [colors.G75, darkPanelColors.G900], [colors.G200, darkPanelColors.G900S], [colors.Y50, darkPanelColors.Y1200S], [colors.Y75, darkPanelColors.Y900], [colors.Y200, darkPanelColors.Y800S], [colors.R50, darkPanelColors.R1200S], [colors.R75, darkPanelColors.R900], [colors.R100, darkPanelColors.R800S], [colors.P50, darkPanelColors.P1200S], [colors.P75, darkPanelColors.P900], [colors.P100, darkPanelColors.P800S]]; // used for custom panels
|
|
120
117
|
|
|
121
|
-
var panelDarkModeColors = [[colors.B50, darkPanelColors.B1200S], [colors.B75, darkPanelColors.B900], [colors.B100, darkPanelColors.B800S], [colors.N0, darkPanelColors.LightGray], [colors.N20, darkPanelColors.Gray], [colors.N60, darkPanelColors.DarkGray], [colors.T50, darkPanelColors.T1200S], [colors.T75, darkPanelColors.T900], [colors.T100, darkPanelColors.T900S], [colors.G50, darkPanelColors.G1200S], [colors.G75, darkPanelColors.G900], [colors.G200, darkPanelColors.G900S], [colors.Y50, darkPanelColors.Y1200S], [colors.Y75, darkPanelColors.Y900], [colors.Y200, darkPanelColors.Y800S], [colors.R50, darkPanelColors.R1200S], [colors.R75, darkPanelColors.R900], [colors.R100, darkPanelColors.R800S], [colors.P50, darkPanelColors.P1200S], [colors.P75, darkPanelColors.P900], [colors.P100, darkPanelColors.P800S]];
|
|
122
118
|
export var getPanelDarkColor = function getPanelDarkColor(panelColor) {
|
|
123
119
|
var colorObject = panelDarkModeColors.find(function (color) {
|
|
124
120
|
return color[0] === panelColor || color[1] === panelColor;
|
|
125
121
|
});
|
|
126
122
|
return colorObject ? colorObject[1] : darkPanelColors.B1200S;
|
|
127
|
-
};
|
|
123
|
+
}; // used for custom panels
|
|
124
|
+
|
|
128
125
|
export var getPanelBackgroundDarkModeColors = panelDarkModeColors.map(function (_ref) {
|
|
129
126
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
130
127
|
colorName = _ref2[0],
|
|
@@ -193,10 +190,8 @@ export var getPanelTypeBackground = function getPanelTypeBackground(panelType) {
|
|
|
193
190
|
// TODO: https://product-fabric.atlassian.net/browse/DSP-4066
|
|
194
191
|
|
|
195
192
|
/* eslint-disable @atlaskit/design-system/no-unsafe-design-token-usage */
|
|
196
|
-
var light =
|
|
193
|
+
var light = hexToEditorBackgroundPaletteColor(lightPanelColor[panelType]);
|
|
197
194
|
var dark = token(tokenPanelColor[panelType], darkPanelColors[panelType]);
|
|
198
|
-
/* eslint-disable @atlaskit/design-system/no-unsafe-design-token-usage */
|
|
199
|
-
|
|
200
195
|
var background = themed({
|
|
201
196
|
light: light,
|
|
202
197
|
dark: dark
|
|
@@ -3,10 +3,10 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
3
3
|
var _templateObject;
|
|
4
4
|
|
|
5
5
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
6
|
-
// TODO: https://product-fabric.atlassian.net/browse/DSP-4116
|
|
7
6
|
import { css } from '@emotion/react';
|
|
8
7
|
import { akEditorShadowZIndex } from '@atlaskit/editor-shared-styles';
|
|
9
8
|
import { N40A } from '@atlaskit/theme/colors';
|
|
9
|
+
import { token } from '@atlaskit/tokens';
|
|
10
10
|
import { shadowClassNames } from '../../ui/OverflowShadow';
|
|
11
11
|
import { shadowObserverClassNames } from '../../ui/OverflowShadow/shadowObserver';
|
|
12
12
|
var shadowWidth = 8;
|
|
@@ -24,5 +24,5 @@ var shadowWidth = 8;
|
|
|
24
24
|
* background-attachment: local, local, scroll, scroll;
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
var shadowSharedStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &\n .", "::before,\n .", "::after,\n .", "::before,\n .", "::after {\n display: none;\n position: absolute;\n pointer-events: none;\n z-index: ", ";\n width: ", "px;\n content: '';\n /* Scrollbar is outside the content in IE, inset in other browsers. */\n height: calc(100%);\n }\n\n & .", ", .", " {\n position: relative;\n }\n\n & .", "::before {\n background: linear-gradient(to left
|
|
27
|
+
var shadowSharedStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &\n .", "::before,\n .", "::after,\n .", "::before,\n .", "::after {\n display: none;\n position: absolute;\n pointer-events: none;\n z-index: ", ";\n width: ", "px;\n content: '';\n /* Scrollbar is outside the content in IE, inset in other browsers. */\n height: calc(100%);\n }\n\n & .", ", .", " {\n position: relative;\n }\n\n & .", "::before {\n background: linear-gradient(\n to left,\n transparent 0,\n ", " 100%\n ),\n linear-gradient(\n to right,\n ", " 0px,\n transparent 1px\n );\n top: 0px;\n left: 0;\n display: block;\n }\n\n & .", "::after {\n background: linear-gradient(\n to right,\n transparent 0,\n ", " 100%\n ),\n linear-gradient(\n to left,\n ", " 0px,\n transparent 1px\n );\n left: calc(100% - ", "px);\n top: 0px;\n display: block;\n }\n\n & .", " {\n height: 100%;\n width: 0px;\n min-width: 0px;\n }\n\n & .", " {\n height: 100%;\n width: 0px;\n min-width: 0px;\n }\n"])), shadowClassNames.RIGHT_SHADOW, shadowClassNames.RIGHT_SHADOW, shadowClassNames.LEFT_SHADOW, shadowClassNames.LEFT_SHADOW, akEditorShadowZIndex, shadowWidth, shadowClassNames.RIGHT_SHADOW, shadowClassNames.LEFT_SHADOW, shadowClassNames.LEFT_SHADOW, token('elevation.shadow.overflow.spread', N40A), token('elevation.shadow.overflow.perimeter', 'transparent'), shadowClassNames.RIGHT_SHADOW, token('elevation.shadow.overflow.spread', N40A), token('elevation.shadow.overflow.perimeter', 'transparent'), shadowWidth, shadowObserverClassNames.SENTINEL_LEFT, shadowObserverClassNames.SENTINEL_RIGHT);
|
|
28
28
|
export { shadowSharedStyle };
|
|
@@ -3,7 +3,6 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
3
3
|
var _templateObject;
|
|
4
4
|
|
|
5
5
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
6
|
-
// TODO: https://product-fabric.atlassian.net/browse/DSP-4118
|
|
7
6
|
import { css } from '@emotion/react';
|
|
8
7
|
import { tableCellContentDomSelector, tableCellSelector, tableHeaderSelector, tablePrefixSelector } from '@atlaskit/adf-schema';
|
|
9
8
|
import { akEditorBreakoutPadding, akEditorFullWidthLayoutWidth, akEditorSelectedNodeClassName, akEditorTableBorder, akEditorTableBorderDark, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarDark, akEditorWideLayoutWidth, getTableCellBackgroundDarkModeColors, overflowShadow } from '@atlaskit/editor-shared-styles';
|
|
@@ -57,7 +56,7 @@ var tableSharedStyle = function tableSharedStyle(props) {
|
|
|
57
56
|
light: token('color.background.neutral', 'rgb(235, 237, 240)'),
|
|
58
57
|
dark: token('color.background.neutral', 'rgb(36, 47, 66)')
|
|
59
58
|
})(props),
|
|
60
|
-
|
|
59
|
+
leftCoverWidth: "".concat(gridSize() * 3, "px")
|
|
61
60
|
}), themed({
|
|
62
61
|
light: token('color.background.neutral', 'rgb(235, 237, 240)'),
|
|
63
62
|
dark: token('color.background.neutral', 'rgb(36, 47, 66)')
|
|
@@ -69,7 +68,7 @@ var tableSharedStyle = function tableSharedStyle(props) {
|
|
|
69
68
|
light: token('color.background.neutral', 'rgb(235, 237, 240)'),
|
|
70
69
|
dark: token('color.background.neutral', 'rgb(36, 47, 66)')
|
|
71
70
|
})(props),
|
|
72
|
-
|
|
71
|
+
leftCoverWidth: "".concat(gridSize() * 3, "px")
|
|
73
72
|
}), themed({
|
|
74
73
|
light: token('color.background.neutral', 'rgb(235, 237, 240)'),
|
|
75
74
|
dark: token('color.background.neutral', 'rgb(36, 47, 66)')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -23,7 +23,7 @@ import { borderRadius, gridSize } from '@atlaskit/theme/constants';
|
|
|
23
23
|
import { token } from '@atlaskit/tokens';
|
|
24
24
|
import Layer from '../Layer';
|
|
25
25
|
var packageName = "@atlaskit/editor-common";
|
|
26
|
-
var packageVersion = "
|
|
26
|
+
var packageVersion = "72.0.0";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = "0, ".concat(gridSize(), "px");
|
|
29
29
|
|
|
@@ -27,13 +27,16 @@ var EmojiNode = /*#__PURE__*/function (_PureComponent) {
|
|
|
27
27
|
_this = _super.call(this, props);
|
|
28
28
|
|
|
29
29
|
_defineProperty(_assertThisInitialized(_this), "renderWithProvider", function (providers) {
|
|
30
|
+
var _resourceConfig$optim;
|
|
31
|
+
|
|
30
32
|
var _this$props = _this.props,
|
|
31
33
|
allowTextFallback = _this$props.allowTextFallback,
|
|
32
34
|
shortName = _this$props.shortName,
|
|
33
35
|
id = _this$props.id,
|
|
34
36
|
fallback = _this$props.fallback,
|
|
35
37
|
fitToHeight = _this$props.fitToHeight,
|
|
36
|
-
showTooltip = _this$props.showTooltip
|
|
38
|
+
showTooltip = _this$props.showTooltip,
|
|
39
|
+
resourceConfig = _this$props.resourceConfig;
|
|
37
40
|
|
|
38
41
|
if (allowTextFallback && !providers.emojiProvider) {
|
|
39
42
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -55,7 +58,13 @@ var EmojiNode = /*#__PURE__*/function (_PureComponent) {
|
|
|
55
58
|
},
|
|
56
59
|
emojiProvider: providers.emojiProvider,
|
|
57
60
|
showTooltip: showTooltip,
|
|
58
|
-
fitToHeight: fitToHeight
|
|
61
|
+
fitToHeight: fitToHeight,
|
|
62
|
+
optimistic: true,
|
|
63
|
+
optimisticImageURL: resourceConfig === null || resourceConfig === void 0 ? void 0 : (_resourceConfig$optim = resourceConfig.optimisticImageApi) === null || _resourceConfig$optim === void 0 ? void 0 : _resourceConfig$optim.getUrl({
|
|
64
|
+
id: id,
|
|
65
|
+
fallback: fallback,
|
|
66
|
+
shortName: shortName
|
|
67
|
+
})
|
|
59
68
|
});
|
|
60
69
|
});
|
|
61
70
|
|
|
@@ -15,6 +15,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
15
15
|
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; } }
|
|
16
16
|
|
|
17
17
|
import React from 'react';
|
|
18
|
+
import createFocusTrap from 'focus-trap';
|
|
18
19
|
import rafSchedule from 'raf-schd';
|
|
19
20
|
import { createPortal } from 'react-dom';
|
|
20
21
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -44,6 +45,8 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
44
45
|
validPosition: true
|
|
45
46
|
});
|
|
46
47
|
|
|
48
|
+
_defineProperty(_assertThisInitialized(_this), "popupRef", /*#__PURE__*/React.createRef());
|
|
49
|
+
|
|
47
50
|
_defineProperty(_assertThisInitialized(_this), "placement", ['', '']);
|
|
48
51
|
|
|
49
52
|
_defineProperty(_assertThisInitialized(_this), "handleRef", function (popup) {
|
|
@@ -66,6 +69,25 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
66
69
|
_this.scheduledUpdatePosition(_this.props);
|
|
67
70
|
}) : undefined);
|
|
68
71
|
|
|
72
|
+
_defineProperty(_assertThisInitialized(_this), "initFocusTrap", rafSchedule(function () {
|
|
73
|
+
var popup = _this.popupRef.current;
|
|
74
|
+
|
|
75
|
+
if (!popup) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var trapConfig = {
|
|
80
|
+
clickOutsideDeactivates: true,
|
|
81
|
+
escapeDeactivates: true,
|
|
82
|
+
initialFocus: popup,
|
|
83
|
+
fallbackFocus: popup,
|
|
84
|
+
returnFocusOnDeactivate: false
|
|
85
|
+
};
|
|
86
|
+
_this.focusTrap = createFocusTrap(popup, trapConfig);
|
|
87
|
+
|
|
88
|
+
_this.focusTrap.activate();
|
|
89
|
+
}));
|
|
90
|
+
|
|
69
91
|
return _this;
|
|
70
92
|
}
|
|
71
93
|
|
|
@@ -88,13 +110,14 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
88
110
|
stick = props.stick,
|
|
89
111
|
forcePlacement = props.forcePlacement,
|
|
90
112
|
allowOutOfBounds = props.allowOutOfBounds,
|
|
91
|
-
rect = props.rect
|
|
113
|
+
rect = props.rect,
|
|
114
|
+
preventOverflow = props.preventOverflow;
|
|
92
115
|
|
|
93
116
|
if (!target || !popup) {
|
|
94
117
|
return {};
|
|
95
118
|
}
|
|
96
119
|
|
|
97
|
-
var placement = calculatePlacement(target, boundariesElement || document.body, fitWidth, fitHeight, alignX, alignY, forcePlacement);
|
|
120
|
+
var placement = calculatePlacement(target, boundariesElement || document.body, fitWidth, fitHeight, alignX, alignY, forcePlacement, preventOverflow);
|
|
98
121
|
|
|
99
122
|
if (onPlacementChanged && this.placement.join('') !== placement.join('')) {
|
|
100
123
|
onPlacementChanged(placement);
|
|
@@ -156,6 +179,7 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
156
179
|
}, {
|
|
157
180
|
key: "initPopup",
|
|
158
181
|
value: function initPopup(popup) {
|
|
182
|
+
this.popupRef.current = popup;
|
|
159
183
|
var target = this.props.target;
|
|
160
184
|
var overflowScrollParent = findOverflowScrollParent(popup);
|
|
161
185
|
|
|
@@ -179,6 +203,10 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
179
203
|
*/
|
|
180
204
|
|
|
181
205
|
this.scheduledUpdatePosition(this.props);
|
|
206
|
+
|
|
207
|
+
if (this.props.focusTrap) {
|
|
208
|
+
this.initFocusTrap();
|
|
209
|
+
}
|
|
182
210
|
}
|
|
183
211
|
}, {
|
|
184
212
|
key: "UNSAFE_componentWillReceiveProps",
|
|
@@ -187,6 +215,48 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
187
215
|
// get rendered and we end up with a wrong position
|
|
188
216
|
this.scheduledUpdatePosition(newProps);
|
|
189
217
|
}
|
|
218
|
+
}, {
|
|
219
|
+
key: "destroyFocusTrap",
|
|
220
|
+
value:
|
|
221
|
+
/**
|
|
222
|
+
* Cancels the initialisation of the focus trap if it has not yet occured
|
|
223
|
+
* Deactivates the focus trap if it exists
|
|
224
|
+
*/
|
|
225
|
+
function destroyFocusTrap() {
|
|
226
|
+
var _this$focusTrap;
|
|
227
|
+
|
|
228
|
+
this.initFocusTrap.cancel();
|
|
229
|
+
(_this$focusTrap = this.focusTrap) === null || _this$focusTrap === void 0 ? void 0 : _this$focusTrap.deactivate();
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Handle pausing, unpausing, and initialising (if not yet initialised) of the focus trap
|
|
233
|
+
*/
|
|
234
|
+
|
|
235
|
+
}, {
|
|
236
|
+
key: "handleChangedFocusTrapProp",
|
|
237
|
+
value: function handleChangedFocusTrapProp(prevProps) {
|
|
238
|
+
if (prevProps.focusTrap !== this.props.focusTrap) {
|
|
239
|
+
// If currently set to disable, then pause the trap if it exists
|
|
240
|
+
if (!this.props.focusTrap) {
|
|
241
|
+
var _this$focusTrap2;
|
|
242
|
+
|
|
243
|
+
return (_this$focusTrap2 = this.focusTrap) === null || _this$focusTrap2 === void 0 ? void 0 : _this$focusTrap2.pause();
|
|
244
|
+
} // If set to enabled and trap already exists, unpause
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
if (this.focusTrap) {
|
|
248
|
+
this.focusTrap.unpause();
|
|
249
|
+
} // Else initialise the focus trap
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
return this.initFocusTrap();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}, {
|
|
256
|
+
key: "componentDidUpdate",
|
|
257
|
+
value: function componentDidUpdate(prevProps) {
|
|
258
|
+
this.handleChangedFocusTrapProp(prevProps);
|
|
259
|
+
}
|
|
190
260
|
}, {
|
|
191
261
|
key: "componentDidMount",
|
|
192
262
|
value: function componentDidMount() {
|
|
@@ -222,6 +292,7 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
222
292
|
}
|
|
223
293
|
|
|
224
294
|
this.scheduledUpdatePosition.cancel();
|
|
295
|
+
this.destroyFocusTrap();
|
|
225
296
|
}
|
|
226
297
|
}, {
|
|
227
298
|
key: "renderPopup",
|
|
@@ -15,7 +15,7 @@ export function isTextNode(elem) {
|
|
|
15
15
|
* Decides if given fitHeight fits below or above the target taking boundaries into account.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
export function getVerticalPlacement(target, boundariesElement, fitHeight, alignY, forcePlacement) {
|
|
18
|
+
export function getVerticalPlacement(target, boundariesElement, fitHeight, alignY, forcePlacement, preventOverflow) {
|
|
19
19
|
if (forcePlacement && alignY) {
|
|
20
20
|
return alignY;
|
|
21
21
|
}
|
|
@@ -37,7 +37,13 @@ export function getVerticalPlacement(target, boundariesElement, fitHeight, align
|
|
|
37
37
|
targetHeight = _target$getBoundingCl.height;
|
|
38
38
|
|
|
39
39
|
var spaceAbove = targetTop - (boundariesTop - boundariesElement.scrollTop);
|
|
40
|
-
var spaceBelow = boundariesTop + boundariesHeight - (targetTop + targetHeight);
|
|
40
|
+
var spaceBelow = boundariesTop + boundariesHeight - (targetTop + targetHeight); // Force vertical placement to bottom if the space above doesn't accomodate the fitHeight
|
|
41
|
+
|
|
42
|
+
if (preventOverflow) {
|
|
43
|
+
if (spaceAbove <= fitHeight) {
|
|
44
|
+
return 'bottom';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
41
47
|
|
|
42
48
|
if (spaceBelow >= fitHeight || spaceBelow >= spaceAbove) {
|
|
43
49
|
return 'bottom';
|
|
@@ -49,8 +55,9 @@ export function getVerticalPlacement(target, boundariesElement, fitHeight, align
|
|
|
49
55
|
* Decides if given fitWidth fits to the left or to the right of the target taking boundaries into account.
|
|
50
56
|
*/
|
|
51
57
|
|
|
52
|
-
export function getHorizontalPlacement(target, boundariesElement, fitWidth, alignX, forcePlacement) {
|
|
53
|
-
|
|
58
|
+
export function getHorizontalPlacement(target, boundariesElement, fitWidth, alignX, forcePlacement, preventOverflow) {
|
|
59
|
+
// force placement unless preventOverflow is enabled
|
|
60
|
+
if (forcePlacement && alignX && !preventOverflow) {
|
|
54
61
|
return alignX;
|
|
55
62
|
}
|
|
56
63
|
|
|
@@ -81,8 +88,8 @@ export function getHorizontalPlacement(target, boundariesElement, fitWidth, alig
|
|
|
81
88
|
|
|
82
89
|
return 'right';
|
|
83
90
|
}
|
|
84
|
-
export function calculatePlacement(target, boundariesElement, fitWidth, fitHeight, alignX, alignY, forcePlacement) {
|
|
85
|
-
return [getVerticalPlacement(target, boundariesElement, fitHeight, alignY, forcePlacement), getHorizontalPlacement(target, boundariesElement, fitWidth, alignX, forcePlacement)];
|
|
91
|
+
export function calculatePlacement(target, boundariesElement, fitWidth, fitHeight, alignX, alignY, forcePlacement, preventOverflow) {
|
|
92
|
+
return [getVerticalPlacement(target, boundariesElement, fitHeight, alignY, forcePlacement, preventOverflow), getHorizontalPlacement(target, boundariesElement, fitWidth, alignX, forcePlacement, preventOverflow)];
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
var calculateHorizontalPlacement = function calculateHorizontalPlacement(_ref) {
|
|
@@ -12,8 +12,8 @@ import { N30, N50 } from '@atlaskit/theme/colors';
|
|
|
12
12
|
import { borderRadius, fontSize } from '@atlaskit/theme/constants';
|
|
13
13
|
import { token } from '@atlaskit/tokens';
|
|
14
14
|
import Tooltip from '@atlaskit/tooltip';
|
|
15
|
+
import { ACTION_SUBJECT_ID } from '../../analytics';
|
|
15
16
|
import { unsupportedContentMessages } from '../../messages/unsupportedContent';
|
|
16
|
-
import { ACTION_SUBJECT_ID } from '../../utils/analytics';
|
|
17
17
|
import { trackUnsupportedContentTooltipDisplayedFor } from '../../utils/track-unsupported-content';
|
|
18
18
|
import { getUnsupportedContent } from '../unsupported-content-helper';
|
|
19
19
|
var blockNodeStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n border: 1px dashed ", ";\n border-radius: ", "px;\n box-sizing: border-box;\n cursor: default;\n display: flex;\n font-size: ", ";\n margin: 10px 0;\n min-height: 24px;\n padding: 10px;\n text-align: center;\n vertical-align: text-bottom;\n min-width: 120px;\n align-items: center;\n justify-content: center;\n"])), token('color.background.disabled', N30), token('color.border.disabled', N50), borderRadius(), relativeFontSizeToBase16(fontSize()));
|
|
@@ -12,8 +12,8 @@ import { N30, N50 } from '@atlaskit/theme/colors';
|
|
|
12
12
|
import { borderRadius, fontSize } from '@atlaskit/theme/constants';
|
|
13
13
|
import { token } from '@atlaskit/tokens';
|
|
14
14
|
import Tooltip from '@atlaskit/tooltip';
|
|
15
|
+
import { ACTION_SUBJECT_ID } from '../../analytics';
|
|
15
16
|
import { unsupportedContentMessages } from '../../messages/unsupportedContent';
|
|
16
|
-
import { ACTION_SUBJECT_ID } from '../../utils/analytics';
|
|
17
17
|
import { trackUnsupportedContentTooltipDisplayedFor } from '../../utils/track-unsupported-content';
|
|
18
18
|
import { getUnsupportedContent } from '../unsupported-content-helper';
|
|
19
19
|
var inlineNodeStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n background: ", ";\n border: 1px dashed ", ";\n border-radius: ", "px;\n box-sizing: border-box;\n cursor: default;\n display: inline-flex;\n font-size: ", ";\n margin: 0 2px;\n min-height: 24px;\n padding: 0 10px;\n vertical-align: middle;\n white-space: nowrap;\n"])), token('color.background.disabled', N30), token('color.border.disabled', N50), borderRadius(), relativeFontSizeToBase16(fontSize()));
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
import { defineMessages } from 'react-intl-next'; // These messages are only to be used when useSomewhatSemanticTextColorNames feature flag is true.
|
|
8
|
+
// They are used only in Jira and are part of work for https://product-fabric.atlassian.net/wiki/spaces/EUXQ/pages/3365994869/EXTERNAL+MAKE+PP+COMMIT-5058+Enable+dark+mode+usage+of+text+colors+in+UGC+and+non+custom+panels+in+Jira
|
|
9
|
+
|
|
10
|
+
export var newLightPalette = defineMessages({
|
|
11
|
+
'#FFFFFF': {
|
|
12
|
+
id: 'fabric.theme.white',
|
|
13
|
+
defaultMessage: 'White',
|
|
14
|
+
description: 'Name of a color'
|
|
15
|
+
},
|
|
16
|
+
'#B3D4FF': {
|
|
17
|
+
id: 'fabric.theme.subtle-blue',
|
|
18
|
+
defaultMessage: 'Subtle blue',
|
|
19
|
+
description: 'Name of a color'
|
|
20
|
+
},
|
|
21
|
+
'#B3F5FF': {
|
|
22
|
+
id: 'fabric.theme.subtle-teal',
|
|
23
|
+
defaultMessage: 'Subtle teal',
|
|
24
|
+
description: 'Name of a color'
|
|
25
|
+
},
|
|
26
|
+
'#ABF5D1': {
|
|
27
|
+
id: 'fabric.theme.subtle-green',
|
|
28
|
+
defaultMessage: 'Subtle green',
|
|
29
|
+
description: 'Name of a color'
|
|
30
|
+
},
|
|
31
|
+
'#FFF0B3': {
|
|
32
|
+
id: 'fabric.theme.subtle-yellow',
|
|
33
|
+
defaultMessage: 'Subtle yellow',
|
|
34
|
+
description: 'Name of a color'
|
|
35
|
+
},
|
|
36
|
+
'#FFBDAD': {
|
|
37
|
+
id: 'fabric.theme.subtle-red',
|
|
38
|
+
defaultMessage: 'Subtle red',
|
|
39
|
+
description: 'Name of a color'
|
|
40
|
+
},
|
|
41
|
+
'#EAE6FF': {
|
|
42
|
+
id: 'fabric.theme.subtle-purple',
|
|
43
|
+
defaultMessage: 'Subtle purple',
|
|
44
|
+
description: 'Name of a color'
|
|
45
|
+
},
|
|
46
|
+
'#97A0AF': {
|
|
47
|
+
id: 'fabric.theme.gray',
|
|
48
|
+
defaultMessage: 'Gray',
|
|
49
|
+
description: 'Name of a color'
|
|
50
|
+
},
|
|
51
|
+
'#4C9AFF': {
|
|
52
|
+
id: 'fabric.theme.blue',
|
|
53
|
+
defaultMessage: 'Blue',
|
|
54
|
+
description: 'Name of a color'
|
|
55
|
+
},
|
|
56
|
+
'#00B8D9': {
|
|
57
|
+
id: 'fabric.theme.teal',
|
|
58
|
+
defaultMessage: 'Teal',
|
|
59
|
+
description: 'Name of a color'
|
|
60
|
+
},
|
|
61
|
+
'#36B37E': {
|
|
62
|
+
id: 'fabric.theme.green',
|
|
63
|
+
defaultMessage: 'Green',
|
|
64
|
+
description: 'Name of a color'
|
|
65
|
+
},
|
|
66
|
+
'#FFC400': {
|
|
67
|
+
id: 'fabric.theme.yellow',
|
|
68
|
+
defaultMessage: 'Yellow',
|
|
69
|
+
description: 'Name of a color'
|
|
70
|
+
},
|
|
71
|
+
'#FF5630': {
|
|
72
|
+
id: 'fabric.theme.red',
|
|
73
|
+
defaultMessage: 'Red',
|
|
74
|
+
description: 'Name of a color'
|
|
75
|
+
},
|
|
76
|
+
'#FF991F': {
|
|
77
|
+
id: 'fabric.theme.bold-orange',
|
|
78
|
+
defaultMessage: 'Bold orange',
|
|
79
|
+
description: 'Name of a color.'
|
|
80
|
+
},
|
|
81
|
+
'#6554C0': {
|
|
82
|
+
id: 'fabric.theme.purple',
|
|
83
|
+
defaultMessage: 'Purple',
|
|
84
|
+
description: 'Name of a color'
|
|
85
|
+
},
|
|
86
|
+
'#0747A6': {
|
|
87
|
+
id: 'fabric.theme.bold-blue',
|
|
88
|
+
defaultMessage: 'Bold blue',
|
|
89
|
+
description: 'Name of a color'
|
|
90
|
+
},
|
|
91
|
+
'#008DA6': {
|
|
92
|
+
id: 'fabric.theme.bold-teal',
|
|
93
|
+
defaultMessage: 'Bold teal',
|
|
94
|
+
description: 'Name of a color'
|
|
95
|
+
},
|
|
96
|
+
'#006644': {
|
|
97
|
+
id: 'fabric.theme.bold-green',
|
|
98
|
+
defaultMessage: 'Bold green',
|
|
99
|
+
description: 'Name of a color'
|
|
100
|
+
},
|
|
101
|
+
'#BF2600': {
|
|
102
|
+
id: 'fabric.theme.bold-red',
|
|
103
|
+
defaultMessage: 'Bold red',
|
|
104
|
+
description: 'Name of a color'
|
|
105
|
+
},
|
|
106
|
+
'#403294': {
|
|
107
|
+
id: 'fabric.theme.bold-purple',
|
|
108
|
+
defaultMessage: 'Bold purple',
|
|
109
|
+
description: 'Name of a color'
|
|
110
|
+
},
|
|
111
|
+
'#172B4D': {
|
|
112
|
+
id: 'fabric.theme.default',
|
|
113
|
+
defaultMessage: 'Default',
|
|
114
|
+
description: 'Name of a color'
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
var darkModeWhite = defineMessages({
|
|
118
|
+
'#FFFFFF': {
|
|
119
|
+
id: 'fabric.theme.dark-gray',
|
|
120
|
+
defaultMessage: 'Dark gray',
|
|
121
|
+
description: 'Name of a color'
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
export var newDarkPalette = _objectSpread(_objectSpread({}, newLightPalette), darkModeWhite);
|
|
@@ -4,8 +4,10 @@ import { jsx } from '@emotion/react';
|
|
|
4
4
|
import chromatism from 'chromatism';
|
|
5
5
|
import { injectIntl } from 'react-intl-next';
|
|
6
6
|
import { N0, N500 } from '@atlaskit/theme/colors';
|
|
7
|
-
import { token } from '@atlaskit/tokens';
|
|
7
|
+
import { token, useThemeObserver } from '@atlaskit/tokens';
|
|
8
8
|
import Color from './Color';
|
|
9
|
+
import getColorMessage from './Palettes/getColorMessage';
|
|
10
|
+
import { newDarkPalette, newLightPalette } from './Palettes/paletteMessagesTokenModeNames';
|
|
9
11
|
import { colorPaletteWrapper } from './styles';
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -41,7 +43,10 @@ var ColorPalette = function ColorPalette(props) {
|
|
|
41
43
|
className = props.className,
|
|
42
44
|
formatMessage = props.intl.formatMessage,
|
|
43
45
|
_props$textPalette = props.textPalette,
|
|
44
|
-
textPalette = _props$textPalette === void 0 ? false : _props$textPalette
|
|
46
|
+
textPalette = _props$textPalette === void 0 ? false : _props$textPalette,
|
|
47
|
+
_props$useSomewhatSem = props.useSomewhatSemanticTextColorNames,
|
|
48
|
+
useSomewhatSemanticTextColorNames = _props$useSomewhatSem === void 0 ? false : _props$useSomewhatSem;
|
|
49
|
+
var tokenTheme = useThemeObserver();
|
|
45
50
|
var colorsPerRow = React.useMemo(function () {
|
|
46
51
|
return palette.reduce(function (resultArray, item, index) {
|
|
47
52
|
var chunkIndex = Math.floor(index / cols);
|
|
@@ -62,6 +67,17 @@ var ColorPalette = function ColorPalette(props) {
|
|
|
62
67
|
label = _ref.label,
|
|
63
68
|
border = _ref.border,
|
|
64
69
|
message = _ref.message;
|
|
70
|
+
|
|
71
|
+
if (textPalette === true && useSomewhatSemanticTextColorNames) {
|
|
72
|
+
if (tokenTheme === 'dark') {
|
|
73
|
+
message = getColorMessage(newDarkPalette, value.toUpperCase());
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (tokenTheme === 'light') {
|
|
77
|
+
message = getColorMessage(newLightPalette, value.toUpperCase());
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
65
81
|
return jsx(Color, {
|
|
66
82
|
key: value,
|
|
67
83
|
value: value,
|
|
@@ -243,6 +243,7 @@ function DropdownMenuItem(_ref) {
|
|
|
243
243
|
}, jsx(CustomItem, {
|
|
244
244
|
item: item,
|
|
245
245
|
key: (_item$key2 = item.key) !== null && _item$key2 !== void 0 ? _item$key2 : String(item.content),
|
|
246
|
+
testId: "dropdown-item__".concat(String(item.content)),
|
|
246
247
|
role: shouldUseDefaultRole ? 'button' : 'menuitem',
|
|
247
248
|
iconBefore: item.elemBefore,
|
|
248
249
|
iconAfter: item.elemAfter,
|
|
@@ -254,6 +255,7 @@ function DropdownMenuItem(_ref) {
|
|
|
254
255
|
},
|
|
255
256
|
"aria-label": item['aria-label'] || String(item.content),
|
|
256
257
|
"aria-pressed": shouldUseDefaultRole ? item.isActive : undefined,
|
|
258
|
+
"aria-keyshortcuts": item['aria-keyshortcuts'],
|
|
257
259
|
onMouseDown: function onMouseDown(e) {
|
|
258
260
|
e.preventDefault();
|
|
259
261
|
},
|
|
@@ -38,6 +38,7 @@ var ToolbarButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
38
38
|
ariaHasPopup = props['aria-haspopup'],
|
|
39
39
|
ariaExpanded = props['aria-expanded'],
|
|
40
40
|
ariaPressed = props['aria-pressed'],
|
|
41
|
+
ariaKeyShortcuts = props['aria-keyshortcuts'],
|
|
41
42
|
onClick = props.onClick,
|
|
42
43
|
onItemClick = props.onItemClick;
|
|
43
44
|
var handleClick = useCallback(function (event, analyticsEvent) {
|
|
@@ -83,7 +84,8 @@ var ToolbarButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
83
84
|
"aria-expanded": ariaExpanded,
|
|
84
85
|
"aria-haspopup": ariaHasPopup,
|
|
85
86
|
"aria-label": ariaLabel,
|
|
86
|
-
"aria-pressed": ariaPressed
|
|
87
|
+
"aria-pressed": ariaPressed,
|
|
88
|
+
"aria-keyshortcuts": ariaKeyShortcuts
|
|
87
89
|
}, children);
|
|
88
90
|
|
|
89
91
|
if (!title) {
|