@atlaskit/editor-toolbar 2.2.4 → 2.3.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 +14 -0
- package/dist/cjs/ui/ColorPalette/index.js +8 -2
- package/dist/es2019/ui/ColorPalette/index.js +7 -2
- package/dist/esm/ui/ColorPalette/index.js +8 -2
- package/dist/types/ui/ColorPalette/index.d.ts +1 -1
- package/dist/types/ui/ColorPalette/types.d.ts +3 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-toolbar
|
|
2
2
|
|
|
3
|
+
## 2.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`d778b282fb391`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d778b282fb391) -
|
|
8
|
+
Tighten color picker spacing and footer dimensions.
|
|
9
|
+
|
|
10
|
+
The `@atlaskit/editor-toolbar/color-palette` entry point now supports a `gap` prop to customise
|
|
11
|
+
spacing between color tile wrappers, for example: `<ColorPalette gap="space.0" {...props} />`.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 2.2.4
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -9,7 +9,9 @@ exports.default = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _chromatism = _interopRequireDefault(require("chromatism"));
|
|
11
11
|
var _reactIntl = require("react-intl");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
13
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
14
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
15
|
var _useThemeObserver2 = require("@atlaskit/tokens/use-theme-observer");
|
|
14
16
|
var _Color = require("./Color");
|
|
15
17
|
var _getColorMessage = _interopRequireDefault(require("./getColorMessage"));
|
|
@@ -56,6 +58,8 @@ function getCheckMarkColor(color, useIconToken) {
|
|
|
56
58
|
var ColorPalette = function ColorPalette(_ref) {
|
|
57
59
|
var _ref$cols = _ref.cols,
|
|
58
60
|
cols = _ref$cols === void 0 ? _utils.DEFAULT_COLOR_PICKER_COLUMNS : _ref$cols,
|
|
61
|
+
_ref$gap = _ref.gap,
|
|
62
|
+
gap = _ref$gap === void 0 ? 'space.050' : _ref$gap,
|
|
59
63
|
onClick = _ref.onClick,
|
|
60
64
|
onKeyDown = _ref.onKeyDown,
|
|
61
65
|
selectedColor = _ref.selectedColor,
|
|
@@ -68,6 +72,7 @@ var ColorPalette = function ColorPalette(_ref) {
|
|
|
68
72
|
var _useThemeObserver = (0, _useThemeObserver2.useThemeObserver)(),
|
|
69
73
|
tokenTheme = _useThemeObserver.colorMode;
|
|
70
74
|
var useIconToken = !!hexToPaletteColor;
|
|
75
|
+
var shouldUseInlineColorGap = (0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_lovability_text_bg_color_patch_1');
|
|
71
76
|
|
|
72
77
|
// Refs for keyboard navigation
|
|
73
78
|
var paletteRef = (0, _react.useRef)(null);
|
|
@@ -253,12 +258,13 @@ var ColorPalette = function ColorPalette(_ref) {
|
|
|
253
258
|
}
|
|
254
259
|
}, [colorsPerRow, focusColorAt, onClick, onKeyDown]);
|
|
255
260
|
return /*#__PURE__*/_react.default.createElement(_compiled.Grid, {
|
|
256
|
-
gap:
|
|
261
|
+
gap: gap,
|
|
257
262
|
ref: paletteRef,
|
|
258
263
|
role: "group"
|
|
259
264
|
}, colorsPerRow.map(function (row, rowIndex) {
|
|
260
265
|
return /*#__PURE__*/_react.default.createElement(_compiled.Inline, {
|
|
261
|
-
|
|
266
|
+
space: shouldUseInlineColorGap ? gap : undefined,
|
|
267
|
+
rowSpace: shouldUseInlineColorGap ? undefined : gap,
|
|
262
268
|
key: "row-first-color-".concat(row[0].value),
|
|
263
269
|
role: "radiogroup"
|
|
264
270
|
}, row.map(function (_ref2, colIndex) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React, { useMemo, useCallback, useRef, useEffect } from 'react';
|
|
2
2
|
import chromatism from 'chromatism';
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { Grid, Inline } from '@atlaskit/primitives/compiled';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
7
|
import { useThemeObserver } from '@atlaskit/tokens/use-theme-observer';
|
|
6
8
|
import { Color } from './Color';
|
|
7
9
|
import getColorMessage from './getColorMessage';
|
|
@@ -45,6 +47,7 @@ function getCheckMarkColor(color, useIconToken) {
|
|
|
45
47
|
*/
|
|
46
48
|
const ColorPalette = ({
|
|
47
49
|
cols = DEFAULT_COLOR_PICKER_COLUMNS,
|
|
50
|
+
gap = 'space.050',
|
|
48
51
|
onClick,
|
|
49
52
|
onKeyDown,
|
|
50
53
|
selectedColor,
|
|
@@ -62,6 +65,7 @@ const ColorPalette = ({
|
|
|
62
65
|
colorMode: tokenTheme
|
|
63
66
|
} = useThemeObserver();
|
|
64
67
|
const useIconToken = !!hexToPaletteColor;
|
|
68
|
+
const shouldUseInlineColorGap = expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && fg('platform_editor_lovability_text_bg_color_patch_1');
|
|
65
69
|
|
|
66
70
|
// Refs for keyboard navigation
|
|
67
71
|
const paletteRef = useRef(null);
|
|
@@ -249,11 +253,12 @@ const ColorPalette = ({
|
|
|
249
253
|
}
|
|
250
254
|
}, [colorsPerRow, focusColorAt, onClick, onKeyDown]);
|
|
251
255
|
return /*#__PURE__*/React.createElement(Grid, {
|
|
252
|
-
gap:
|
|
256
|
+
gap: gap,
|
|
253
257
|
ref: paletteRef,
|
|
254
258
|
role: "group"
|
|
255
259
|
}, colorsPerRow.map((row, rowIndex) => /*#__PURE__*/React.createElement(Inline, {
|
|
256
|
-
|
|
260
|
+
space: shouldUseInlineColorGap ? gap : undefined,
|
|
261
|
+
rowSpace: shouldUseInlineColorGap ? undefined : gap,
|
|
257
262
|
key: `row-first-color-${row[0].value}`,
|
|
258
263
|
role: "radiogroup"
|
|
259
264
|
}, row.map(({
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React, { useMemo, useCallback, useRef, useEffect } from 'react';
|
|
2
2
|
import chromatism from 'chromatism';
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { Grid, Inline } from '@atlaskit/primitives/compiled';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
7
|
import { useThemeObserver } from '@atlaskit/tokens/use-theme-observer';
|
|
6
8
|
import { Color } from './Color';
|
|
7
9
|
import getColorMessage from './getColorMessage';
|
|
@@ -48,6 +50,8 @@ function getCheckMarkColor(color, useIconToken) {
|
|
|
48
50
|
var ColorPalette = function ColorPalette(_ref) {
|
|
49
51
|
var _ref$cols = _ref.cols,
|
|
50
52
|
cols = _ref$cols === void 0 ? DEFAULT_COLOR_PICKER_COLUMNS : _ref$cols,
|
|
53
|
+
_ref$gap = _ref.gap,
|
|
54
|
+
gap = _ref$gap === void 0 ? 'space.050' : _ref$gap,
|
|
51
55
|
onClick = _ref.onClick,
|
|
52
56
|
onKeyDown = _ref.onKeyDown,
|
|
53
57
|
selectedColor = _ref.selectedColor,
|
|
@@ -60,6 +64,7 @@ var ColorPalette = function ColorPalette(_ref) {
|
|
|
60
64
|
var _useThemeObserver = useThemeObserver(),
|
|
61
65
|
tokenTheme = _useThemeObserver.colorMode;
|
|
62
66
|
var useIconToken = !!hexToPaletteColor;
|
|
67
|
+
var shouldUseInlineColorGap = expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && fg('platform_editor_lovability_text_bg_color_patch_1');
|
|
63
68
|
|
|
64
69
|
// Refs for keyboard navigation
|
|
65
70
|
var paletteRef = useRef(null);
|
|
@@ -245,12 +250,13 @@ var ColorPalette = function ColorPalette(_ref) {
|
|
|
245
250
|
}
|
|
246
251
|
}, [colorsPerRow, focusColorAt, onClick, onKeyDown]);
|
|
247
252
|
return /*#__PURE__*/React.createElement(Grid, {
|
|
248
|
-
gap:
|
|
253
|
+
gap: gap,
|
|
249
254
|
ref: paletteRef,
|
|
250
255
|
role: "group"
|
|
251
256
|
}, colorsPerRow.map(function (row, rowIndex) {
|
|
252
257
|
return /*#__PURE__*/React.createElement(Inline, {
|
|
253
|
-
|
|
258
|
+
space: shouldUseInlineColorGap ? gap : undefined,
|
|
259
|
+
rowSpace: shouldUseInlineColorGap ? undefined : gap,
|
|
254
260
|
key: "row-first-color-".concat(row[0].value),
|
|
255
261
|
role: "radiogroup"
|
|
256
262
|
}, row.map(function (_ref2, colIndex) {
|
|
@@ -11,5 +11,5 @@ import type { ColorPaletteProps } from './types';
|
|
|
11
11
|
* - Design token integration
|
|
12
12
|
* - Customizable color mapping
|
|
13
13
|
*/
|
|
14
|
-
declare const ColorPalette: ({ cols, onClick, onKeyDown, selectedColor, paletteOptions, }: ColorPaletteProps) => React.JSX.Element;
|
|
14
|
+
declare const ColorPalette: ({ cols, gap, onClick, onKeyDown, selectedColor, paletteOptions, }: ColorPaletteProps) => React.JSX.Element;
|
|
15
15
|
export default ColorPalette;
|
|
@@ -26,6 +26,7 @@ export type PaletteTooltipMessages = {
|
|
|
26
26
|
dark: Record<string, MessageDescriptor>;
|
|
27
27
|
light: Record<string, MessageDescriptor>;
|
|
28
28
|
};
|
|
29
|
+
export type ColorPaletteGap = 'space.0' | 'space.050';
|
|
29
30
|
/**
|
|
30
31
|
* Configuration options for the color palette
|
|
31
32
|
*/
|
|
@@ -51,6 +52,8 @@ export interface ColorPaletteProps {
|
|
|
51
52
|
className?: string;
|
|
52
53
|
/** Number of columns in the palette grid */
|
|
53
54
|
cols?: number;
|
|
55
|
+
/** Gap between color tile wrappers */
|
|
56
|
+
gap?: ColorPaletteGap;
|
|
54
57
|
/** Callback when a color is clicked */
|
|
55
58
|
onClick: (value: string, label: string, event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
56
59
|
/** Optional callback for keyboard navigation */
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"registry": "https://registry.npmjs.org/"
|
|
5
5
|
},
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.3.0",
|
|
7
7
|
"description": "Common UI for Toolbars across the platform",
|
|
8
8
|
"atlassian": {
|
|
9
9
|
"react-compiler": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/popup": "^5.1.0",
|
|
39
39
|
"@atlaskit/primitives": "^21.0.0",
|
|
40
40
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
41
|
-
"@atlaskit/tmp-editor-statsig": "^126.
|
|
41
|
+
"@atlaskit/tmp-editor-statsig": "^126.1.0",
|
|
42
42
|
"@atlaskit/tokens": "^15.8.0",
|
|
43
43
|
"@atlaskit/tooltip": "^23.1.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|