@atlaskit/editor-common 76.27.9 → 76.27.10
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 +8 -0
- package/dist/cjs/media-inline/constants.js +21 -2
- package/dist/cjs/media-inline/inline-image-wrapper.js +4 -2
- package/dist/cjs/media-inline/media-inline-image-card.js +3 -3
- package/dist/cjs/media-inline/styles.js +11 -3
- package/dist/cjs/media-inline/views/icon-wrapper.js +1 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/styles/shared/annotation.js +5 -22
- package/dist/cjs/styles/shared/code-block.js +4 -20
- package/dist/cjs/styles/shared/code-mark.js +2 -6
- package/dist/cjs/styles/shared/panel.js +9 -62
- package/dist/cjs/styles/shared/rule.js +2 -8
- package/dist/cjs/ui/BaseTheme/index.js +8 -15
- package/dist/cjs/ui/DropList/index.js +4 -17
- package/dist/cjs/ui/Expand/index.js +13 -38
- package/dist/cjs/ui/Messages/index.js +6 -6
- package/dist/cjs/ui/PortalProvider/index.js +7 -21
- package/dist/cjs/ui-menu/ColorPickerButton/index.js +5 -13
- package/dist/cjs/ui-menu/DropdownMenu/index.js +10 -27
- package/dist/es2019/media-inline/constants.js +20 -1
- package/dist/es2019/media-inline/inline-image-wrapper.js +4 -2
- package/dist/es2019/media-inline/media-inline-image-card.js +3 -3
- package/dist/es2019/media-inline/styles.js +24 -9
- package/dist/es2019/media-inline/views/icon-wrapper.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/styles/shared/annotation.js +9 -28
- package/dist/es2019/styles/shared/code-block.js +11 -27
- package/dist/es2019/styles/shared/code-mark.js +3 -7
- package/dist/es2019/styles/shared/panel.js +24 -83
- package/dist/es2019/styles/shared/rule.js +3 -9
- package/dist/es2019/ui/BaseTheme/index.js +3 -11
- package/dist/es2019/ui/DropList/index.js +7 -17
- package/dist/es2019/ui/Expand/index.js +18 -44
- package/dist/es2019/ui/Messages/index.js +6 -6
- package/dist/es2019/ui/PortalProvider/index.js +7 -21
- package/dist/es2019/ui-menu/ColorPickerButton/index.js +7 -15
- package/dist/es2019/ui-menu/DropdownMenu/index.js +34 -49
- package/dist/esm/media-inline/constants.js +20 -1
- package/dist/esm/media-inline/inline-image-wrapper.js +4 -2
- package/dist/esm/media-inline/media-inline-image-card.js +3 -3
- package/dist/esm/media-inline/styles.js +11 -3
- package/dist/esm/media-inline/views/icon-wrapper.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/styles/shared/annotation.js +5 -22
- package/dist/esm/styles/shared/code-block.js +6 -22
- package/dist/esm/styles/shared/code-mark.js +3 -7
- package/dist/esm/styles/shared/panel.js +10 -63
- package/dist/esm/styles/shared/rule.js +3 -9
- package/dist/esm/ui/BaseTheme/index.js +9 -15
- package/dist/esm/ui/DropList/index.js +5 -18
- package/dist/esm/ui/Expand/index.js +14 -39
- package/dist/esm/ui/Messages/index.js +6 -6
- package/dist/esm/ui/PortalProvider/index.js +7 -21
- package/dist/esm/ui-menu/ColorPickerButton/index.js +6 -14
- package/dist/esm/ui-menu/DropdownMenu/index.js +11 -28
- package/dist/types/media-inline/constants.d.ts +18 -0
- package/dist/types/media-inline/styles.d.ts +6 -0
- package/dist/types/styles/shared/annotation.d.ts +2 -3
- package/dist/types/styles/shared/code-block.d.ts +1 -2
- package/dist/types/styles/shared/code-mark.d.ts +1 -2
- package/dist/types/styles/shared/panel.d.ts +4 -5
- package/dist/types/styles/shared/rule.d.ts +1 -2
- package/dist/types/ui/BaseTheme/index.d.ts +1 -1
- package/dist/types/ui/Expand/index.d.ts +4 -5
- package/dist/types/ui/Messages/index.d.ts +1 -1
- package/dist/types/ui/PortalProvider/index.d.ts +4 -8
- package/dist/types/utils/getModeFromTheme.d.ts +1 -1
- package/dist/types-ts4.5/media-inline/constants.d.ts +18 -0
- package/dist/types-ts4.5/media-inline/styles.d.ts +6 -0
- package/dist/types-ts4.5/styles/shared/annotation.d.ts +2 -3
- package/dist/types-ts4.5/styles/shared/code-block.d.ts +1 -2
- package/dist/types-ts4.5/styles/shared/code-mark.d.ts +1 -2
- package/dist/types-ts4.5/styles/shared/panel.d.ts +4 -5
- package/dist/types-ts4.5/styles/shared/rule.d.ts +1 -2
- package/dist/types-ts4.5/ui/BaseTheme/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/Expand/index.d.ts +4 -5
- package/dist/types-ts4.5/ui/Messages/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/PortalProvider/index.d.ts +4 -8
- package/dist/types-ts4.5/utils/getModeFromTheme.d.ts +1 -1
- package/package.json +2 -2
- package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +0 -43
- package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +0 -37
- package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +0 -36
- package/dist/types/ui/PortalProvider/PortalProviderThemesProvider.d.ts +0 -6
- package/dist/types-ts4.5/ui/PortalProvider/PortalProviderThemesProvider.d.ts +0 -6
|
@@ -5,10 +5,7 @@ import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
|
5
5
|
import { akEditorTableCellMinWidth, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { akEditorCustomIconSize } from '@atlaskit/editor-shared-styles/consts';
|
|
7
7
|
import { emojiImage, emojiSprite } from '@atlaskit/emoji';
|
|
8
|
-
import { B100, B400, B50, B75, G200, G400, G50, G75, N0, N20, N60, P100, P400, P50, P75, R100,
|
|
9
|
-
import { themed } from '@atlaskit/theme/components';
|
|
10
|
-
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
11
|
-
import { borderRadius, gridSize } from '@atlaskit/theme/constants';
|
|
8
|
+
import { B100, B400, B50, B75, G200, G400, G50, G75, N0, N20, N60, P100, P400, P50, P75, R100, R400, R50, R75, T100, T50, T75, Y200, Y400, Y50, Y75 } from '@atlaskit/theme/colors';
|
|
12
9
|
const lightPanelColors = {
|
|
13
10
|
info: B50,
|
|
14
11
|
note: P50,
|
|
@@ -87,28 +84,10 @@ const lightIconColor = {
|
|
|
87
84
|
warning: `var(--ds-icon-warning, ${Y400})`,
|
|
88
85
|
error: `var(--ds-icon-danger, ${R400})`
|
|
89
86
|
};
|
|
90
|
-
const darkIconColor = {
|
|
91
|
-
info: `var(--ds-icon-information, ${B100})`,
|
|
92
|
-
note: `var(--ds-icon-discovery, ${P100})`,
|
|
93
|
-
tip: `var(--ds-icon-success, ${G200})`,
|
|
94
|
-
success: `var(--ds-icon-success, ${G200})`,
|
|
95
|
-
warning: `var(--ds-icon-warning, ${Y100})`,
|
|
96
|
-
error: `var(--ds-icon-danger, ${R200})`
|
|
97
|
-
};
|
|
98
|
-
const tokenDarkPanelColors = {
|
|
99
|
-
info: `var(--ds-background-information, ${darkPanelColors['info']})`,
|
|
100
|
-
note: `var(--ds-background-discovery, ${darkPanelColors['note']})`,
|
|
101
|
-
tip: `var(--ds-background-success, ${darkPanelColors['tip']})`,
|
|
102
|
-
success: `var(--ds-background-success, ${darkPanelColors['success']})`,
|
|
103
|
-
warning: `var(--ds-background-warning, ${darkPanelColors['warning']})`,
|
|
104
|
-
error: `var(--ds-background-danger, ${darkPanelColors['error']})`
|
|
105
|
-
};
|
|
106
87
|
|
|
107
|
-
// TODO: Migrate away from gridSize
|
|
108
|
-
// Recommendation: Replace gridSize with 8
|
|
109
88
|
// New custom icons are a little smaller than predefined icons.
|
|
110
89
|
// To fix alignment issues with custom icons, vertical alignment is updated.
|
|
111
|
-
const panelEmojiSpriteVerticalAlignment = -(
|
|
90
|
+
const panelEmojiSpriteVerticalAlignment = -(8 * 3 - akEditorCustomIconSize) / 2;
|
|
112
91
|
const panelEmojiImageVerticalAlignment = panelEmojiSpriteVerticalAlignment - 1;
|
|
113
92
|
|
|
114
93
|
// TODO: https://product-fabric.atlassian.net/browse/DSP-4066
|
|
@@ -159,51 +138,19 @@ export const PanelSharedSelectors = {
|
|
|
159
138
|
yellowWarningIcon: `[aria-label=":warning:"] span:nth-child(1)`,
|
|
160
139
|
copyButton: `button[aria-label="Copy"]`
|
|
161
140
|
};
|
|
162
|
-
const iconDynamicStyles = panelType =>
|
|
163
|
-
const light = lightIconColor[panelType];
|
|
164
|
-
const dark = darkIconColor[panelType];
|
|
165
|
-
const color = themed({
|
|
166
|
-
light,
|
|
167
|
-
dark
|
|
168
|
-
})(props);
|
|
169
|
-
return `
|
|
170
|
-
color: ${color};
|
|
171
|
-
`;
|
|
172
|
-
};
|
|
141
|
+
const iconDynamicStyles = panelType => `color: ${lightIconColor[panelType]};`;
|
|
173
142
|
|
|
174
143
|
// Provides the color without tokens, used when converting to a custom panel
|
|
175
|
-
export const getPanelTypeBackgroundNoTokens =
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const background = themed({
|
|
179
|
-
light,
|
|
180
|
-
dark
|
|
181
|
-
})(props);
|
|
182
|
-
return background || 'none';
|
|
183
|
-
};
|
|
184
|
-
export const getPanelTypeBackground = (panelType, props = {}) => {
|
|
185
|
-
const light = hexToEditorBackgroundPaletteColor(lightPanelColors[panelType]);
|
|
186
|
-
// hexToEditorBackgroundPaletteColor has a light mode as a fallback color - for legacy dark mode we define the tokens locally
|
|
187
|
-
const dark = tokenDarkPanelColors[panelType];
|
|
188
|
-
const background = themed({
|
|
189
|
-
light,
|
|
190
|
-
dark
|
|
191
|
-
})(props);
|
|
192
|
-
return background || 'none';
|
|
193
|
-
};
|
|
194
|
-
const mainDynamicStyles = panelType => props => {
|
|
195
|
-
const background = getPanelTypeBackground(panelType, props);
|
|
196
|
-
const text = themed({
|
|
197
|
-
light: 'inherit',
|
|
198
|
-
dark: darkPanelColors.TextColor
|
|
199
|
-
})(props);
|
|
144
|
+
export const getPanelTypeBackgroundNoTokens = panelType => lightPanelColors[panelType] || 'none';
|
|
145
|
+
export const getPanelTypeBackground = panelType => hexToEditorBackgroundPaletteColor(lightPanelColors[panelType]) || 'none';
|
|
146
|
+
const mainDynamicStyles = panelType => {
|
|
200
147
|
return `
|
|
201
|
-
background-color: ${
|
|
202
|
-
color:
|
|
148
|
+
background-color: ${getPanelTypeBackground(panelType)};
|
|
149
|
+
color: inherit;
|
|
203
150
|
`;
|
|
204
151
|
};
|
|
205
|
-
export const panelSharedStylesWithoutPrefix =
|
|
206
|
-
border-radius: ${
|
|
152
|
+
export const panelSharedStylesWithoutPrefix = () => css`
|
|
153
|
+
border-radius: ${"var(--ds-border-radius, 3px)"};
|
|
207
154
|
margin: ${blockNodesVerticalMargin} 0 0;
|
|
208
155
|
padding: ${"var(--ds-space-100, 8px)"};
|
|
209
156
|
min-width: ${akEditorTableCellMinWidth}px;
|
|
@@ -212,7 +159,7 @@ export const panelSharedStylesWithoutPrefix = props => css`
|
|
|
212
159
|
align-items: baseline;
|
|
213
160
|
word-break: break-word;
|
|
214
161
|
|
|
215
|
-
${mainDynamicStyles(PanelType.INFO)
|
|
162
|
+
${mainDynamicStyles(PanelType.INFO)}
|
|
216
163
|
|
|
217
164
|
.${PanelSharedCssClassName.icon} {
|
|
218
165
|
flex-shrink: 0;
|
|
@@ -225,7 +172,7 @@ export const panelSharedStylesWithoutPrefix = props => css`
|
|
|
225
172
|
-moz-user-select: none;
|
|
226
173
|
-webkit-user-select: none;
|
|
227
174
|
-ms-user-select: none;
|
|
228
|
-
${iconDynamicStyles(PanelType.INFO)
|
|
175
|
+
${iconDynamicStyles(PanelType.INFO)}
|
|
229
176
|
|
|
230
177
|
> span {
|
|
231
178
|
vertical-align: middle;
|
|
@@ -259,53 +206,47 @@ export const panelSharedStylesWithoutPrefix = props => css`
|
|
|
259
206
|
}
|
|
260
207
|
|
|
261
208
|
&[data-panel-type='${PanelType.NOTE}'] {
|
|
262
|
-
${mainDynamicStyles(PanelType.NOTE)
|
|
209
|
+
${mainDynamicStyles(PanelType.NOTE)}
|
|
263
210
|
|
|
264
211
|
.${PanelSharedCssClassName.icon} {
|
|
265
|
-
${iconDynamicStyles(PanelType.NOTE)
|
|
212
|
+
${iconDynamicStyles(PanelType.NOTE)}
|
|
266
213
|
}
|
|
267
214
|
}
|
|
268
215
|
|
|
269
216
|
&[data-panel-type='${PanelType.TIP}'] {
|
|
270
|
-
${mainDynamicStyles(PanelType.TIP)
|
|
217
|
+
${mainDynamicStyles(PanelType.TIP)}
|
|
271
218
|
|
|
272
219
|
.${PanelSharedCssClassName.icon} {
|
|
273
|
-
${iconDynamicStyles(PanelType.TIP)
|
|
220
|
+
${iconDynamicStyles(PanelType.TIP)}
|
|
274
221
|
}
|
|
275
222
|
}
|
|
276
223
|
|
|
277
224
|
&[data-panel-type='${PanelType.WARNING}'] {
|
|
278
|
-
${mainDynamicStyles(PanelType.WARNING)
|
|
225
|
+
${mainDynamicStyles(PanelType.WARNING)}
|
|
279
226
|
|
|
280
227
|
.${PanelSharedCssClassName.icon} {
|
|
281
|
-
${iconDynamicStyles(PanelType.WARNING)
|
|
228
|
+
${iconDynamicStyles(PanelType.WARNING)}
|
|
282
229
|
}
|
|
283
230
|
}
|
|
284
231
|
|
|
285
232
|
&[data-panel-type='${PanelType.ERROR}'] {
|
|
286
|
-
${mainDynamicStyles(PanelType.ERROR)
|
|
233
|
+
${mainDynamicStyles(PanelType.ERROR)}
|
|
287
234
|
|
|
288
235
|
.${PanelSharedCssClassName.icon} {
|
|
289
|
-
${iconDynamicStyles(PanelType.ERROR)
|
|
236
|
+
${iconDynamicStyles(PanelType.ERROR)}
|
|
290
237
|
}
|
|
291
238
|
}
|
|
292
239
|
|
|
293
240
|
&[data-panel-type='${PanelType.SUCCESS}'] {
|
|
294
|
-
${mainDynamicStyles(PanelType.SUCCESS)
|
|
241
|
+
${mainDynamicStyles(PanelType.SUCCESS)}
|
|
295
242
|
|
|
296
243
|
.${PanelSharedCssClassName.icon} {
|
|
297
|
-
${iconDynamicStyles(PanelType.SUCCESS)
|
|
244
|
+
${iconDynamicStyles(PanelType.SUCCESS)}
|
|
298
245
|
}
|
|
299
246
|
}
|
|
300
|
-
|
|
301
|
-
&[data-panel-type='${PanelType.CUSTOM}'] {
|
|
302
|
-
${themed({
|
|
303
|
-
dark: getPanelBackgroundDarkModeColors
|
|
304
|
-
})(props)};
|
|
305
|
-
}
|
|
306
247
|
`;
|
|
307
|
-
export const panelSharedStyles =
|
|
248
|
+
export const panelSharedStyles = () => css`
|
|
308
249
|
.${PanelSharedCssClassName.prefix} {
|
|
309
|
-
${panelSharedStylesWithoutPrefix(
|
|
250
|
+
${panelSharedStylesWithoutPrefix()}
|
|
310
251
|
}
|
|
311
252
|
`;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { akEditorLineHeight } from '@atlaskit/editor-shared-styles';
|
|
3
|
-
import {
|
|
4
|
-
import { themed } from '@atlaskit/theme/components';
|
|
5
|
-
const divider = themed({
|
|
6
|
-
light: `var(--ds-border, ${N30A})`,
|
|
7
|
-
dark: `var(--ds-border, ${DN50})`
|
|
8
|
-
});
|
|
9
|
-
|
|
3
|
+
import { N30A } from '@atlaskit/theme/colors';
|
|
10
4
|
// @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
|
|
11
|
-
export const ruleSharedStyles =
|
|
5
|
+
export const ruleSharedStyles = () => css`
|
|
12
6
|
& hr {
|
|
13
7
|
border: none;
|
|
14
|
-
background-color: ${
|
|
8
|
+
background-color: ${`var(--ds-border, ${N30A})`};
|
|
15
9
|
margin: ${akEditorLineHeight}em 0;
|
|
16
10
|
height: 2px;
|
|
17
11
|
border-radius: 1px;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { ThemeProvider } from '@emotion/react';
|
|
3
3
|
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import {
|
|
5
|
-
import { CHANNEL, fontSize } from '@atlaskit/theme/constants';
|
|
4
|
+
import { fontSize } from '@atlaskit/theme/constants';
|
|
6
5
|
import { WidthConsumer } from '../WidthProvider';
|
|
7
6
|
export function mapBreakpointToLayoutMaxWidth(breakpoint) {
|
|
8
7
|
switch (breakpoint) {
|
|
@@ -17,17 +16,10 @@ export function BaseThemeWrapper({
|
|
|
17
16
|
baseFontSize,
|
|
18
17
|
children
|
|
19
18
|
}) {
|
|
20
|
-
const {
|
|
21
|
-
mode
|
|
22
|
-
} = useGlobalTheme();
|
|
23
19
|
const memoizedTheme = useMemo(() => ({
|
|
24
20
|
baseFontSize: baseFontSize || fontSize(),
|
|
25
|
-
layoutMaxWidth: akEditorDefaultLayoutWidth
|
|
26
|
-
|
|
27
|
-
[CHANNEL]: {
|
|
28
|
-
mode
|
|
29
|
-
}
|
|
30
|
-
}), [baseFontSize, mode]);
|
|
21
|
+
layoutMaxWidth: akEditorDefaultLayoutWidth
|
|
22
|
+
}), [baseFontSize]);
|
|
31
23
|
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
32
24
|
theme: memoizedTheme
|
|
33
25
|
}, children);
|
|
@@ -4,12 +4,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
import { Component } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
|
-
import {
|
|
8
|
-
import { themed } from '@atlaskit/theme/components';
|
|
9
|
-
import { borderRadius } from '@atlaskit/theme/constants';
|
|
7
|
+
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
10
8
|
import Layer from '../Layer';
|
|
11
9
|
const packageName = "@atlaskit/editor-common";
|
|
12
|
-
const packageVersion = "76.27.
|
|
10
|
+
const packageVersion = "76.27.10";
|
|
13
11
|
const halfFocusRing = 1;
|
|
14
12
|
const dropOffset = '0, 8';
|
|
15
13
|
class DropList extends Component {
|
|
@@ -26,17 +24,11 @@ class DropList extends Component {
|
|
|
26
24
|
${this.props.shouldFitContainer ? 'display: block; box-sizing: border-box;' : 'display: inline-flex;'}
|
|
27
25
|
`);
|
|
28
26
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
29
|
-
_defineProperty(this, "menuWrapper",
|
|
27
|
+
_defineProperty(this, "menuWrapper", () => {
|
|
30
28
|
return css`
|
|
31
|
-
color: ${
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})(theme)};
|
|
35
|
-
background-color: ${themed({
|
|
36
|
-
light: `var(--ds-surface-overlay, ${N0})`,
|
|
37
|
-
dark: `var(--ds-surface-overlay, ${DN50})`
|
|
38
|
-
})(theme)};
|
|
39
|
-
border-radius: ${borderRadius()}px;
|
|
29
|
+
color: ${`var(--ds-text, ${N900})`};
|
|
30
|
+
background-color: ${`var(--ds-surface-overlay, ${N0})`};
|
|
31
|
+
border-radius: ${"var(--ds-border-radius, 3px)"};
|
|
40
32
|
box-shadow: ${`var(--ds-shadow-overlay, ${`0 4px 8px calc(-1 * 2px) ${N50A}, 0 0 1px ${N60A}`})`};
|
|
41
33
|
box-sizing: border-box;
|
|
42
34
|
overflow: auto;
|
|
@@ -128,9 +120,7 @@ class DropList extends Component {
|
|
|
128
120
|
id
|
|
129
121
|
} = this.props;
|
|
130
122
|
let layerContent = isOpen ? jsx("div", {
|
|
131
|
-
css:
|
|
132
|
-
theme: theme
|
|
133
|
-
}),
|
|
123
|
+
css: this.menuWrapper,
|
|
134
124
|
"data-role": "droplistContent",
|
|
135
125
|
"data-testid": testId && `${testId}--content`,
|
|
136
126
|
ref: this.handleContentRef,
|
|
@@ -5,8 +5,7 @@ import React, { forwardRef } from 'react';
|
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { defineMessages } from 'react-intl-next';
|
|
7
7
|
import { akEditorLineHeight, akEditorSwoopCubicBezier, akLayoutGutterOffset, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
8
|
-
import { B300,
|
|
9
|
-
import { themed } from '@atlaskit/theme/components';
|
|
8
|
+
import { B300, N200, N200A, N300A, N30A, N40A, N50A, N90 } from '@atlaskit/theme/colors';
|
|
10
9
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
11
10
|
import { fontSize, gridSize } from '@atlaskit/theme/constants';
|
|
12
11
|
export const messages = defineMessages({
|
|
@@ -33,31 +32,22 @@ export const messages = defineMessages({
|
|
|
33
32
|
});
|
|
34
33
|
const BORDER_RADIUS = "var(--ds-border-radius-100, 4px)";
|
|
35
34
|
const EXPAND_COLLAPSED_BACKGROUND = "var(--ds-background-neutral-subtle, transparent)";
|
|
36
|
-
const EXPAND_SELECTED_BACKGROUND =
|
|
37
|
-
light: "var(--ds-surface, rgba(255, 255, 255, 0.6))",
|
|
38
|
-
dark: "var(--ds-surface, rgba(9, 10, 11, 0.29))"
|
|
39
|
-
});
|
|
35
|
+
const EXPAND_SELECTED_BACKGROUND = "var(--ds-surface, rgba(255, 255, 255, 0.6))";
|
|
40
36
|
const EXPAND_FOCUSED_BORDER_COLOR = `var(--ds-border-focused, ${B300})`;
|
|
41
37
|
const EXPAND_COLLAPSED_BORDER_COLOR = 'transparent';
|
|
42
|
-
const EXPAND_EXPANDED_BORDER_COLOR =
|
|
43
|
-
light: `var(--ds-border, ${N40A})`,
|
|
44
|
-
dark: `var(--ds-border, ${DN50})`
|
|
45
|
-
});
|
|
38
|
+
const EXPAND_EXPANDED_BORDER_COLOR = `var(--ds-border, ${N40A})`;
|
|
46
39
|
export const ExpandIconWrapper = ({
|
|
47
40
|
children,
|
|
48
41
|
expanded
|
|
49
42
|
}) => {
|
|
50
43
|
return jsx("div", {
|
|
51
|
-
css:
|
|
44
|
+
css: () => expanded ? [expandIconWrapperStyle(), expandIconWrapperExpandedStyle] : expandIconWrapperStyle()
|
|
52
45
|
}, children);
|
|
53
46
|
};
|
|
54
|
-
const expandIconWrapperStyle =
|
|
47
|
+
const expandIconWrapperStyle = () => css`
|
|
55
48
|
cursor: pointer;
|
|
56
49
|
display: flex;
|
|
57
|
-
color: ${
|
|
58
|
-
light: `var(--ds-icon, ${N90})`,
|
|
59
|
-
dark: "var(--ds-icon, #d9dde3)"
|
|
60
|
-
})(props)};
|
|
50
|
+
color: ${`var(--ds-icon, ${N90})`};
|
|
61
51
|
border-radius: ${"var(--ds-border-radius-100, 4px)"};
|
|
62
52
|
width: 24px;
|
|
63
53
|
height: 24px;
|
|
@@ -101,13 +91,13 @@ const containerStyles = styleProps => {
|
|
|
101
91
|
// and is the root level expand.
|
|
102
92
|
const marginHorizontal = styleProps['data-node-type'] === 'expand' ? `-${akLayoutGutterOffset}px` : 0;
|
|
103
93
|
const margin = `${marginTop} ${marginHorizontal} ${marginBottom}`;
|
|
104
|
-
return
|
|
94
|
+
return () => css`
|
|
105
95
|
border-width: 1px;
|
|
106
96
|
border-style: solid;
|
|
107
|
-
border-color: ${focused ? EXPAND_FOCUSED_BORDER_COLOR : expanded ? EXPAND_EXPANDED_BORDER_COLOR
|
|
97
|
+
border-color: ${focused ? EXPAND_FOCUSED_BORDER_COLOR : expanded ? EXPAND_EXPANDED_BORDER_COLOR : EXPAND_COLLAPSED_BORDER_COLOR};
|
|
108
98
|
border-radius: ${BORDER_RADIUS};
|
|
109
99
|
min-height: 25px;
|
|
110
|
-
background: ${!expanded ? EXPAND_COLLAPSED_BACKGROUND : EXPAND_SELECTED_BACKGROUND
|
|
100
|
+
background: ${!expanded ? EXPAND_COLLAPSED_BACKGROUND : EXPAND_SELECTED_BACKGROUND};
|
|
111
101
|
margin: ${margin};
|
|
112
102
|
|
|
113
103
|
transition: background 0.3s ${akEditorSwoopCubicBezier},
|
|
@@ -118,12 +108,8 @@ const containerStyles = styleProps => {
|
|
|
118
108
|
// TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.
|
|
119
109
|
// This is because the default state already uses the same token and, as such, the hover style won't change anything.
|
|
120
110
|
// https://product-fabric.atlassian.net/browse/DSP-4152
|
|
121
|
-
border: 1px solid
|
|
122
|
-
|
|
123
|
-
light: `var(--ds-border, ${N50A})`,
|
|
124
|
-
dark: `var(--ds-border, ${DN50})`
|
|
125
|
-
})(themeProps)};
|
|
126
|
-
background: ${EXPAND_SELECTED_BACKGROUND(themeProps)};
|
|
111
|
+
border: 1px solid ${`var(--ds-border, ${N50A})`};
|
|
112
|
+
background: ${EXPAND_SELECTED_BACKGROUND};
|
|
127
113
|
}
|
|
128
114
|
|
|
129
115
|
td > :not(style):first-child,
|
|
@@ -132,7 +118,7 @@ const containerStyles = styleProps => {
|
|
|
132
118
|
}
|
|
133
119
|
`;
|
|
134
120
|
};
|
|
135
|
-
const contentStyles = styleProps =>
|
|
121
|
+
const contentStyles = styleProps => () => css`
|
|
136
122
|
padding-top: ${styleProps.expanded ? "var(--ds-space-100, 8px)" : "var(--ds-space-0, 0px)"};
|
|
137
123
|
padding-right: ${"var(--ds-space-100, 8px)"};
|
|
138
124
|
// TODO: Migrate away from gridSize
|
|
@@ -161,16 +147,13 @@ const contentStyles = styleProps => themeProps => css`
|
|
|
161
147
|
}
|
|
162
148
|
` : ''}
|
|
163
149
|
`;
|
|
164
|
-
const titleInputStyles =
|
|
150
|
+
const titleInputStyles = () => css`
|
|
165
151
|
outline: none;
|
|
166
152
|
border: none;
|
|
167
153
|
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
168
154
|
line-height: ${akEditorLineHeight};
|
|
169
155
|
font-weight: normal;
|
|
170
|
-
color: ${
|
|
171
|
-
light: `var(--ds-text-subtlest, ${N200A})`,
|
|
172
|
-
dark: `var(--ds-text-subtlest, ${DN600})`
|
|
173
|
-
})(props)};
|
|
156
|
+
color: ${`var(--ds-text-subtlest, ${N200A})`};
|
|
174
157
|
background: transparent;
|
|
175
158
|
display: flex;
|
|
176
159
|
flex: 1;
|
|
@@ -178,17 +161,11 @@ const titleInputStyles = props => css`
|
|
|
178
161
|
width: 100%;
|
|
179
162
|
|
|
180
163
|
&::placeholder {
|
|
181
|
-
opacity:
|
|
182
|
-
|
|
183
|
-
dark: 0.6
|
|
184
|
-
})(props)};
|
|
185
|
-
color: ${themed({
|
|
186
|
-
light: `var(--ds-text-subtlest, ${N200})`,
|
|
187
|
-
dark: `var(--ds-text-subtlest, ${DN600})`
|
|
188
|
-
})(props)};
|
|
164
|
+
opacity: 1;
|
|
165
|
+
color: ${`var(--ds-text-subtlest, ${N200})`};
|
|
189
166
|
}
|
|
190
167
|
`;
|
|
191
|
-
const titleContainerStyles =
|
|
168
|
+
const titleContainerStyles = () => css`
|
|
192
169
|
padding: 0;
|
|
193
170
|
display: flex;
|
|
194
171
|
align-items: flex-start;
|
|
@@ -196,10 +173,7 @@ const titleContainerStyles = props => css`
|
|
|
196
173
|
border: none;
|
|
197
174
|
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
198
175
|
width: 100%;
|
|
199
|
-
color: ${
|
|
200
|
-
light: `var(--ds-text-subtle, ${N300A})`,
|
|
201
|
-
dark: `var(--ds-text-subtle, ${DN600})`
|
|
202
|
-
})(props)};
|
|
176
|
+
color: ${`var(--ds-text-subtle, ${N300A})`};
|
|
203
177
|
overflow: hidden;
|
|
204
178
|
cursor: pointer;
|
|
205
179
|
|
|
@@ -11,8 +11,8 @@ const errorColor = css`
|
|
|
11
11
|
const validColor = css`
|
|
12
12
|
color: ${`var(--ds-text-success, ${G400})`};
|
|
13
13
|
`;
|
|
14
|
-
const messageStyle =
|
|
15
|
-
${h200(
|
|
14
|
+
const messageStyle = () => css`
|
|
15
|
+
${h200()} font-weight: normal;
|
|
16
16
|
color: ${`var(--ds-text-subtlest, ${N200})`};
|
|
17
17
|
margin-top: ${"var(--ds-space-050, 4px)"};
|
|
18
18
|
display: flex;
|
|
@@ -30,8 +30,8 @@ export const HelperMessage = ({
|
|
|
30
30
|
export const ErrorMessage = ({
|
|
31
31
|
children
|
|
32
32
|
}) => jsx("div", {
|
|
33
|
-
css:
|
|
34
|
-
return [messageStyle(
|
|
33
|
+
css: () => {
|
|
34
|
+
return [messageStyle(), errorColor];
|
|
35
35
|
}
|
|
36
36
|
}, jsx("span", {
|
|
37
37
|
css: iconWrapperStyle
|
|
@@ -43,8 +43,8 @@ export const ErrorMessage = ({
|
|
|
43
43
|
export const ValidMessage = ({
|
|
44
44
|
children
|
|
45
45
|
}) => jsx("div", {
|
|
46
|
-
css:
|
|
47
|
-
return [messageStyle(
|
|
46
|
+
css: () => {
|
|
47
|
+
return [messageStyle(), validColor];
|
|
48
48
|
}
|
|
49
49
|
}, jsx("span", {
|
|
50
50
|
css: iconWrapperStyle
|
|
@@ -5,13 +5,11 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import { createPortal, unmountComponentAtNode, unstable_renderSubtreeIntoContainer } from 'react-dom';
|
|
6
6
|
import { injectIntl, RawIntlProvider, useIntl } from 'react-intl-next';
|
|
7
7
|
import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
|
|
8
|
-
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
9
8
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics';
|
|
10
9
|
import { EventDispatcher } from '../../event-dispatcher';
|
|
11
10
|
import IntlProviderIfMissingWrapper from '../IntlProviderIfMissingWrapper';
|
|
12
|
-
import { PortalProviderThemeProviders } from './PortalProviderThemesProvider';
|
|
13
11
|
export class PortalProviderAPI extends EventDispatcher {
|
|
14
|
-
constructor(intl, onAnalyticsEvent, analyticsContext
|
|
12
|
+
constructor(intl, onAnalyticsEvent, analyticsContext) {
|
|
15
13
|
super();
|
|
16
14
|
_defineProperty(this, "portals", new Map());
|
|
17
15
|
_defineProperty(this, "setContext", context => {
|
|
@@ -20,7 +18,6 @@ export class PortalProviderAPI extends EventDispatcher {
|
|
|
20
18
|
this.intl = intl;
|
|
21
19
|
this.onAnalyticsEvent = onAnalyticsEvent;
|
|
22
20
|
this.useAnalyticsContext = analyticsContext;
|
|
23
|
-
this.themeMode = themeMode;
|
|
24
21
|
}
|
|
25
22
|
render(children, container, hasAnalyticsContext = false, hasIntlContext = false) {
|
|
26
23
|
this.portals.set(container, {
|
|
@@ -28,10 +25,7 @@ export class PortalProviderAPI extends EventDispatcher {
|
|
|
28
25
|
hasAnalyticsContext,
|
|
29
26
|
hasIntlContext
|
|
30
27
|
});
|
|
31
|
-
|
|
32
|
-
mode: this.themeMode
|
|
33
|
-
}, children());
|
|
34
|
-
let wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders) : childrenWithThemeProviders;
|
|
28
|
+
let wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, children()) : children();
|
|
35
29
|
if (hasIntlContext) {
|
|
36
30
|
wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
37
31
|
value: this.intl
|
|
@@ -44,26 +38,21 @@ export class PortalProviderAPI extends EventDispatcher {
|
|
|
44
38
|
// we (unfortunately) need to re-render to pass down any updated context.
|
|
45
39
|
// selectively do this for nodeviews that opt-in via `hasAnalyticsContext`
|
|
46
40
|
forceUpdate({
|
|
47
|
-
intl
|
|
48
|
-
themeMode
|
|
41
|
+
intl
|
|
49
42
|
}) {
|
|
50
43
|
this.intl = intl;
|
|
51
|
-
this.themeMode = themeMode;
|
|
52
44
|
this.portals.forEach((portal, container) => {
|
|
53
45
|
if (!portal.hasAnalyticsContext && !this.useAnalyticsContext && !portal.hasIntlContext) {
|
|
54
46
|
return;
|
|
55
47
|
}
|
|
56
48
|
let wrappedChildren = portal.children();
|
|
57
|
-
const childrenWithThemeProviders = /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
|
|
58
|
-
mode: themeMode
|
|
59
|
-
}, wrappedChildren);
|
|
60
49
|
if (portal.hasAnalyticsContext && this.useAnalyticsContext) {
|
|
61
|
-
wrappedChildren = /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null,
|
|
50
|
+
wrappedChildren = /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, wrappedChildren);
|
|
62
51
|
}
|
|
63
52
|
if (portal.hasIntlContext) {
|
|
64
53
|
wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
65
54
|
value: this.intl
|
|
66
|
-
},
|
|
55
|
+
}, wrappedChildren);
|
|
67
56
|
}
|
|
68
57
|
unstable_renderSubtreeIntoContainer(this.context, wrappedChildren, container);
|
|
69
58
|
});
|
|
@@ -103,15 +92,14 @@ export class PortalProviderAPI extends EventDispatcher {
|
|
|
103
92
|
class BasePortalProvider extends React.Component {
|
|
104
93
|
constructor(props) {
|
|
105
94
|
super(props);
|
|
106
|
-
this.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext
|
|
95
|
+
this.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext);
|
|
107
96
|
}
|
|
108
97
|
render() {
|
|
109
98
|
return this.props.render(this.portalProviderAPI);
|
|
110
99
|
}
|
|
111
100
|
componentDidUpdate() {
|
|
112
101
|
this.portalProviderAPI.forceUpdate({
|
|
113
|
-
intl: this.props.intl
|
|
114
|
-
themeMode: this.props.themeMode
|
|
102
|
+
intl: this.props.intl
|
|
115
103
|
});
|
|
116
104
|
}
|
|
117
105
|
}
|
|
@@ -132,10 +120,8 @@ const PortalProviderWithThemeAndIntlProviders = ({
|
|
|
132
120
|
render
|
|
133
121
|
}) => {
|
|
134
122
|
const intl = useIntl();
|
|
135
|
-
const globalTheme = useGlobalTheme();
|
|
136
123
|
return /*#__PURE__*/React.createElement(BasePortalProvider, {
|
|
137
124
|
intl: intl,
|
|
138
|
-
themeMode: globalTheme.mode,
|
|
139
125
|
onAnalyticsEvent: onAnalyticsEvent,
|
|
140
126
|
useAnalyticsContext: useAnalyticsContext,
|
|
141
127
|
render: render
|
|
@@ -4,9 +4,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
4
4
|
import { withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
5
|
import Button from '@atlaskit/button';
|
|
6
6
|
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
7
|
-
import {
|
|
8
|
-
import { themed } from '@atlaskit/theme/components';
|
|
9
|
-
import { borderRadius } from '@atlaskit/theme/constants';
|
|
7
|
+
import { N0, N30A, N60A } from '@atlaskit/theme/colors';
|
|
10
8
|
import Tooltip from '@atlaskit/tooltip';
|
|
11
9
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, editorAnalyticsChannel, EVENT_TYPE } from '../../analytics';
|
|
12
10
|
import { ColorPalette, DEFAULT_BORDER_COLOR, getSelectedRowAndColumnFromPalette } from '../../ui-color';
|
|
@@ -26,12 +24,9 @@ const colorPickerExpandContainer = css`
|
|
|
26
24
|
// Control the size of color picker buttons and preview
|
|
27
25
|
// TODO: https://product-fabric.atlassian.net/browse/DSP-4134
|
|
28
26
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
29
|
-
const colorPickerWrapper =
|
|
30
|
-
border-radius: ${
|
|
31
|
-
background-color: ${
|
|
32
|
-
light: `var(--ds-surface-overlay, ${N0})`,
|
|
33
|
-
dark: `var(--ds-surface-overlay, ${DN50})`
|
|
34
|
-
})(theme)};
|
|
27
|
+
const colorPickerWrapper = () => css`
|
|
28
|
+
border-radius: ${"var(--ds-border-radius, 3px)"};
|
|
29
|
+
background-color: ${`var(--ds-surface-overlay, ${N0})`};
|
|
35
30
|
box-shadow: 0 4px 8px -2px ${N60A}, 0 0 1px ${N60A};
|
|
36
31
|
padding: ${"var(--ds-space-100, 8px)"} 0px;
|
|
37
32
|
`;
|
|
@@ -153,7 +148,7 @@ const ColorPickerButton = props => {
|
|
|
153
148
|
};
|
|
154
149
|
const title = props.title || '';
|
|
155
150
|
const currentColor = props.currentColor && props.hexToPaletteColor ? props.hexToPaletteColor(props.currentColor) : props.currentColor;
|
|
156
|
-
const buttonStyle =
|
|
151
|
+
const buttonStyle = () => {
|
|
157
152
|
var _props$size, _props$size2, _props$size3;
|
|
158
153
|
return css`
|
|
159
154
|
padding: ${"var(--ds-space-075, 6px)"} 10px;
|
|
@@ -167,7 +162,7 @@ const ColorPickerButton = props => {
|
|
|
167
162
|
align-self: center;
|
|
168
163
|
content: '';
|
|
169
164
|
border: 1px solid ${DEFAULT_BORDER_COLOR};
|
|
170
|
-
border-radius: ${
|
|
165
|
+
border-radius: ${"var(--ds-border-radius, 3px)"};
|
|
171
166
|
background-color: ${currentColor || 'transparent'};
|
|
172
167
|
width: ${((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px'};
|
|
173
168
|
height: ${((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px'};
|
|
@@ -175,10 +170,7 @@ const ColorPickerButton = props => {
|
|
|
175
170
|
margin: 0px ${"var(--ds-space-025, 2px)"};
|
|
176
171
|
}
|
|
177
172
|
&:hover {
|
|
178
|
-
background: ${
|
|
179
|
-
light: `var(--ds-background-neutral-subtle-hovered, ${N30A})`,
|
|
180
|
-
dark: `var(--ds-background-neutral-subtle-hovered, ${N30A})`
|
|
181
|
-
})(theme)};
|
|
173
|
+
background: ${`var(--ds-background-neutral-subtle-hovered, ${N30A})`};
|
|
182
174
|
}
|
|
183
175
|
`;
|
|
184
176
|
};
|