@atlaskit/editor-common 71.0.3 → 72.0.1
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 +78 -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 +56 -6
- package/dist/cjs/styles/index.js +8 -2
- package/dist/cjs/styles/shared/annotation.js +9 -14
- package/dist/cjs/styles/shared/block-marks.js +1 -1
- package/dist/cjs/styles/shared/blockquote.js +1 -3
- package/dist/cjs/styles/shared/code-block.js +13 -16
- package/dist/cjs/styles/shared/code-mark.js +2 -4
- package/dist/cjs/styles/shared/lists.js +55 -4
- package/dist/cjs/styles/shared/panel.js +29 -39
- package/dist/cjs/styles/shared/rule.js +2 -4
- package/dist/cjs/styles/shared/shadow.js +1 -1
- package/dist/cjs/styles/shared/table.js +24 -26
- package/dist/cjs/types/next-editor-plugin.js +5 -0
- package/dist/cjs/ui/Caption/index.js +2 -4
- package/dist/cjs/ui/DropList/index.js +5 -7
- package/dist/cjs/ui/Emoji/index.js +11 -2
- package/dist/cjs/ui/Expand/index.js +17 -19
- package/dist/cjs/ui/Messages/index.js +3 -5
- 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 +3 -5
- package/dist/cjs/ui/UnsupportedInline/index.js +3 -5
- package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +138 -0
- package/dist/cjs/ui-color/ColorPalette/index.js +20 -2
- package/dist/cjs/ui-menu/DropdownMenu/index.js +12 -12
- 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 +48 -2
- package/dist/es2019/styles/index.js +1 -1
- package/dist/es2019/styles/shared/annotation.js +9 -13
- package/dist/es2019/styles/shared/block-marks.js +8 -1
- package/dist/es2019/styles/shared/blockquote.js +1 -2
- package/dist/es2019/styles/shared/code-block.js +18 -18
- package/dist/es2019/styles/shared/code-mark.js +2 -3
- package/dist/es2019/styles/shared/lists.js +44 -2
- package/dist/es2019/styles/shared/panel.js +29 -37
- package/dist/es2019/styles/shared/rule.js +2 -3
- package/dist/es2019/styles/shared/shadow.js +20 -6
- package/dist/es2019/styles/shared/table.js +24 -26
- package/dist/es2019/types/next-editor-plugin.js +1 -0
- package/dist/es2019/ui/Caption/index.js +2 -3
- package/dist/es2019/ui/DropList/index.js +5 -6
- package/dist/es2019/ui/Emoji/index.js +11 -2
- package/dist/es2019/ui/Expand/index.js +17 -18
- package/dist/es2019/ui/Messages/index.js +3 -4
- 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 +3 -4
- package/dist/es2019/ui/UnsupportedInline/index.js +3 -4
- package/dist/es2019/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +120 -0
- package/dist/es2019/ui-color/ColorPalette/index.js +29 -13
- package/dist/es2019/ui-menu/DropdownMenu/index.js +13 -12
- 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 +49 -2
- package/dist/esm/styles/index.js +1 -1
- package/dist/esm/styles/shared/annotation.js +9 -13
- package/dist/esm/styles/shared/block-marks.js +1 -1
- package/dist/esm/styles/shared/blockquote.js +1 -2
- package/dist/esm/styles/shared/code-block.js +13 -15
- package/dist/esm/styles/shared/code-mark.js +2 -3
- package/dist/esm/styles/shared/lists.js +49 -2
- package/dist/esm/styles/shared/panel.js +29 -37
- package/dist/esm/styles/shared/rule.js +2 -3
- package/dist/esm/styles/shared/shadow.js +1 -2
- package/dist/esm/styles/shared/table.js +24 -26
- package/dist/esm/types/next-editor-plugin.js +1 -0
- package/dist/esm/ui/Caption/index.js +2 -3
- package/dist/esm/ui/DropList/index.js +5 -6
- package/dist/esm/ui/Emoji/index.js +11 -2
- package/dist/esm/ui/Expand/index.js +17 -18
- package/dist/esm/ui/Messages/index.js +3 -4
- 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 +2 -3
- package/dist/esm/ui/UnsupportedInline/index.js +2 -3
- package/dist/esm/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +124 -0
- package/dist/esm/ui-color/ColorPalette/index.js +19 -3
- package/dist/esm/ui-menu/DropdownMenu/index.js +12 -11
- 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,12 +1,10 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
|
-
// TODO: https://product-fabric.atlassian.net/browse/DSP-4118
|
|
3
2
|
import { css } from '@emotion/react';
|
|
4
3
|
import { tableCellContentDomSelector, tableCellSelector, tableHeaderSelector, tablePrefixSelector } from '@atlaskit/adf-schema';
|
|
5
4
|
import { akEditorBreakoutPadding, akEditorFullWidthLayoutWidth, akEditorSelectedNodeClassName, akEditorTableBorder, akEditorTableBorderDark, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarDark, akEditorWideLayoutWidth, getTableCellBackgroundDarkModeColors, overflowShadow } from '@atlaskit/editor-shared-styles';
|
|
6
5
|
import { DN20 } from '@atlaskit/theme/colors';
|
|
7
6
|
import { themed } from '@atlaskit/theme/components';
|
|
8
7
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
9
|
-
import { token } from '@atlaskit/tokens';
|
|
10
8
|
import browser from '../../utils/browser';
|
|
11
9
|
import { CodeBlockSharedCssClassName } from './code-block';
|
|
12
10
|
export const tableMarginTop = 24;
|
|
@@ -66,8 +64,8 @@ const tableSharedStyle = props => css`
|
|
|
66
64
|
border-collapse: collapse;
|
|
67
65
|
border: ${tableCellBorderWidth}px solid
|
|
68
66
|
${themed({
|
|
69
|
-
light:
|
|
70
|
-
dark:
|
|
67
|
+
light: `var(--ds-border, ${akEditorTableBorder})`,
|
|
68
|
+
dark: `var(--ds-border, ${akEditorTableBorderDark})`
|
|
71
69
|
})(props)};
|
|
72
70
|
table-layout: fixed;
|
|
73
71
|
font-size: 1em;
|
|
@@ -89,7 +87,7 @@ const tableSharedStyle = props => css`
|
|
|
89
87
|
border-bottom: none;
|
|
90
88
|
}
|
|
91
89
|
th td {
|
|
92
|
-
background-color: ${
|
|
90
|
+
background-color: ${"var(--ds-background-neutral-subtle, white)"};
|
|
93
91
|
}
|
|
94
92
|
th,
|
|
95
93
|
td {
|
|
@@ -98,8 +96,8 @@ const tableSharedStyle = props => css`
|
|
|
98
96
|
vertical-align: top;
|
|
99
97
|
border: 1px solid
|
|
100
98
|
${themed({
|
|
101
|
-
light:
|
|
102
|
-
dark:
|
|
99
|
+
light: `var(--ds-border, ${akEditorTableBorder})`,
|
|
100
|
+
dark: `var(--ds-border, ${akEditorTableBorderDark})`
|
|
103
101
|
})(props)};
|
|
104
102
|
border-right-width: 0;
|
|
105
103
|
border-bottom-width: 0;
|
|
@@ -133,8 +131,8 @@ const tableSharedStyle = props => css`
|
|
|
133
131
|
}
|
|
134
132
|
th {
|
|
135
133
|
background-color: ${themed({
|
|
136
|
-
light:
|
|
137
|
-
dark:
|
|
134
|
+
light: `var(--ds-background-neutral, ${akEditorTableToolbar})`,
|
|
135
|
+
dark: `var(--ds-background-neutral, ${akEditorTableToolbarDark})`
|
|
138
136
|
})(props)};
|
|
139
137
|
text-align: left;
|
|
140
138
|
|
|
@@ -143,34 +141,34 @@ const tableSharedStyle = props => css`
|
|
|
143
141
|
&:not([style]):not(.danger) {
|
|
144
142
|
.${CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER}:not(.danger) {
|
|
145
143
|
background-color: ${themed({
|
|
146
|
-
light:
|
|
147
|
-
dark:
|
|
144
|
+
light: "var(--ds-surface-raised, rgb(235, 237, 240))",
|
|
145
|
+
dark: "var(--ds-surface-raised, rgb(36, 47, 66))"
|
|
148
146
|
})(props)};
|
|
149
147
|
|
|
150
148
|
:not(.${akEditorSelectedNodeClassName}) {
|
|
151
149
|
box-shadow: 0px 0px 0px 1px
|
|
152
|
-
${
|
|
150
|
+
${"var(--ds-border, transparent)"};
|
|
153
151
|
}
|
|
154
152
|
|
|
155
153
|
.${CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER} {
|
|
156
154
|
background-image: ${overflowShadow({
|
|
157
155
|
background: themed({
|
|
158
|
-
light:
|
|
159
|
-
dark:
|
|
156
|
+
light: "var(--ds-background-neutral, rgb(235, 237, 240))",
|
|
157
|
+
dark: "var(--ds-background-neutral, rgb(36, 47, 66))"
|
|
160
158
|
})(props),
|
|
161
|
-
|
|
159
|
+
leftCoverWidth: `${gridSize() * 3}px`
|
|
162
160
|
})};
|
|
163
161
|
|
|
164
162
|
background-color: ${themed({
|
|
165
|
-
light:
|
|
166
|
-
dark:
|
|
163
|
+
light: "var(--ds-background-neutral, rgb(235, 237, 240))",
|
|
164
|
+
dark: "var(--ds-background-neutral, rgb(36, 47, 66))"
|
|
167
165
|
})(props)};
|
|
168
166
|
}
|
|
169
167
|
|
|
170
168
|
.${CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER} {
|
|
171
169
|
background-color: ${themed({
|
|
172
|
-
light:
|
|
173
|
-
dark:
|
|
170
|
+
light: "var(--ds-background-neutral, rgb(226, 229, 233))",
|
|
171
|
+
dark: `var(--ds-background-neutral, ${DN20})`
|
|
174
172
|
})(props)};
|
|
175
173
|
}
|
|
176
174
|
|
|
@@ -178,21 +176,21 @@ const tableSharedStyle = props => css`
|
|
|
178
176
|
> [data-ds--code--code-block] {
|
|
179
177
|
background-image: ${overflowShadow({
|
|
180
178
|
background: themed({
|
|
181
|
-
light:
|
|
182
|
-
dark:
|
|
179
|
+
light: "var(--ds-background-neutral, rgb(235, 237, 240))",
|
|
180
|
+
dark: "var(--ds-background-neutral, rgb(36, 47, 66))"
|
|
183
181
|
})(props),
|
|
184
|
-
|
|
182
|
+
leftCoverWidth: `${gridSize() * 3}px`
|
|
185
183
|
})}!important;
|
|
186
184
|
|
|
187
185
|
background-color: ${themed({
|
|
188
|
-
light:
|
|
189
|
-
dark:
|
|
186
|
+
light: "var(--ds-background-neutral, rgb(235, 237, 240))",
|
|
187
|
+
dark: "var(--ds-background-neutral, rgb(36, 47, 66))"
|
|
190
188
|
})(props)}!important;
|
|
191
189
|
|
|
192
190
|
// selector lives inside @atlaskit/code
|
|
193
191
|
--ds--code--line-number-bg-color: ${themed({
|
|
194
|
-
light:
|
|
195
|
-
dark:
|
|
192
|
+
light: "var(--ds-background-neutral, rgb(226, 229, 233))",
|
|
193
|
+
dark: `var(--ds-background-neutral, ${DN20})`
|
|
196
194
|
})(props)};
|
|
197
195
|
}
|
|
198
196
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,16 +5,15 @@ import React from 'react';
|
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { injectIntl } from 'react-intl-next';
|
|
7
7
|
import { N200, N400 } from '@atlaskit/theme/colors';
|
|
8
|
-
import { token } from '@atlaskit/tokens';
|
|
9
8
|
import { messages } from './messages';
|
|
10
9
|
const captionWrapperStyle = css`
|
|
11
10
|
margin-top: 8px;
|
|
12
11
|
text-align: center;
|
|
13
12
|
position: relative;
|
|
14
|
-
color: ${
|
|
13
|
+
color: ${`var(--ds-text-subtle, ${N400})`};
|
|
15
14
|
`;
|
|
16
15
|
const placeholderStyle = css`
|
|
17
|
-
color: ${
|
|
16
|
+
color: ${`var(--ds-text-subtlest, ${N200})`};
|
|
18
17
|
position: absolute;
|
|
19
18
|
top: 0;
|
|
20
19
|
width: 100%;
|
|
@@ -7,10 +7,9 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
7
7
|
import { DN50, DN600, N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
8
8
|
import { themed } from '@atlaskit/theme/components';
|
|
9
9
|
import { borderRadius, gridSize } from '@atlaskit/theme/constants';
|
|
10
|
-
import { token } from '@atlaskit/tokens';
|
|
11
10
|
import Layer from '../Layer';
|
|
12
11
|
const packageName = "@atlaskit/editor-common";
|
|
13
|
-
const packageVersion = "
|
|
12
|
+
const packageVersion = "72.0.1";
|
|
14
13
|
const halfFocusRing = 1;
|
|
15
14
|
const dropOffset = `0, ${gridSize()}px`;
|
|
16
15
|
|
|
@@ -33,12 +32,12 @@ class DropList extends Component {
|
|
|
33
32
|
_defineProperty(this, "menuWrapper", theme => {
|
|
34
33
|
return css`
|
|
35
34
|
color: ${themed({
|
|
36
|
-
light:
|
|
37
|
-
dark:
|
|
35
|
+
light: `var(--ds-text, ${N900})`,
|
|
36
|
+
dark: `var(--ds-text, ${DN600})`
|
|
38
37
|
})(theme)};
|
|
39
38
|
background-color: ${themed({
|
|
40
|
-
light:
|
|
41
|
-
dark:
|
|
39
|
+
light: `var(--ds-surface-overlay, ${N0})`,
|
|
40
|
+
dark: `var(--ds-surface-overlay, ${DN50})`
|
|
42
41
|
})(theme)};
|
|
43
42
|
border-radius: ${borderRadius()}px;
|
|
44
43
|
box-shadow: 0 ${gridSize() / 2}px ${gridSize()}px -${gridSize() / 4}px ${N50A},
|
|
@@ -7,13 +7,16 @@ export default class EmojiNode extends PureComponent {
|
|
|
7
7
|
super(props);
|
|
8
8
|
|
|
9
9
|
_defineProperty(this, "renderWithProvider", providers => {
|
|
10
|
+
var _resourceConfig$optim;
|
|
11
|
+
|
|
10
12
|
const {
|
|
11
13
|
allowTextFallback,
|
|
12
14
|
shortName,
|
|
13
15
|
id,
|
|
14
16
|
fallback,
|
|
15
17
|
fitToHeight,
|
|
16
|
-
showTooltip
|
|
18
|
+
showTooltip,
|
|
19
|
+
resourceConfig
|
|
17
20
|
} = this.props;
|
|
18
21
|
|
|
19
22
|
if (allowTextFallback && !providers.emojiProvider) {
|
|
@@ -36,7 +39,13 @@ export default class EmojiNode extends PureComponent {
|
|
|
36
39
|
},
|
|
37
40
|
emojiProvider: providers.emojiProvider,
|
|
38
41
|
showTooltip: showTooltip,
|
|
39
|
-
fitToHeight: fitToHeight
|
|
42
|
+
fitToHeight: fitToHeight,
|
|
43
|
+
optimistic: true,
|
|
44
|
+
optimisticImageURL: resourceConfig === null || resourceConfig === void 0 ? void 0 : (_resourceConfig$optim = resourceConfig.optimisticImageApi) === null || _resourceConfig$optim === void 0 ? void 0 : _resourceConfig$optim.getUrl({
|
|
45
|
+
id,
|
|
46
|
+
fallback,
|
|
47
|
+
shortName
|
|
48
|
+
})
|
|
40
49
|
});
|
|
41
50
|
});
|
|
42
51
|
|
|
@@ -8,7 +8,6 @@ import { akEditorLineHeight, akEditorSwoopCubicBezier, akLayoutGutterOffset, rel
|
|
|
8
8
|
import * as colors from '@atlaskit/theme/colors';
|
|
9
9
|
import { themed } from '@atlaskit/theme/components';
|
|
10
10
|
import { fontSize, gridSize } from '@atlaskit/theme/constants';
|
|
11
|
-
import { token } from '@atlaskit/tokens';
|
|
12
11
|
export const messages = defineMessages({
|
|
13
12
|
collapseNode: {
|
|
14
13
|
id: 'fabric.editor.collapseNode',
|
|
@@ -32,16 +31,16 @@ export const messages = defineMessages({
|
|
|
32
31
|
}
|
|
33
32
|
});
|
|
34
33
|
const BORDER_RADIUS = gridSize() / 2;
|
|
35
|
-
const EXPAND_COLLAPSED_BACKGROUND =
|
|
34
|
+
const EXPAND_COLLAPSED_BACKGROUND = "var(--ds-background-neutral-subtle, transparent)";
|
|
36
35
|
const EXPAND_SELECTED_BACKGROUND = themed({
|
|
37
|
-
light:
|
|
38
|
-
dark:
|
|
36
|
+
light: "var(--ds-surface, rgba(255, 255, 255, 0.6))",
|
|
37
|
+
dark: "var(--ds-surface, rgba(9, 10, 11, 0.29))"
|
|
39
38
|
});
|
|
40
|
-
const EXPAND_FOCUSED_BORDER_COLOR =
|
|
39
|
+
const EXPAND_FOCUSED_BORDER_COLOR = `var(--ds-border-focused, ${colors.B300})`;
|
|
41
40
|
const EXPAND_COLLAPSED_BORDER_COLOR = 'transparent';
|
|
42
41
|
const EXPAND_EXPANDED_BORDER_COLOR = themed({
|
|
43
|
-
light:
|
|
44
|
-
dark:
|
|
42
|
+
light: `var(--ds-border, ${colors.N40A})`,
|
|
43
|
+
dark: `var(--ds-border, ${colors.DN50})`
|
|
45
44
|
});
|
|
46
45
|
export const ExpandIconWrapper = ({
|
|
47
46
|
children,
|
|
@@ -56,15 +55,15 @@ const expandIconWrapperStyle = props => css`
|
|
|
56
55
|
cursor: pointer;
|
|
57
56
|
display: flex;
|
|
58
57
|
color: ${themed({
|
|
59
|
-
light:
|
|
60
|
-
dark:
|
|
58
|
+
light: `var(--ds-icon, ${colors.N90})`,
|
|
59
|
+
dark: "var(--ds-icon, #d9dde3)"
|
|
61
60
|
})(props)};
|
|
62
61
|
border-radius: ${gridSize() / 2}px;
|
|
63
62
|
width: 24px;
|
|
64
63
|
height: 24px;
|
|
65
64
|
|
|
66
65
|
&:hover {
|
|
67
|
-
background: ${
|
|
66
|
+
background: ${`var(--ds-background-neutral-subtle-hovered, ${colors.N30A})`};
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
svg {
|
|
@@ -123,8 +122,8 @@ const containerStyles = styleProps => {
|
|
|
123
122
|
// https://product-fabric.atlassian.net/browse/DSP-4152
|
|
124
123
|
border: 1px solid
|
|
125
124
|
${themed({
|
|
126
|
-
light:
|
|
127
|
-
dark:
|
|
125
|
+
light: `var(--ds-border, ${colors.N50A})`,
|
|
126
|
+
dark: `var(--ds-border, ${colors.DN50})`
|
|
128
127
|
})(themeProps)};
|
|
129
128
|
background: ${EXPAND_SELECTED_BACKGROUND(themeProps)};
|
|
130
129
|
}
|
|
@@ -171,8 +170,8 @@ const titleInputStyles = props => css`
|
|
|
171
170
|
line-height: ${akEditorLineHeight};
|
|
172
171
|
font-weight: normal;
|
|
173
172
|
color: ${themed({
|
|
174
|
-
light:
|
|
175
|
-
dark:
|
|
173
|
+
light: `var(--ds-text-subtlest, ${colors.N200A})`,
|
|
174
|
+
dark: `var(--ds-text-subtlest, ${colors.DN600})`
|
|
176
175
|
})(props)};
|
|
177
176
|
background: transparent;
|
|
178
177
|
display: flex;
|
|
@@ -183,8 +182,8 @@ const titleInputStyles = props => css`
|
|
|
183
182
|
&::placeholder {
|
|
184
183
|
opacity: 0.6;
|
|
185
184
|
color: ${themed({
|
|
186
|
-
light:
|
|
187
|
-
dark:
|
|
185
|
+
light: `var(--ds-text-subtlest, ${colors.N200A})`,
|
|
186
|
+
dark: `var(--ds-text-subtlest, ${colors.DN600})`
|
|
188
187
|
})(props)};
|
|
189
188
|
}
|
|
190
189
|
`;
|
|
@@ -198,8 +197,8 @@ const titleContainerStyles = props => css`
|
|
|
198
197
|
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
199
198
|
width: 100%;
|
|
200
199
|
color: ${themed({
|
|
201
|
-
light:
|
|
202
|
-
dark:
|
|
200
|
+
light: `var(--ds-text-subtle, ${colors.N300A})`,
|
|
201
|
+
dark: `var(--ds-text-subtle, ${colors.DN600})`
|
|
203
202
|
})(props)};
|
|
204
203
|
overflow: hidden;
|
|
205
204
|
cursor: pointer;
|
|
@@ -5,17 +5,16 @@ import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
|
5
5
|
import { G400, N200, R400 } from '@atlaskit/theme/colors';
|
|
6
6
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
7
7
|
import { h200 } from '@atlaskit/theme/typography';
|
|
8
|
-
import { token } from '@atlaskit/tokens';
|
|
9
8
|
const errorColor = css`
|
|
10
|
-
color: ${
|
|
9
|
+
color: ${`var(--ds-text-danger, ${R400})`};
|
|
11
10
|
`;
|
|
12
11
|
const validColor = css`
|
|
13
|
-
color: ${
|
|
12
|
+
color: ${`var(--ds-text-success, ${G400})`};
|
|
14
13
|
`;
|
|
15
14
|
|
|
16
15
|
const messageStyle = props => css`
|
|
17
16
|
${h200(props)} font-weight: normal;
|
|
18
|
-
color: ${
|
|
17
|
+
color: ${`var(--ds-text-subtlest, ${N200})`};
|
|
19
18
|
margin-top: ${gridSize() / 2}px;
|
|
20
19
|
display: flex;
|
|
21
20
|
justify-content: baseline;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import createFocusTrap from 'focus-trap';
|
|
3
4
|
import rafSchedule from 'raf-schd';
|
|
4
5
|
import { createPortal } from 'react-dom';
|
|
5
6
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -16,6 +17,8 @@ export default class Popup extends React.Component {
|
|
|
16
17
|
validPosition: true
|
|
17
18
|
});
|
|
18
19
|
|
|
20
|
+
_defineProperty(this, "popupRef", /*#__PURE__*/React.createRef());
|
|
21
|
+
|
|
19
22
|
_defineProperty(this, "placement", ['', '']);
|
|
20
23
|
|
|
21
24
|
_defineProperty(this, "handleRef", popup => {
|
|
@@ -35,6 +38,24 @@ export default class Popup extends React.Component {
|
|
|
35
38
|
_defineProperty(this, "resizeObserver", (_window = window) !== null && _window !== void 0 && _window.ResizeObserver ? new ResizeObserver(() => {
|
|
36
39
|
this.scheduledUpdatePosition(this.props);
|
|
37
40
|
}) : undefined);
|
|
41
|
+
|
|
42
|
+
_defineProperty(this, "initFocusTrap", rafSchedule(() => {
|
|
43
|
+
const popup = this.popupRef.current;
|
|
44
|
+
|
|
45
|
+
if (!popup) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const trapConfig = {
|
|
50
|
+
clickOutsideDeactivates: true,
|
|
51
|
+
escapeDeactivates: true,
|
|
52
|
+
initialFocus: popup,
|
|
53
|
+
fallbackFocus: popup,
|
|
54
|
+
returnFocusOnDeactivate: false
|
|
55
|
+
};
|
|
56
|
+
this.focusTrap = createFocusTrap(popup, trapConfig);
|
|
57
|
+
this.focusTrap.activate();
|
|
58
|
+
}));
|
|
38
59
|
}
|
|
39
60
|
|
|
40
61
|
/**
|
|
@@ -54,14 +75,15 @@ export default class Popup extends React.Component {
|
|
|
54
75
|
stick,
|
|
55
76
|
forcePlacement,
|
|
56
77
|
allowOutOfBounds,
|
|
57
|
-
rect
|
|
78
|
+
rect,
|
|
79
|
+
preventOverflow
|
|
58
80
|
} = props;
|
|
59
81
|
|
|
60
82
|
if (!target || !popup) {
|
|
61
83
|
return {};
|
|
62
84
|
}
|
|
63
85
|
|
|
64
|
-
const placement = calculatePlacement(target, boundariesElement || document.body, fitWidth, fitHeight, alignX, alignY, forcePlacement);
|
|
86
|
+
const placement = calculatePlacement(target, boundariesElement || document.body, fitWidth, fitHeight, alignX, alignY, forcePlacement, preventOverflow);
|
|
65
87
|
|
|
66
88
|
if (onPlacementChanged && this.placement.join('') !== placement.join('')) {
|
|
67
89
|
onPlacementChanged(placement);
|
|
@@ -119,6 +141,7 @@ export default class Popup extends React.Component {
|
|
|
119
141
|
|
|
120
142
|
|
|
121
143
|
initPopup(popup) {
|
|
144
|
+
this.popupRef.current = popup;
|
|
122
145
|
const {
|
|
123
146
|
target
|
|
124
147
|
} = this.props;
|
|
@@ -144,6 +167,10 @@ export default class Popup extends React.Component {
|
|
|
144
167
|
*/
|
|
145
168
|
|
|
146
169
|
this.scheduledUpdatePosition(this.props);
|
|
170
|
+
|
|
171
|
+
if (this.props.focusTrap) {
|
|
172
|
+
this.initFocusTrap();
|
|
173
|
+
}
|
|
147
174
|
}
|
|
148
175
|
|
|
149
176
|
UNSAFE_componentWillReceiveProps(newProps) {
|
|
@@ -152,6 +179,44 @@ export default class Popup extends React.Component {
|
|
|
152
179
|
this.scheduledUpdatePosition(newProps);
|
|
153
180
|
}
|
|
154
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Cancels the initialisation of the focus trap if it has not yet occured
|
|
184
|
+
* Deactivates the focus trap if it exists
|
|
185
|
+
*/
|
|
186
|
+
destroyFocusTrap() {
|
|
187
|
+
var _this$focusTrap;
|
|
188
|
+
|
|
189
|
+
this.initFocusTrap.cancel();
|
|
190
|
+
(_this$focusTrap = this.focusTrap) === null || _this$focusTrap === void 0 ? void 0 : _this$focusTrap.deactivate();
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Handle pausing, unpausing, and initialising (if not yet initialised) of the focus trap
|
|
194
|
+
*/
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
handleChangedFocusTrapProp(prevProps) {
|
|
198
|
+
if (prevProps.focusTrap !== this.props.focusTrap) {
|
|
199
|
+
// If currently set to disable, then pause the trap if it exists
|
|
200
|
+
if (!this.props.focusTrap) {
|
|
201
|
+
var _this$focusTrap2;
|
|
202
|
+
|
|
203
|
+
return (_this$focusTrap2 = this.focusTrap) === null || _this$focusTrap2 === void 0 ? void 0 : _this$focusTrap2.pause();
|
|
204
|
+
} // If set to enabled and trap already exists, unpause
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
if (this.focusTrap) {
|
|
208
|
+
this.focusTrap.unpause();
|
|
209
|
+
} // Else initialise the focus trap
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
return this.initFocusTrap();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
componentDidUpdate(prevProps) {
|
|
217
|
+
this.handleChangedFocusTrapProp(prevProps);
|
|
218
|
+
}
|
|
219
|
+
|
|
155
220
|
componentDidMount() {
|
|
156
221
|
window.addEventListener('resize', this.onResize);
|
|
157
222
|
const {
|
|
@@ -186,6 +251,7 @@ export default class Popup extends React.Component {
|
|
|
186
251
|
}
|
|
187
252
|
|
|
188
253
|
this.scheduledUpdatePosition.cancel();
|
|
254
|
+
this.destroyFocusTrap();
|
|
189
255
|
}
|
|
190
256
|
|
|
191
257
|
renderPopup() {
|
|
@@ -8,7 +8,7 @@ export function isTextNode(elem) {
|
|
|
8
8
|
* Decides if given fitHeight fits below or above the target taking boundaries into account.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
export function getVerticalPlacement(target, boundariesElement, fitHeight, alignY, forcePlacement) {
|
|
11
|
+
export function getVerticalPlacement(target, boundariesElement, fitHeight, alignY, forcePlacement, preventOverflow) {
|
|
12
12
|
if (forcePlacement && alignY) {
|
|
13
13
|
return alignY;
|
|
14
14
|
}
|
|
@@ -31,7 +31,13 @@ export function getVerticalPlacement(target, boundariesElement, fitHeight, align
|
|
|
31
31
|
height: targetHeight
|
|
32
32
|
} = target.getBoundingClientRect();
|
|
33
33
|
const spaceAbove = targetTop - (boundariesTop - boundariesElement.scrollTop);
|
|
34
|
-
const spaceBelow = boundariesTop + boundariesHeight - (targetTop + targetHeight);
|
|
34
|
+
const spaceBelow = boundariesTop + boundariesHeight - (targetTop + targetHeight); // Force vertical placement to bottom if the space above doesn't accomodate the fitHeight
|
|
35
|
+
|
|
36
|
+
if (preventOverflow) {
|
|
37
|
+
if (spaceAbove <= fitHeight) {
|
|
38
|
+
return 'bottom';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
35
41
|
|
|
36
42
|
if (spaceBelow >= fitHeight || spaceBelow >= spaceAbove) {
|
|
37
43
|
return 'bottom';
|
|
@@ -43,8 +49,9 @@ export function getVerticalPlacement(target, boundariesElement, fitHeight, align
|
|
|
43
49
|
* Decides if given fitWidth fits to the left or to the right of the target taking boundaries into account.
|
|
44
50
|
*/
|
|
45
51
|
|
|
46
|
-
export function getHorizontalPlacement(target, boundariesElement, fitWidth, alignX, forcePlacement) {
|
|
47
|
-
|
|
52
|
+
export function getHorizontalPlacement(target, boundariesElement, fitWidth, alignX, forcePlacement, preventOverflow) {
|
|
53
|
+
// force placement unless preventOverflow is enabled
|
|
54
|
+
if (forcePlacement && alignX && !preventOverflow) {
|
|
48
55
|
return alignX;
|
|
49
56
|
}
|
|
50
57
|
|
|
@@ -75,8 +82,8 @@ export function getHorizontalPlacement(target, boundariesElement, fitWidth, alig
|
|
|
75
82
|
|
|
76
83
|
return 'right';
|
|
77
84
|
}
|
|
78
|
-
export function calculatePlacement(target, boundariesElement, fitWidth, fitHeight, alignX, alignY, forcePlacement) {
|
|
79
|
-
return [getVerticalPlacement(target, boundariesElement, fitHeight, alignY, forcePlacement), getHorizontalPlacement(target, boundariesElement, fitWidth, alignX, forcePlacement)];
|
|
85
|
+
export function calculatePlacement(target, boundariesElement, fitWidth, fitHeight, alignX, alignY, forcePlacement, preventOverflow) {
|
|
86
|
+
return [getVerticalPlacement(target, boundariesElement, fitHeight, alignY, forcePlacement, preventOverflow), getHorizontalPlacement(target, boundariesElement, fitWidth, alignX, forcePlacement, preventOverflow)];
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
const calculateHorizontalPlacement = ({
|
|
@@ -6,15 +6,14 @@ import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
|
6
6
|
import QuestionsIcon from '@atlaskit/icon/glyph/question-circle';
|
|
7
7
|
import { N30, N50 } from '@atlaskit/theme/colors';
|
|
8
8
|
import { borderRadius, fontSize } from '@atlaskit/theme/constants';
|
|
9
|
-
import { token } from '@atlaskit/tokens';
|
|
10
9
|
import Tooltip from '@atlaskit/tooltip';
|
|
10
|
+
import { ACTION_SUBJECT_ID } from '../../analytics';
|
|
11
11
|
import { unsupportedContentMessages } from '../../messages/unsupportedContent';
|
|
12
|
-
import { ACTION_SUBJECT_ID } from '../../utils/analytics';
|
|
13
12
|
import { trackUnsupportedContentTooltipDisplayedFor } from '../../utils/track-unsupported-content';
|
|
14
13
|
import { getUnsupportedContent } from '../unsupported-content-helper';
|
|
15
14
|
const blockNodeStyle = css`
|
|
16
|
-
background: ${
|
|
17
|
-
border: 1px dashed ${
|
|
15
|
+
background: ${`var(--ds-background-disabled, ${N30})`};
|
|
16
|
+
border: 1px dashed ${`var(--ds-border-disabled, ${N50})`};
|
|
18
17
|
border-radius: ${borderRadius()}px;
|
|
19
18
|
box-sizing: border-box;
|
|
20
19
|
cursor: default;
|
|
@@ -6,16 +6,15 @@ import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
|
6
6
|
import QuestionsIcon from '@atlaskit/icon/glyph/question-circle';
|
|
7
7
|
import { N30, N50 } from '@atlaskit/theme/colors';
|
|
8
8
|
import { borderRadius, fontSize } from '@atlaskit/theme/constants';
|
|
9
|
-
import { token } from '@atlaskit/tokens';
|
|
10
9
|
import Tooltip from '@atlaskit/tooltip';
|
|
10
|
+
import { ACTION_SUBJECT_ID } from '../../analytics';
|
|
11
11
|
import { unsupportedContentMessages } from '../../messages/unsupportedContent';
|
|
12
|
-
import { ACTION_SUBJECT_ID } from '../../utils/analytics';
|
|
13
12
|
import { trackUnsupportedContentTooltipDisplayedFor } from '../../utils/track-unsupported-content';
|
|
14
13
|
import { getUnsupportedContent } from '../unsupported-content-helper';
|
|
15
14
|
const inlineNodeStyle = css`
|
|
16
15
|
align-items: center;
|
|
17
|
-
background: ${
|
|
18
|
-
border: 1px dashed ${
|
|
16
|
+
background: ${`var(--ds-background-disabled, ${N30})`};
|
|
17
|
+
border: 1px dashed ${`var(--ds-border-disabled, ${N50})`};
|
|
19
18
|
border-radius: ${borderRadius()}px;
|
|
20
19
|
box-sizing: border-box;
|
|
21
20
|
cursor: default;
|