@atlaskit/editor-toolbar 0.18.6 → 0.18.8
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 +13 -0
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/ui/ColorPalette/utils.js +1 -40
- package/dist/es2019/index.js +0 -1
- package/dist/es2019/ui/ColorPalette/utils.js +1 -36
- package/dist/esm/index.js +0 -1
- package/dist/esm/ui/ColorPalette/utils.js +1 -38
- package/dist/types/index.d.ts +0 -1
- package/dist/types/ui/ColorPalette/utils.d.ts +0 -20
- package/dist/types-ts4.5/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/ColorPalette/utils.d.ts +0 -20
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-toolbar
|
|
2
2
|
|
|
3
|
+
## 0.18.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`676d45e408322`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/676d45e408322) -
|
|
8
|
+
[ED-29726] clean up platform_editor_toolbar_aifc_patch_8
|
|
9
|
+
|
|
10
|
+
## 0.18.7
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 0.18.6
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -478,12 +478,6 @@ Object.defineProperty(exports, "WorkItemsIcon", {
|
|
|
478
478
|
return _WorkItemsIcon.WorkItemsIcon;
|
|
479
479
|
}
|
|
480
480
|
});
|
|
481
|
-
Object.defineProperty(exports, "getContrastingBackgroundColor", {
|
|
482
|
-
enumerable: true,
|
|
483
|
-
get: function get() {
|
|
484
|
-
return _utils.getContrastingBackgroundColor;
|
|
485
|
-
}
|
|
486
|
-
});
|
|
487
481
|
Object.defineProperty(exports, "useToolbarDropdownMenu", {
|
|
488
482
|
enumerable: true,
|
|
489
483
|
get: function get() {
|
|
@@ -572,5 +566,4 @@ var _SyncBlocksIcon = require("./ui/icons/SyncBlocksIcon");
|
|
|
572
566
|
var _WorkItemIcon = require("./ui/icons/WorkItemIcon");
|
|
573
567
|
var _WorkItemsIcon = require("./ui/icons/WorkItemsIcon");
|
|
574
568
|
var _ColorPalette = _interopRequireDefault(require("./ui/ColorPalette"));
|
|
575
|
-
var _utils = require("./ui/ColorPalette/utils");
|
|
576
569
|
var _uiContext = require("./hooks/ui-context");
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.DEFAULT_COLOR_PICKER_COLUMNS = void 0;
|
|
8
7
|
exports.getColorsPerRowFromPalette = getColorsPerRowFromPalette;
|
|
9
|
-
exports.getContrastingBackgroundColor = getContrastingBackgroundColor;
|
|
10
8
|
exports.getSelectedRowAndColumn = getSelectedRowAndColumn;
|
|
11
9
|
exports.getSelectedRowAndColumnFromPalette = getSelectedRowAndColumnFromPalette;
|
|
12
10
|
exports.getTokenCSSVariableValue = void 0;
|
|
13
|
-
var _chromatism = _interopRequireDefault(require("chromatism"));
|
|
14
11
|
/**
|
|
15
12
|
* Default number of columns in the color picker
|
|
16
13
|
*/
|
|
@@ -94,40 +91,4 @@ var getTokenCSSVariableValue = exports.getTokenCSSVariableValue = function getTo
|
|
|
94
91
|
return value || fallback;
|
|
95
92
|
}
|
|
96
93
|
return '';
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Get the best contrasting background color for a given text color
|
|
101
|
-
* Ensures WCAG AA compliance for accessibility
|
|
102
|
-
*
|
|
103
|
-
* @param textColor - The text color to find a contrasting background for (supports HEX, RGB, RGBA etc.)
|
|
104
|
-
* @param useTokens - Whether to return design tokens instead of raw hex values
|
|
105
|
-
* @returns The best contrasting background color (hex value or design token)
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* ```typescript
|
|
109
|
-
* // Get contrasting color for white text
|
|
110
|
-
* const bgForWhite = getContrastingBackgroundColor('#FFFFFF', false);
|
|
111
|
-
* // Returns: '#42526E' (dark gray)
|
|
112
|
-
*
|
|
113
|
-
* // Get contrasting color for black text with design tokens
|
|
114
|
-
* const bgForBlack = getContrastingBackgroundColor('#000000', true);
|
|
115
|
-
* // Returns: token('elevation.surface', '#FFFFFF')
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
function getContrastingBackgroundColor(textColor) {
|
|
119
|
-
var candidates = ['#FFFFFF',
|
|
120
|
-
// white - surface
|
|
121
|
-
'#172B4D' // dark blue-gray - text color
|
|
122
|
-
];
|
|
123
|
-
|
|
124
|
-
// Extract actual color value if it's a CSS variable
|
|
125
|
-
var tokenVal = getTokenCSSVariableValue(textColor);
|
|
126
|
-
var colorValue = !!tokenVal ? tokenVal : textColor;
|
|
127
|
-
|
|
128
|
-
// Find the color with the highest contrast ratio
|
|
129
|
-
var bestContrast = candidates.sort(function (a, b) {
|
|
130
|
-
return _chromatism.default.difference(b, colorValue) - _chromatism.default.difference(a, colorValue);
|
|
131
|
-
})[0];
|
|
132
|
-
return bestContrast;
|
|
133
|
-
}
|
|
94
|
+
};
|
package/dist/es2019/index.js
CHANGED
|
@@ -75,5 +75,4 @@ export { SyncBlocksIcon } from './ui/icons/SyncBlocksIcon';
|
|
|
75
75
|
export { WorkItemIcon } from './ui/icons/WorkItemIcon';
|
|
76
76
|
export { WorkItemsIcon } from './ui/icons/WorkItemsIcon';
|
|
77
77
|
export { default as ColorPalette } from './ui/ColorPalette';
|
|
78
|
-
export { getContrastingBackgroundColor } from './ui/ColorPalette/utils';
|
|
79
78
|
export { useToolbarUI, ToolbarUIProvider } from './hooks/ui-context';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import chromatism from 'chromatism';
|
|
2
1
|
/**
|
|
3
2
|
* Default number of columns in the color picker
|
|
4
3
|
*/
|
|
@@ -81,38 +80,4 @@ export const getTokenCSSVariableValue = variableExpression => {
|
|
|
81
80
|
return value || fallback;
|
|
82
81
|
}
|
|
83
82
|
return '';
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Get the best contrasting background color for a given text color
|
|
88
|
-
* Ensures WCAG AA compliance for accessibility
|
|
89
|
-
*
|
|
90
|
-
* @param textColor - The text color to find a contrasting background for (supports HEX, RGB, RGBA etc.)
|
|
91
|
-
* @param useTokens - Whether to return design tokens instead of raw hex values
|
|
92
|
-
* @returns The best contrasting background color (hex value or design token)
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
* ```typescript
|
|
96
|
-
* // Get contrasting color for white text
|
|
97
|
-
* const bgForWhite = getContrastingBackgroundColor('#FFFFFF', false);
|
|
98
|
-
* // Returns: '#42526E' (dark gray)
|
|
99
|
-
*
|
|
100
|
-
* // Get contrasting color for black text with design tokens
|
|
101
|
-
* const bgForBlack = getContrastingBackgroundColor('#000000', true);
|
|
102
|
-
* // Returns: token('elevation.surface', '#FFFFFF')
|
|
103
|
-
* ```
|
|
104
|
-
*/
|
|
105
|
-
export function getContrastingBackgroundColor(textColor) {
|
|
106
|
-
const candidates = ['#FFFFFF',
|
|
107
|
-
// white - surface
|
|
108
|
-
'#172B4D' // dark blue-gray - text color
|
|
109
|
-
];
|
|
110
|
-
|
|
111
|
-
// Extract actual color value if it's a CSS variable
|
|
112
|
-
const tokenVal = getTokenCSSVariableValue(textColor);
|
|
113
|
-
const colorValue = !!tokenVal ? tokenVal : textColor;
|
|
114
|
-
|
|
115
|
-
// Find the color with the highest contrast ratio
|
|
116
|
-
const bestContrast = candidates.sort((a, b) => chromatism.difference(b, colorValue) - chromatism.difference(a, colorValue))[0];
|
|
117
|
-
return bestContrast;
|
|
118
|
-
}
|
|
83
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -75,5 +75,4 @@ export { SyncBlocksIcon } from './ui/icons/SyncBlocksIcon';
|
|
|
75
75
|
export { WorkItemIcon } from './ui/icons/WorkItemIcon';
|
|
76
76
|
export { WorkItemsIcon } from './ui/icons/WorkItemsIcon';
|
|
77
77
|
export { default as ColorPalette } from './ui/ColorPalette';
|
|
78
|
-
export { getContrastingBackgroundColor } from './ui/ColorPalette/utils';
|
|
79
78
|
export { useToolbarUI, ToolbarUIProvider } from './hooks/ui-context';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import chromatism from 'chromatism';
|
|
2
1
|
/**
|
|
3
2
|
* Default number of columns in the color picker
|
|
4
3
|
*/
|
|
@@ -82,40 +81,4 @@ export var getTokenCSSVariableValue = function getTokenCSSVariableValue(variable
|
|
|
82
81
|
return value || fallback;
|
|
83
82
|
}
|
|
84
83
|
return '';
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Get the best contrasting background color for a given text color
|
|
89
|
-
* Ensures WCAG AA compliance for accessibility
|
|
90
|
-
*
|
|
91
|
-
* @param textColor - The text color to find a contrasting background for (supports HEX, RGB, RGBA etc.)
|
|
92
|
-
* @param useTokens - Whether to return design tokens instead of raw hex values
|
|
93
|
-
* @returns The best contrasting background color (hex value or design token)
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```typescript
|
|
97
|
-
* // Get contrasting color for white text
|
|
98
|
-
* const bgForWhite = getContrastingBackgroundColor('#FFFFFF', false);
|
|
99
|
-
* // Returns: '#42526E' (dark gray)
|
|
100
|
-
*
|
|
101
|
-
* // Get contrasting color for black text with design tokens
|
|
102
|
-
* const bgForBlack = getContrastingBackgroundColor('#000000', true);
|
|
103
|
-
* // Returns: token('elevation.surface', '#FFFFFF')
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
export function getContrastingBackgroundColor(textColor) {
|
|
107
|
-
var candidates = ['#FFFFFF',
|
|
108
|
-
// white - surface
|
|
109
|
-
'#172B4D' // dark blue-gray - text color
|
|
110
|
-
];
|
|
111
|
-
|
|
112
|
-
// Extract actual color value if it's a CSS variable
|
|
113
|
-
var tokenVal = getTokenCSSVariableValue(textColor);
|
|
114
|
-
var colorValue = !!tokenVal ? tokenVal : textColor;
|
|
115
|
-
|
|
116
|
-
// Find the color with the highest contrast ratio
|
|
117
|
-
var bestContrast = candidates.sort(function (a, b) {
|
|
118
|
-
return chromatism.difference(b, colorValue) - chromatism.difference(a, colorValue);
|
|
119
|
-
})[0];
|
|
120
|
-
return bestContrast;
|
|
121
|
-
}
|
|
84
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -74,6 +74,5 @@ export { SyncBlocksIcon } from './ui/icons/SyncBlocksIcon';
|
|
|
74
74
|
export { WorkItemIcon } from './ui/icons/WorkItemIcon';
|
|
75
75
|
export { WorkItemsIcon } from './ui/icons/WorkItemsIcon';
|
|
76
76
|
export { default as ColorPalette } from './ui/ColorPalette';
|
|
77
|
-
export { getContrastingBackgroundColor } from './ui/ColorPalette/utils';
|
|
78
77
|
export type { IconComponent, ToolbarKeyboardNavigationProviderConfig } from './types';
|
|
79
78
|
export { useToolbarUI, ToolbarUIProvider, type ToolbarUIContextType } from './hooks/ui-context';
|
|
@@ -38,23 +38,3 @@ export declare function getSelectedRowAndColumnFromPalette(palette: PaletteColor
|
|
|
38
38
|
* @returns The resolved color value or empty string if not found
|
|
39
39
|
*/
|
|
40
40
|
export declare const getTokenCSSVariableValue: (variableExpression: string) => string;
|
|
41
|
-
/**
|
|
42
|
-
* Get the best contrasting background color for a given text color
|
|
43
|
-
* Ensures WCAG AA compliance for accessibility
|
|
44
|
-
*
|
|
45
|
-
* @param textColor - The text color to find a contrasting background for (supports HEX, RGB, RGBA etc.)
|
|
46
|
-
* @param useTokens - Whether to return design tokens instead of raw hex values
|
|
47
|
-
* @returns The best contrasting background color (hex value or design token)
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```typescript
|
|
51
|
-
* // Get contrasting color for white text
|
|
52
|
-
* const bgForWhite = getContrastingBackgroundColor('#FFFFFF', false);
|
|
53
|
-
* // Returns: '#42526E' (dark gray)
|
|
54
|
-
*
|
|
55
|
-
* // Get contrasting color for black text with design tokens
|
|
56
|
-
* const bgForBlack = getContrastingBackgroundColor('#000000', true);
|
|
57
|
-
* // Returns: token('elevation.surface', '#FFFFFF')
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export declare function getContrastingBackgroundColor(textColor: string): string;
|
|
@@ -74,6 +74,5 @@ export { SyncBlocksIcon } from './ui/icons/SyncBlocksIcon';
|
|
|
74
74
|
export { WorkItemIcon } from './ui/icons/WorkItemIcon';
|
|
75
75
|
export { WorkItemsIcon } from './ui/icons/WorkItemsIcon';
|
|
76
76
|
export { default as ColorPalette } from './ui/ColorPalette';
|
|
77
|
-
export { getContrastingBackgroundColor } from './ui/ColorPalette/utils';
|
|
78
77
|
export type { IconComponent, ToolbarKeyboardNavigationProviderConfig } from './types';
|
|
79
78
|
export { useToolbarUI, ToolbarUIProvider, type ToolbarUIContextType } from './hooks/ui-context';
|
|
@@ -38,23 +38,3 @@ export declare function getSelectedRowAndColumnFromPalette(palette: PaletteColor
|
|
|
38
38
|
* @returns The resolved color value or empty string if not found
|
|
39
39
|
*/
|
|
40
40
|
export declare const getTokenCSSVariableValue: (variableExpression: string) => string;
|
|
41
|
-
/**
|
|
42
|
-
* Get the best contrasting background color for a given text color
|
|
43
|
-
* Ensures WCAG AA compliance for accessibility
|
|
44
|
-
*
|
|
45
|
-
* @param textColor - The text color to find a contrasting background for (supports HEX, RGB, RGBA etc.)
|
|
46
|
-
* @param useTokens - Whether to return design tokens instead of raw hex values
|
|
47
|
-
* @returns The best contrasting background color (hex value or design token)
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```typescript
|
|
51
|
-
* // Get contrasting color for white text
|
|
52
|
-
* const bgForWhite = getContrastingBackgroundColor('#FFFFFF', false);
|
|
53
|
-
* // Returns: '#42526E' (dark gray)
|
|
54
|
-
*
|
|
55
|
-
* // Get contrasting color for black text with design tokens
|
|
56
|
-
* const bgForBlack = getContrastingBackgroundColor('#000000', true);
|
|
57
|
-
* // Returns: token('elevation.surface', '#FFFFFF')
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export declare function getContrastingBackgroundColor(textColor: string): string;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"registry": "https://registry.npmjs.org/"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.18.
|
|
6
|
+
"version": "0.18.8",
|
|
7
7
|
"description": "Common UI for Toolbars across the platform",
|
|
8
8
|
"atlassian": {
|
|
9
9
|
"team": "Editor: Jenga",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@atlaskit/badge": "^18.3.0",
|
|
25
25
|
"@atlaskit/browser-apis": "^0.0.1",
|
|
26
|
-
"@atlaskit/css": "^0.
|
|
26
|
+
"@atlaskit/css": "^0.19.0",
|
|
27
27
|
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
28
28
|
"@atlaskit/icon": "^29.3.0",
|
|
29
29
|
"@atlaskit/icon-lab": "^5.13.0",
|
|
30
30
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
31
|
-
"@atlaskit/popup": "^4.
|
|
32
|
-
"@atlaskit/primitives": "^
|
|
33
|
-
"@atlaskit/tmp-editor-statsig": "^16.
|
|
34
|
-
"@atlaskit/tokens": "^
|
|
31
|
+
"@atlaskit/popup": "^4.10.0",
|
|
32
|
+
"@atlaskit/primitives": "^17.0.0",
|
|
33
|
+
"@atlaskit/tmp-editor-statsig": "^16.3.0",
|
|
34
|
+
"@atlaskit/tokens": "^9.0.0",
|
|
35
35
|
"@atlaskit/tooltip": "^20.11.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|
|
37
37
|
"@compiled/react": "^0.18.6",
|