@atlaskit/color-picker 3.5.0 → 3.6.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 +16 -0
- package/dist/cjs/components/ColorCard.js +45 -24
- package/dist/cjs/components/ColorPaletteMenu.js +7 -4
- package/dist/cjs/components/ColorPicker.js +7 -3
- package/dist/cjs/components/Trigger.js +18 -5
- package/dist/cjs/components/components.js +8 -8
- package/dist/es2019/components/ColorCard.js +44 -24
- package/dist/es2019/components/ColorPaletteMenu.js +6 -4
- package/dist/es2019/components/ColorPicker.js +6 -3
- package/dist/es2019/components/Trigger.js +17 -5
- package/dist/es2019/components/components.js +9 -9
- package/dist/esm/components/ColorCard.js +45 -24
- package/dist/esm/components/ColorPaletteMenu.js +7 -4
- package/dist/esm/components/ColorPicker.js +7 -3
- package/dist/esm/components/Trigger.js +18 -5
- package/dist/esm/components/components.js +8 -8
- package/dist/types/components/ColorCard.d.ts +2 -1
- package/dist/types/components/ColorPaletteMenu.d.ts +5 -3
- package/dist/types/components/ColorPicker.d.ts +4 -2
- package/dist/types/components/Trigger.d.ts +3 -2
- package/dist/types/types.d.ts +1 -0
- package/dist/types-ts4.5/components/ColorCard.d.ts +2 -1
- package/dist/types-ts4.5/components/ColorPaletteMenu.d.ts +5 -3
- package/dist/types-ts4.5/components/ColorPicker.d.ts +4 -2
- package/dist/types-ts4.5/components/Trigger.d.ts +3 -2
- package/dist/types-ts4.5/types.d.ts +1 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/color-picker
|
|
2
2
|
|
|
3
|
+
## 3.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#169778](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/169778)
|
|
8
|
+
[`0e59b2c7cdc48`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0e59b2c7cdc48) -
|
|
9
|
+
[ux] Added outline variant support for Color picker
|
|
10
|
+
|
|
11
|
+
## 3.5.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#167775](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/167775)
|
|
16
|
+
[`0769cc797ece1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0769cc797ece1) -
|
|
17
|
+
Clean up color picker role fix feature gate
|
|
18
|
+
|
|
3
19
|
## 3.5.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -11,6 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _checkMarkEditorDone = _interopRequireDefault(require("@atlaskit/icon/core/migration/check-mark--editor-done"));
|
|
12
12
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
13
13
|
var _constants = require("../constants");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _react2 = require("@emotion/react");
|
|
15
16
|
var _colors = require("@atlaskit/theme/colors");
|
|
16
17
|
var _useCallbackRef = require("use-callback-ref");
|
|
@@ -38,7 +39,9 @@ var ColorCard = /*#__PURE__*/(0, _react.forwardRef)(function (props, componentRe
|
|
|
38
39
|
checkMarkColor = _props$checkMarkColor === void 0 ? _colors.N0 : _props$checkMarkColor,
|
|
39
40
|
isTabbing = props.isTabbing,
|
|
40
41
|
onClick = props.onClick,
|
|
41
|
-
onKeyDown = props.onKeyDown
|
|
42
|
+
onKeyDown = props.onKeyDown,
|
|
43
|
+
_props$variant = props.variant,
|
|
44
|
+
variant = _props$variant === void 0 ? 'fill' : _props$variant;
|
|
42
45
|
var ref = (0, _react.useRef)(null);
|
|
43
46
|
var isInitialFocus = (0, _react.useRef)(true);
|
|
44
47
|
var isColorPaletteMenu = type === _constants.COLOR_PALETTE_MENU;
|
|
@@ -86,33 +89,44 @@ var ColorCard = /*#__PURE__*/(0, _react.forwardRef)(function (props, componentRe
|
|
|
86
89
|
var role = isColorPaletteMenu ? isInsideMenuRole : 'presentation';
|
|
87
90
|
var ariaChecked = isColorPaletteMenu ? selected : undefined;
|
|
88
91
|
var ariaLabel = isColorPaletteMenu ? label : undefined;
|
|
92
|
+
var isOutlineVariant = (0, _platformFeatureFlags.fg)('thor_colourful_single_select_milestone1_gate') && variant === 'outline';
|
|
93
|
+
var newCheckmarkColor = isOutlineVariant ? "var(--ds-icon, #44546F)" : checkMarkColor;
|
|
89
94
|
return (0, _react2.jsx)(_tooltip.default, {
|
|
90
95
|
content: label
|
|
91
96
|
}, function (tooltipProps) {
|
|
92
97
|
delete tooltipProps['aria-describedby'];
|
|
93
|
-
return (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
98
|
+
return (
|
|
99
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
100
|
+
(0, _react2.jsx)("div", (0, _extends2.default)({}, tooltipProps, {
|
|
101
|
+
ref: initialFocusRef ? (0, _useCallbackRef.mergeRefs)([ref, tooltipProps.ref, initialFocusRef]) : (0, _useCallbackRef.mergeRefs)([ref, tooltipProps.ref]),
|
|
102
|
+
role: role
|
|
103
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
104
|
+
,
|
|
105
|
+
tabIndex: selected ? 0 : -1,
|
|
106
|
+
"aria-checked": ariaChecked,
|
|
107
|
+
"aria-label": ariaLabel,
|
|
108
|
+
css: [sharedColorContainerStyles, (isColorPaletteMenu || isTabbing === undefined || isTabbing) && colorCardOptionTabbingStyles, focused && (isColorPaletteMenu || !isTabbing) && colorCardOptionFocusedStyles],
|
|
109
|
+
onClick: handleClick,
|
|
110
|
+
onMouseDown: handleMouseDown,
|
|
111
|
+
onKeyDown: handleKeyDown
|
|
112
|
+
}), (0, _react2.jsx)("div", {
|
|
113
|
+
css: colorCardWrapperStyles
|
|
114
|
+
}, (0, _react2.jsx)("div", {
|
|
115
|
+
css: isOutlineVariant ? colorCardContentStylesOutline : colorCardContentStyles
|
|
116
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
117
|
+
,
|
|
118
|
+
style: isOutlineVariant ? {
|
|
119
|
+
borderColor: value || 'grey'
|
|
120
|
+
} : {
|
|
121
|
+
backgroundColor: value || 'transparent'
|
|
122
|
+
}
|
|
123
|
+
}, selected && (0, _react2.jsx)(_checkMarkEditorDone.default, {
|
|
124
|
+
color: newCheckmarkColor,
|
|
125
|
+
label: "",
|
|
126
|
+
spacing: "spacious",
|
|
127
|
+
LEGACY_margin: "1px"
|
|
128
|
+
}))))
|
|
129
|
+
);
|
|
116
130
|
});
|
|
117
131
|
});
|
|
118
132
|
var _default = exports.default = ColorCard;
|
|
@@ -152,4 +166,11 @@ var colorCardContentStyles = (0, _react2.css)({
|
|
|
152
166
|
height: "var(--ds-space-300, 24px)",
|
|
153
167
|
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
154
168
|
boxShadow: "inset 0px 0px 0px 1px ".concat("var(--ds-background-inverse-subtle, ".concat(_colors.DN600A, ")"))
|
|
169
|
+
});
|
|
170
|
+
var colorCardContentStylesOutline = (0, _react2.css)({
|
|
171
|
+
width: "var(--ds-space-300, 24px)",
|
|
172
|
+
height: "var(--ds-space-300, 24px)",
|
|
173
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
174
|
+
borderWidth: "var(--ds-border-width-outline, 2px)",
|
|
175
|
+
borderStyle: 'solid'
|
|
155
176
|
});
|
|
@@ -39,7 +39,9 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
39
39
|
cols = _ref$cols === void 0 ? 6 : _ref$cols,
|
|
40
40
|
_ref$mode = _ref.mode,
|
|
41
41
|
mode = _ref$mode === void 0 ? _types.Mode.Standard : _ref$mode,
|
|
42
|
-
initialFocusRef = _ref.initialFocusRef
|
|
42
|
+
initialFocusRef = _ref.initialFocusRef,
|
|
43
|
+
_ref$variant = _ref.variant,
|
|
44
|
+
variant = _ref$variant === void 0 ? 'fill' : _ref$variant;
|
|
43
45
|
var _getOptions = (0, _utils.getOptions)(palette, selectedColor),
|
|
44
46
|
options = _getOptions.options,
|
|
45
47
|
selectedValue = _getOptions.value;
|
|
@@ -61,7 +63,7 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
61
63
|
attributes: {
|
|
62
64
|
componentName: 'color-picker',
|
|
63
65
|
packageName: "@atlaskit/color-picker",
|
|
64
|
-
packageVersion: "3.
|
|
66
|
+
packageVersion: "3.6.0"
|
|
65
67
|
}
|
|
66
68
|
})(createAnalyticsEvent);
|
|
67
69
|
}
|
|
@@ -139,14 +141,15 @@ var ColorPaletteMenuWithoutAnalytics = exports.ColorPaletteMenuWithoutAnalytics
|
|
|
139
141
|
autoFocus: autoFocus,
|
|
140
142
|
initialFocusRef: value === selectedValue.value ? initialFocusRef : undefined,
|
|
141
143
|
isInsideMenu: isInsideMenu,
|
|
142
|
-
onKeyDown: handleKeyDown
|
|
144
|
+
onKeyDown: handleKeyDown,
|
|
145
|
+
variant: variant
|
|
143
146
|
}));
|
|
144
147
|
})));
|
|
145
148
|
};
|
|
146
149
|
var _default = exports.default = (0, _analyticsNext.withAnalyticsContext)({
|
|
147
150
|
componentName: 'color-picker',
|
|
148
151
|
packageName: "@atlaskit/color-picker",
|
|
149
|
-
packageVersion: "3.
|
|
152
|
+
packageVersion: "3.6.0"
|
|
150
153
|
})((0, _analyticsNext.withAnalyticsEvents)()(ColorPaletteMenuWithoutAnalytics));
|
|
151
154
|
var colorCardWrapperStyles = (0, _react2.css)({
|
|
152
155
|
display: 'flex',
|
|
@@ -43,7 +43,7 @@ var defaultPopperProps = {
|
|
|
43
43
|
placement: 'bottom-start'
|
|
44
44
|
};
|
|
45
45
|
var packageName = "@atlaskit/color-picker";
|
|
46
|
-
var packageVersion = "3.
|
|
46
|
+
var packageVersion = "3.6.0";
|
|
47
47
|
var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
48
48
|
(0, _inherits2.default)(ColorPickerWithoutAnalyticsBase, _React$Component);
|
|
49
49
|
var _super = _createSuper(ColorPickerWithoutAnalyticsBase);
|
|
@@ -122,7 +122,9 @@ var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
|
122
122
|
_this$props$showDefau = _this$props.showDefaultSwatchColor,
|
|
123
123
|
showDefaultSwatchColor = _this$props$showDefau === void 0 ? true : _this$props$showDefau,
|
|
124
124
|
isDisabledSelectedSwatch = _this$props.isDisabledSelectedSwatch,
|
|
125
|
-
intl = _this$props.intl
|
|
125
|
+
intl = _this$props.intl,
|
|
126
|
+
_this$props$variant = _this$props.variant,
|
|
127
|
+
variant = _this$props$variant === void 0 ? 'fill' : _this$props$variant;
|
|
126
128
|
var _getOptions = (0, _utils.getOptions)(palette, selectedColor, showDefaultSwatchColor),
|
|
127
129
|
options = _getOptions.options,
|
|
128
130
|
value = _getOptions.value;
|
|
@@ -139,7 +141,8 @@ var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
|
139
141
|
expanded: isOpen,
|
|
140
142
|
swatchSize: selectedColourSwatchSize,
|
|
141
143
|
isDisabled: isDisabledSelectedSwatch,
|
|
142
|
-
id: triggerId
|
|
144
|
+
id: triggerId,
|
|
145
|
+
variant: variant
|
|
143
146
|
})));
|
|
144
147
|
},
|
|
145
148
|
popperProps: popperProps,
|
|
@@ -158,6 +161,7 @@ var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
|
158
161
|
,
|
|
159
162
|
cols: cols,
|
|
160
163
|
checkMarkColor: checkMarkColor,
|
|
164
|
+
variant: variant,
|
|
161
165
|
onKeyDown: this.onKeyDown,
|
|
162
166
|
isTabbing: this.state.isTabbing,
|
|
163
167
|
onOptionKeyDown: this.onOptionKeyDown
|
|
@@ -25,7 +25,9 @@ var ColorCard = function ColorCard(_ref) {
|
|
|
25
25
|
_ref$swatchSize = _ref.swatchSize,
|
|
26
26
|
swatchSize = _ref$swatchSize === void 0 ? 'default' : _ref$swatchSize,
|
|
27
27
|
isDisabled = _ref.isDisabled,
|
|
28
|
-
id = _ref.id
|
|
28
|
+
id = _ref.id,
|
|
29
|
+
_ref$variant = _ref.variant,
|
|
30
|
+
variant = _ref$variant === void 0 ? 'fill' : _ref$variant;
|
|
29
31
|
var handleMouseDown = (0, _react.useCallback)(function (event) {
|
|
30
32
|
event.preventDefault();
|
|
31
33
|
}, []);
|
|
@@ -36,6 +38,12 @@ var ColorCard = function ColorCard(_ref) {
|
|
|
36
38
|
onClick();
|
|
37
39
|
}
|
|
38
40
|
}, [onClick]);
|
|
41
|
+
var isOutlineVariant = (0, _platformFeatureFlags.fg)('thor_colourful_single_select_milestone1_gate') && variant === 'outline';
|
|
42
|
+
var colorCardStyles = isOutlineVariant ? {
|
|
43
|
+
borderColor: value || 'grey'
|
|
44
|
+
} : {
|
|
45
|
+
backgroundColor: value || 'transparent'
|
|
46
|
+
};
|
|
39
47
|
return (0, _react2.jsx)(_tooltip.default, {
|
|
40
48
|
content: label
|
|
41
49
|
}, (0, _react2.jsx)("button", {
|
|
@@ -51,10 +59,10 @@ var ColorCard = function ColorCard(_ref) {
|
|
|
51
59
|
}, (0, _react2.jsx)("span", {
|
|
52
60
|
css: colorCardWrapperStyles
|
|
53
61
|
}, (0, _react2.jsx)("span", {
|
|
54
|
-
css: [colorCardContentStyles, swatchSize === 'small' ? smallColorCardContentSize : defaultColorCardContentSize]
|
|
55
|
-
style
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
css: [isOutlineVariant ? colorCardContentStylesOutline : colorCardContentStyles, swatchSize === 'small' ? smallColorCardContentSize : defaultColorCardContentSize]
|
|
63
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
64
|
+
,
|
|
65
|
+
style: colorCardStyles
|
|
58
66
|
}))));
|
|
59
67
|
};
|
|
60
68
|
var _default = exports.default = ColorCard;
|
|
@@ -106,6 +114,11 @@ var colorCardContentStyles = (0, _react2.css)({
|
|
|
106
114
|
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
107
115
|
boxShadow: "inset 0px 0px 0px 1px ".concat("var(--ds-background-inverse-subtle, ".concat(_colors.DN600A, ")"))
|
|
108
116
|
});
|
|
117
|
+
var colorCardContentStylesOutline = (0, _react2.css)({
|
|
118
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
119
|
+
borderWidth: "var(--ds-border-width-outline, 2px)",
|
|
120
|
+
borderStyle: 'solid'
|
|
121
|
+
});
|
|
109
122
|
var smallColorCardContentSize = (0, _react2.css)({
|
|
110
123
|
width: "var(--ds-space-200, 16px)",
|
|
111
124
|
height: "var(--ds-space-200, 16px)"
|
|
@@ -12,7 +12,6 @@ var _react = require("@emotion/react");
|
|
|
12
12
|
var _constants = require("../constants");
|
|
13
13
|
var _reactIntlNext = require("react-intl-next");
|
|
14
14
|
var _messages = _interopRequireDefault(require("../messages"));
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
/**
|
|
17
16
|
* @jsxRuntime classic
|
|
18
17
|
* @jsx jsx
|
|
@@ -28,7 +27,7 @@ var MenuList = exports.MenuList = function MenuList(props) {
|
|
|
28
27
|
formatMessage = _useIntl.formatMessage;
|
|
29
28
|
return (0, _react.jsx)("div", {
|
|
30
29
|
css: colorPaletteContainerStyles,
|
|
31
|
-
role:
|
|
30
|
+
role: "group",
|
|
32
31
|
"aria-label": formatMessage(_messages.default.menuListAriaLabel),
|
|
33
32
|
style: {
|
|
34
33
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -47,16 +46,16 @@ var Option = exports.Option = function Option(props) {
|
|
|
47
46
|
checkMarkColor = _props$selectProps.checkMarkColor,
|
|
48
47
|
onOptionKeyDown = _props$selectProps.onOptionKeyDown,
|
|
49
48
|
isTabbing = _props$selectProps.isTabbing,
|
|
49
|
+
variant = _props$selectProps.variant,
|
|
50
50
|
isFocused = props.isFocused,
|
|
51
51
|
isSelected = props.isSelected,
|
|
52
52
|
innerProps = props.innerProps;
|
|
53
53
|
return (0, _react.jsx)("div", (0, _extends2.default)({
|
|
54
54
|
css: colorCardWrapperStyles
|
|
55
|
-
}, innerProps,
|
|
56
|
-
role:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}, {
|
|
55
|
+
}, innerProps, {
|
|
56
|
+
role: "radio",
|
|
57
|
+
"aria-checked": isSelected,
|
|
58
|
+
"aria-selected": undefined,
|
|
60
59
|
"aria-label": label
|
|
61
60
|
}), (0, _react.jsx)(_ColorCard.default, {
|
|
62
61
|
type: _constants.COLOR_PICKER,
|
|
@@ -69,7 +68,8 @@ var Option = exports.Option = function Option(props) {
|
|
|
69
68
|
onKeyDown: function onKeyDown(value) {
|
|
70
69
|
return onOptionKeyDown(value);
|
|
71
70
|
},
|
|
72
|
-
isTabbing: isTabbing
|
|
71
|
+
isTabbing: isTabbing,
|
|
72
|
+
variant: variant
|
|
73
73
|
}));
|
|
74
74
|
};
|
|
75
75
|
var DropdownIndicator = exports.DropdownIndicator = function DropdownIndicator() {
|
|
@@ -7,6 +7,7 @@ import React, { useCallback, useRef, useImperativeHandle, forwardRef } from 'rea
|
|
|
7
7
|
import EditorDoneIcon from '@atlaskit/icon/core/migration/check-mark--editor-done';
|
|
8
8
|
import Tooltip from '@atlaskit/tooltip';
|
|
9
9
|
import { COLOR_PALETTE_MENU, KEY_ENTER, KEY_SPACE, KEY_TAB } from '../constants';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
12
|
import { css, jsx } from '@emotion/react';
|
|
12
13
|
import { N0, DN600A, B75 } from '@atlaskit/theme/colors';
|
|
@@ -24,7 +25,8 @@ const ColorCard = /*#__PURE__*/forwardRef((props, componentRef) => {
|
|
|
24
25
|
checkMarkColor = N0,
|
|
25
26
|
isTabbing,
|
|
26
27
|
onClick,
|
|
27
|
-
onKeyDown
|
|
28
|
+
onKeyDown,
|
|
29
|
+
variant = 'fill'
|
|
28
30
|
} = props;
|
|
29
31
|
const ref = useRef(null);
|
|
30
32
|
const isInitialFocus = useRef(true);
|
|
@@ -71,33 +73,44 @@ const ColorCard = /*#__PURE__*/forwardRef((props, componentRef) => {
|
|
|
71
73
|
const role = isColorPaletteMenu ? isInsideMenuRole : 'presentation';
|
|
72
74
|
const ariaChecked = isColorPaletteMenu ? selected : undefined;
|
|
73
75
|
const ariaLabel = isColorPaletteMenu ? label : undefined;
|
|
76
|
+
const isOutlineVariant = fg('thor_colourful_single_select_milestone1_gate') && variant === 'outline';
|
|
77
|
+
const newCheckmarkColor = isOutlineVariant ? "var(--ds-icon, #44546F)" : checkMarkColor;
|
|
74
78
|
return jsx(Tooltip, {
|
|
75
79
|
content: label
|
|
76
80
|
}, tooltipProps => {
|
|
77
81
|
delete tooltipProps['aria-describedby'];
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
82
|
+
return (
|
|
83
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
84
|
+
jsx("div", _extends({}, tooltipProps, {
|
|
85
|
+
ref: initialFocusRef ? mergeRefs([ref, tooltipProps.ref, initialFocusRef]) : mergeRefs([ref, tooltipProps.ref]),
|
|
86
|
+
role: role
|
|
87
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
88
|
+
,
|
|
89
|
+
tabIndex: selected ? 0 : -1,
|
|
90
|
+
"aria-checked": ariaChecked,
|
|
91
|
+
"aria-label": ariaLabel,
|
|
92
|
+
css: [sharedColorContainerStyles, (isColorPaletteMenu || isTabbing === undefined || isTabbing) && colorCardOptionTabbingStyles, focused && (isColorPaletteMenu || !isTabbing) && colorCardOptionFocusedStyles],
|
|
93
|
+
onClick: handleClick,
|
|
94
|
+
onMouseDown: handleMouseDown,
|
|
95
|
+
onKeyDown: handleKeyDown
|
|
96
|
+
}), jsx("div", {
|
|
97
|
+
css: colorCardWrapperStyles
|
|
98
|
+
}, jsx("div", {
|
|
99
|
+
css: isOutlineVariant ? colorCardContentStylesOutline : colorCardContentStyles
|
|
100
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
101
|
+
,
|
|
102
|
+
style: isOutlineVariant ? {
|
|
103
|
+
borderColor: value || 'grey'
|
|
104
|
+
} : {
|
|
105
|
+
backgroundColor: value || 'transparent'
|
|
106
|
+
}
|
|
107
|
+
}, selected && jsx(EditorDoneIcon, {
|
|
108
|
+
color: newCheckmarkColor,
|
|
109
|
+
label: "",
|
|
110
|
+
spacing: "spacious",
|
|
111
|
+
LEGACY_margin: "1px"
|
|
112
|
+
}))))
|
|
113
|
+
);
|
|
101
114
|
});
|
|
102
115
|
});
|
|
103
116
|
export default ColorCard;
|
|
@@ -137,4 +150,11 @@ const colorCardContentStyles = css({
|
|
|
137
150
|
height: "var(--ds-space-300, 24px)",
|
|
138
151
|
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
139
152
|
boxShadow: `inset 0px 0px 0px 1px ${`var(--ds-background-inverse-subtle, ${DN600A})`}`
|
|
153
|
+
});
|
|
154
|
+
const colorCardContentStylesOutline = css({
|
|
155
|
+
width: "var(--ds-space-300, 24px)",
|
|
156
|
+
height: "var(--ds-space-300, 24px)",
|
|
157
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
158
|
+
borderWidth: "var(--ds-border-width-outline, 2px)",
|
|
159
|
+
borderStyle: 'solid'
|
|
140
160
|
});
|
|
@@ -23,7 +23,8 @@ export const ColorPaletteMenuWithoutAnalytics = ({
|
|
|
23
23
|
label = 'Color picker',
|
|
24
24
|
cols = 6,
|
|
25
25
|
mode = Mode.Standard,
|
|
26
|
-
initialFocusRef
|
|
26
|
+
initialFocusRef,
|
|
27
|
+
variant = 'fill'
|
|
27
28
|
}) => {
|
|
28
29
|
const {
|
|
29
30
|
options,
|
|
@@ -43,7 +44,7 @@ export const ColorPaletteMenuWithoutAnalytics = ({
|
|
|
43
44
|
attributes: {
|
|
44
45
|
componentName: 'color-picker',
|
|
45
46
|
packageName: "@atlaskit/color-picker",
|
|
46
|
-
packageVersion: "3.
|
|
47
|
+
packageVersion: "3.6.0"
|
|
47
48
|
}
|
|
48
49
|
})(createAnalyticsEvent);
|
|
49
50
|
}
|
|
@@ -115,13 +116,14 @@ export const ColorPaletteMenuWithoutAnalytics = ({
|
|
|
115
116
|
autoFocus: autoFocus,
|
|
116
117
|
initialFocusRef: value === selectedValue.value ? initialFocusRef : undefined,
|
|
117
118
|
isInsideMenu: isInsideMenu,
|
|
118
|
-
onKeyDown: handleKeyDown
|
|
119
|
+
onKeyDown: handleKeyDown,
|
|
120
|
+
variant: variant
|
|
119
121
|
})))));
|
|
120
122
|
};
|
|
121
123
|
export default withAnalyticsContext({
|
|
122
124
|
componentName: 'color-picker',
|
|
123
125
|
packageName: "@atlaskit/color-picker",
|
|
124
|
-
packageVersion: "3.
|
|
126
|
+
packageVersion: "3.6.0"
|
|
125
127
|
})(withAnalyticsEvents()(ColorPaletteMenuWithoutAnalytics));
|
|
126
128
|
const colorCardWrapperStyles = css({
|
|
127
129
|
display: 'flex',
|
|
@@ -27,7 +27,7 @@ const defaultPopperProps = {
|
|
|
27
27
|
placement: 'bottom-start'
|
|
28
28
|
};
|
|
29
29
|
const packageName = "@atlaskit/color-picker";
|
|
30
|
-
const packageVersion = "3.
|
|
30
|
+
const packageVersion = "3.6.0";
|
|
31
31
|
class ColorPickerWithoutAnalyticsBase extends React.Component {
|
|
32
32
|
constructor(...args) {
|
|
33
33
|
super(...args);
|
|
@@ -95,7 +95,8 @@ class ColorPickerWithoutAnalyticsBase extends React.Component {
|
|
|
95
95
|
selectedColourSwatchSize,
|
|
96
96
|
showDefaultSwatchColor = true,
|
|
97
97
|
isDisabledSelectedSwatch,
|
|
98
|
-
intl
|
|
98
|
+
intl,
|
|
99
|
+
variant = 'fill'
|
|
99
100
|
} = this.props;
|
|
100
101
|
const {
|
|
101
102
|
options,
|
|
@@ -114,7 +115,8 @@ class ColorPickerWithoutAnalyticsBase extends React.Component {
|
|
|
114
115
|
expanded: isOpen,
|
|
115
116
|
swatchSize: selectedColourSwatchSize,
|
|
116
117
|
isDisabled: isDisabledSelectedSwatch,
|
|
117
|
-
id: triggerId
|
|
118
|
+
id: triggerId,
|
|
119
|
+
variant: variant
|
|
118
120
|
}))),
|
|
119
121
|
popperProps: popperProps,
|
|
120
122
|
maxMenuWidth: "auto",
|
|
@@ -132,6 +134,7 @@ class ColorPickerWithoutAnalyticsBase extends React.Component {
|
|
|
132
134
|
,
|
|
133
135
|
cols: cols,
|
|
134
136
|
checkMarkColor: checkMarkColor,
|
|
137
|
+
variant: variant,
|
|
135
138
|
onKeyDown: this.onKeyDown,
|
|
136
139
|
isTabbing: this.state.isTabbing,
|
|
137
140
|
onOptionKeyDown: this.onOptionKeyDown
|
|
@@ -15,7 +15,8 @@ const ColorCard = ({
|
|
|
15
15
|
onClick,
|
|
16
16
|
swatchSize = 'default',
|
|
17
17
|
isDisabled,
|
|
18
|
-
id
|
|
18
|
+
id,
|
|
19
|
+
variant = 'fill'
|
|
19
20
|
}) => {
|
|
20
21
|
const handleMouseDown = useCallback(event => {
|
|
21
22
|
event.preventDefault();
|
|
@@ -27,6 +28,12 @@ const ColorCard = ({
|
|
|
27
28
|
onClick();
|
|
28
29
|
}
|
|
29
30
|
}, [onClick]);
|
|
31
|
+
const isOutlineVariant = fg('thor_colourful_single_select_milestone1_gate') && variant === 'outline';
|
|
32
|
+
const colorCardStyles = isOutlineVariant ? {
|
|
33
|
+
borderColor: value || 'grey'
|
|
34
|
+
} : {
|
|
35
|
+
backgroundColor: value || 'transparent'
|
|
36
|
+
};
|
|
30
37
|
return jsx(Tooltip, {
|
|
31
38
|
content: label
|
|
32
39
|
}, jsx("button", {
|
|
@@ -42,10 +49,10 @@ const ColorCard = ({
|
|
|
42
49
|
}, jsx("span", {
|
|
43
50
|
css: colorCardWrapperStyles
|
|
44
51
|
}, jsx("span", {
|
|
45
|
-
css: [colorCardContentStyles, swatchSize === 'small' ? smallColorCardContentSize : defaultColorCardContentSize]
|
|
46
|
-
style
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
css: [isOutlineVariant ? colorCardContentStylesOutline : colorCardContentStyles, swatchSize === 'small' ? smallColorCardContentSize : defaultColorCardContentSize]
|
|
53
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
54
|
+
,
|
|
55
|
+
style: colorCardStyles
|
|
49
56
|
}))));
|
|
50
57
|
};
|
|
51
58
|
export default ColorCard;
|
|
@@ -97,6 +104,11 @@ const colorCardContentStyles = css({
|
|
|
97
104
|
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
98
105
|
boxShadow: `inset 0px 0px 0px 1px ${`var(--ds-background-inverse-subtle, ${DN600A})`}`
|
|
99
106
|
});
|
|
107
|
+
const colorCardContentStylesOutline = css({
|
|
108
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
109
|
+
borderWidth: "var(--ds-border-width-outline, 2px)",
|
|
110
|
+
borderStyle: 'solid'
|
|
111
|
+
});
|
|
100
112
|
const smallColorCardContentSize = css({
|
|
101
113
|
width: "var(--ds-space-200, 16px)",
|
|
102
114
|
height: "var(--ds-space-200, 16px)"
|
|
@@ -11,7 +11,6 @@ import { css, jsx } from '@emotion/react';
|
|
|
11
11
|
import { COLOR_PICKER } from '../constants';
|
|
12
12
|
import { useIntl } from 'react-intl-next';
|
|
13
13
|
import messages from '../messages';
|
|
14
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
14
|
export const MenuList = props => {
|
|
16
15
|
const {
|
|
17
16
|
//@ts-ignore react-select unsupported props
|
|
@@ -26,7 +25,7 @@ export const MenuList = props => {
|
|
|
26
25
|
} = useIntl();
|
|
27
26
|
return jsx("div", {
|
|
28
27
|
css: colorPaletteContainerStyles,
|
|
29
|
-
role:
|
|
28
|
+
role: "group",
|
|
30
29
|
"aria-label": formatMessage(messages.menuListAriaLabel),
|
|
31
30
|
style: {
|
|
32
31
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -47,7 +46,8 @@ export const Option = props => {
|
|
|
47
46
|
selectProps: {
|
|
48
47
|
checkMarkColor,
|
|
49
48
|
onOptionKeyDown,
|
|
50
|
-
isTabbing
|
|
49
|
+
isTabbing,
|
|
50
|
+
variant
|
|
51
51
|
},
|
|
52
52
|
isFocused,
|
|
53
53
|
isSelected,
|
|
@@ -55,11 +55,10 @@ export const Option = props => {
|
|
|
55
55
|
} = props;
|
|
56
56
|
return jsx("div", _extends({
|
|
57
57
|
css: colorCardWrapperStyles
|
|
58
|
-
}, innerProps,
|
|
59
|
-
role:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, {
|
|
58
|
+
}, innerProps, {
|
|
59
|
+
role: "radio",
|
|
60
|
+
"aria-checked": isSelected,
|
|
61
|
+
"aria-selected": undefined,
|
|
63
62
|
"aria-label": label
|
|
64
63
|
}), jsx(ColorCard, {
|
|
65
64
|
type: COLOR_PICKER,
|
|
@@ -70,7 +69,8 @@ export const Option = props => {
|
|
|
70
69
|
focused: isFocused,
|
|
71
70
|
selected: isSelected,
|
|
72
71
|
onKeyDown: value => onOptionKeyDown(value),
|
|
73
|
-
isTabbing: isTabbing
|
|
72
|
+
isTabbing: isTabbing,
|
|
73
|
+
variant: variant
|
|
74
74
|
}));
|
|
75
75
|
};
|
|
76
76
|
export const DropdownIndicator = () => null;
|
|
@@ -7,6 +7,7 @@ import React, { useCallback, useRef, useImperativeHandle, forwardRef } from 'rea
|
|
|
7
7
|
import EditorDoneIcon from '@atlaskit/icon/core/migration/check-mark--editor-done';
|
|
8
8
|
import Tooltip from '@atlaskit/tooltip';
|
|
9
9
|
import { COLOR_PALETTE_MENU, KEY_ENTER, KEY_SPACE, KEY_TAB } from '../constants';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
12
|
import { css, jsx } from '@emotion/react';
|
|
12
13
|
import { N0, DN600A, B75 } from '@atlaskit/theme/colors';
|
|
@@ -26,7 +27,9 @@ var ColorCard = /*#__PURE__*/forwardRef(function (props, componentRef) {
|
|
|
26
27
|
checkMarkColor = _props$checkMarkColor === void 0 ? N0 : _props$checkMarkColor,
|
|
27
28
|
isTabbing = props.isTabbing,
|
|
28
29
|
onClick = props.onClick,
|
|
29
|
-
onKeyDown = props.onKeyDown
|
|
30
|
+
onKeyDown = props.onKeyDown,
|
|
31
|
+
_props$variant = props.variant,
|
|
32
|
+
variant = _props$variant === void 0 ? 'fill' : _props$variant;
|
|
30
33
|
var ref = useRef(null);
|
|
31
34
|
var isInitialFocus = useRef(true);
|
|
32
35
|
var isColorPaletteMenu = type === COLOR_PALETTE_MENU;
|
|
@@ -74,33 +77,44 @@ var ColorCard = /*#__PURE__*/forwardRef(function (props, componentRef) {
|
|
|
74
77
|
var role = isColorPaletteMenu ? isInsideMenuRole : 'presentation';
|
|
75
78
|
var ariaChecked = isColorPaletteMenu ? selected : undefined;
|
|
76
79
|
var ariaLabel = isColorPaletteMenu ? label : undefined;
|
|
80
|
+
var isOutlineVariant = fg('thor_colourful_single_select_milestone1_gate') && variant === 'outline';
|
|
81
|
+
var newCheckmarkColor = isOutlineVariant ? "var(--ds-icon, #44546F)" : checkMarkColor;
|
|
77
82
|
return jsx(Tooltip, {
|
|
78
83
|
content: label
|
|
79
84
|
}, function (tooltipProps) {
|
|
80
85
|
delete tooltipProps['aria-describedby'];
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
86
|
+
return (
|
|
87
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
88
|
+
jsx("div", _extends({}, tooltipProps, {
|
|
89
|
+
ref: initialFocusRef ? mergeRefs([ref, tooltipProps.ref, initialFocusRef]) : mergeRefs([ref, tooltipProps.ref]),
|
|
90
|
+
role: role
|
|
91
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
92
|
+
,
|
|
93
|
+
tabIndex: selected ? 0 : -1,
|
|
94
|
+
"aria-checked": ariaChecked,
|
|
95
|
+
"aria-label": ariaLabel,
|
|
96
|
+
css: [sharedColorContainerStyles, (isColorPaletteMenu || isTabbing === undefined || isTabbing) && colorCardOptionTabbingStyles, focused && (isColorPaletteMenu || !isTabbing) && colorCardOptionFocusedStyles],
|
|
97
|
+
onClick: handleClick,
|
|
98
|
+
onMouseDown: handleMouseDown,
|
|
99
|
+
onKeyDown: handleKeyDown
|
|
100
|
+
}), jsx("div", {
|
|
101
|
+
css: colorCardWrapperStyles
|
|
102
|
+
}, jsx("div", {
|
|
103
|
+
css: isOutlineVariant ? colorCardContentStylesOutline : colorCardContentStyles
|
|
104
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
105
|
+
,
|
|
106
|
+
style: isOutlineVariant ? {
|
|
107
|
+
borderColor: value || 'grey'
|
|
108
|
+
} : {
|
|
109
|
+
backgroundColor: value || 'transparent'
|
|
110
|
+
}
|
|
111
|
+
}, selected && jsx(EditorDoneIcon, {
|
|
112
|
+
color: newCheckmarkColor,
|
|
113
|
+
label: "",
|
|
114
|
+
spacing: "spacious",
|
|
115
|
+
LEGACY_margin: "1px"
|
|
116
|
+
}))))
|
|
117
|
+
);
|
|
104
118
|
});
|
|
105
119
|
});
|
|
106
120
|
export default ColorCard;
|
|
@@ -140,4 +154,11 @@ var colorCardContentStyles = css({
|
|
|
140
154
|
height: "var(--ds-space-300, 24px)",
|
|
141
155
|
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
142
156
|
boxShadow: "inset 0px 0px 0px 1px ".concat("var(--ds-background-inverse-subtle, ".concat(DN600A, ")"))
|
|
157
|
+
});
|
|
158
|
+
var colorCardContentStylesOutline = css({
|
|
159
|
+
width: "var(--ds-space-300, 24px)",
|
|
160
|
+
height: "var(--ds-space-300, 24px)",
|
|
161
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
162
|
+
borderWidth: "var(--ds-border-width-outline, 2px)",
|
|
163
|
+
borderStyle: 'solid'
|
|
143
164
|
});
|
|
@@ -30,7 +30,9 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
30
30
|
cols = _ref$cols === void 0 ? 6 : _ref$cols,
|
|
31
31
|
_ref$mode = _ref.mode,
|
|
32
32
|
mode = _ref$mode === void 0 ? Mode.Standard : _ref$mode,
|
|
33
|
-
initialFocusRef = _ref.initialFocusRef
|
|
33
|
+
initialFocusRef = _ref.initialFocusRef,
|
|
34
|
+
_ref$variant = _ref.variant,
|
|
35
|
+
variant = _ref$variant === void 0 ? 'fill' : _ref$variant;
|
|
34
36
|
var _getOptions = getOptions(palette, selectedColor),
|
|
35
37
|
options = _getOptions.options,
|
|
36
38
|
selectedValue = _getOptions.value;
|
|
@@ -52,7 +54,7 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
52
54
|
attributes: {
|
|
53
55
|
componentName: 'color-picker',
|
|
54
56
|
packageName: "@atlaskit/color-picker",
|
|
55
|
-
packageVersion: "3.
|
|
57
|
+
packageVersion: "3.6.0"
|
|
56
58
|
}
|
|
57
59
|
})(createAnalyticsEvent);
|
|
58
60
|
}
|
|
@@ -130,14 +132,15 @@ export var ColorPaletteMenuWithoutAnalytics = function ColorPaletteMenuWithoutAn
|
|
|
130
132
|
autoFocus: autoFocus,
|
|
131
133
|
initialFocusRef: value === selectedValue.value ? initialFocusRef : undefined,
|
|
132
134
|
isInsideMenu: isInsideMenu,
|
|
133
|
-
onKeyDown: handleKeyDown
|
|
135
|
+
onKeyDown: handleKeyDown,
|
|
136
|
+
variant: variant
|
|
134
137
|
}));
|
|
135
138
|
})));
|
|
136
139
|
};
|
|
137
140
|
export default withAnalyticsContext({
|
|
138
141
|
componentName: 'color-picker',
|
|
139
142
|
packageName: "@atlaskit/color-picker",
|
|
140
|
-
packageVersion: "3.
|
|
143
|
+
packageVersion: "3.6.0"
|
|
141
144
|
})(withAnalyticsEvents()(ColorPaletteMenuWithoutAnalytics));
|
|
142
145
|
var colorCardWrapperStyles = css({
|
|
143
146
|
display: 'flex',
|
|
@@ -35,7 +35,7 @@ var defaultPopperProps = {
|
|
|
35
35
|
placement: 'bottom-start'
|
|
36
36
|
};
|
|
37
37
|
var packageName = "@atlaskit/color-picker";
|
|
38
|
-
var packageVersion = "3.
|
|
38
|
+
var packageVersion = "3.6.0";
|
|
39
39
|
var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
40
40
|
_inherits(ColorPickerWithoutAnalyticsBase, _React$Component);
|
|
41
41
|
var _super = _createSuper(ColorPickerWithoutAnalyticsBase);
|
|
@@ -114,7 +114,9 @@ var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
|
114
114
|
_this$props$showDefau = _this$props.showDefaultSwatchColor,
|
|
115
115
|
showDefaultSwatchColor = _this$props$showDefau === void 0 ? true : _this$props$showDefau,
|
|
116
116
|
isDisabledSelectedSwatch = _this$props.isDisabledSelectedSwatch,
|
|
117
|
-
intl = _this$props.intl
|
|
117
|
+
intl = _this$props.intl,
|
|
118
|
+
_this$props$variant = _this$props.variant,
|
|
119
|
+
variant = _this$props$variant === void 0 ? 'fill' : _this$props$variant;
|
|
118
120
|
var _getOptions = getOptions(palette, selectedColor, showDefaultSwatchColor),
|
|
119
121
|
options = _getOptions.options,
|
|
120
122
|
value = _getOptions.value;
|
|
@@ -131,7 +133,8 @@ var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
|
131
133
|
expanded: isOpen,
|
|
132
134
|
swatchSize: selectedColourSwatchSize,
|
|
133
135
|
isDisabled: isDisabledSelectedSwatch,
|
|
134
|
-
id: triggerId
|
|
136
|
+
id: triggerId,
|
|
137
|
+
variant: variant
|
|
135
138
|
})));
|
|
136
139
|
},
|
|
137
140
|
popperProps: popperProps,
|
|
@@ -150,6 +153,7 @@ var ColorPickerWithoutAnalyticsBase = /*#__PURE__*/function (_React$Component) {
|
|
|
150
153
|
,
|
|
151
154
|
cols: cols,
|
|
152
155
|
checkMarkColor: checkMarkColor,
|
|
156
|
+
variant: variant,
|
|
153
157
|
onKeyDown: this.onKeyDown,
|
|
154
158
|
isTabbing: this.state.isTabbing,
|
|
155
159
|
onOptionKeyDown: this.onOptionKeyDown
|
|
@@ -16,7 +16,9 @@ var ColorCard = function ColorCard(_ref) {
|
|
|
16
16
|
_ref$swatchSize = _ref.swatchSize,
|
|
17
17
|
swatchSize = _ref$swatchSize === void 0 ? 'default' : _ref$swatchSize,
|
|
18
18
|
isDisabled = _ref.isDisabled,
|
|
19
|
-
id = _ref.id
|
|
19
|
+
id = _ref.id,
|
|
20
|
+
_ref$variant = _ref.variant,
|
|
21
|
+
variant = _ref$variant === void 0 ? 'fill' : _ref$variant;
|
|
20
22
|
var handleMouseDown = useCallback(function (event) {
|
|
21
23
|
event.preventDefault();
|
|
22
24
|
}, []);
|
|
@@ -27,6 +29,12 @@ var ColorCard = function ColorCard(_ref) {
|
|
|
27
29
|
onClick();
|
|
28
30
|
}
|
|
29
31
|
}, [onClick]);
|
|
32
|
+
var isOutlineVariant = fg('thor_colourful_single_select_milestone1_gate') && variant === 'outline';
|
|
33
|
+
var colorCardStyles = isOutlineVariant ? {
|
|
34
|
+
borderColor: value || 'grey'
|
|
35
|
+
} : {
|
|
36
|
+
backgroundColor: value || 'transparent'
|
|
37
|
+
};
|
|
30
38
|
return jsx(Tooltip, {
|
|
31
39
|
content: label
|
|
32
40
|
}, jsx("button", {
|
|
@@ -42,10 +50,10 @@ var ColorCard = function ColorCard(_ref) {
|
|
|
42
50
|
}, jsx("span", {
|
|
43
51
|
css: colorCardWrapperStyles
|
|
44
52
|
}, jsx("span", {
|
|
45
|
-
css: [colorCardContentStyles, swatchSize === 'small' ? smallColorCardContentSize : defaultColorCardContentSize]
|
|
46
|
-
style
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
css: [isOutlineVariant ? colorCardContentStylesOutline : colorCardContentStyles, swatchSize === 'small' ? smallColorCardContentSize : defaultColorCardContentSize]
|
|
54
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
55
|
+
,
|
|
56
|
+
style: colorCardStyles
|
|
49
57
|
}))));
|
|
50
58
|
};
|
|
51
59
|
export default ColorCard;
|
|
@@ -97,6 +105,11 @@ var colorCardContentStyles = css({
|
|
|
97
105
|
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
98
106
|
boxShadow: "inset 0px 0px 0px 1px ".concat("var(--ds-background-inverse-subtle, ".concat(DN600A, ")"))
|
|
99
107
|
});
|
|
108
|
+
var colorCardContentStylesOutline = css({
|
|
109
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
110
|
+
borderWidth: "var(--ds-border-width-outline, 2px)",
|
|
111
|
+
borderStyle: 'solid'
|
|
112
|
+
});
|
|
100
113
|
var smallColorCardContentSize = css({
|
|
101
114
|
width: "var(--ds-space-200, 16px)",
|
|
102
115
|
height: "var(--ds-space-200, 16px)"
|
|
@@ -11,7 +11,6 @@ import { css, jsx } from '@emotion/react';
|
|
|
11
11
|
import { COLOR_PICKER } from '../constants';
|
|
12
12
|
import { useIntl } from 'react-intl-next';
|
|
13
13
|
import messages from '../messages';
|
|
14
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
14
|
export var MenuList = function MenuList(props) {
|
|
16
15
|
var cols = props.selectProps.cols,
|
|
17
16
|
innerRef = props.innerRef,
|
|
@@ -20,7 +19,7 @@ export var MenuList = function MenuList(props) {
|
|
|
20
19
|
formatMessage = _useIntl.formatMessage;
|
|
21
20
|
return jsx("div", {
|
|
22
21
|
css: colorPaletteContainerStyles,
|
|
23
|
-
role:
|
|
22
|
+
role: "group",
|
|
24
23
|
"aria-label": formatMessage(messages.menuListAriaLabel),
|
|
25
24
|
style: {
|
|
26
25
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -39,16 +38,16 @@ export var Option = function Option(props) {
|
|
|
39
38
|
checkMarkColor = _props$selectProps.checkMarkColor,
|
|
40
39
|
onOptionKeyDown = _props$selectProps.onOptionKeyDown,
|
|
41
40
|
isTabbing = _props$selectProps.isTabbing,
|
|
41
|
+
variant = _props$selectProps.variant,
|
|
42
42
|
isFocused = props.isFocused,
|
|
43
43
|
isSelected = props.isSelected,
|
|
44
44
|
innerProps = props.innerProps;
|
|
45
45
|
return jsx("div", _extends({
|
|
46
46
|
css: colorCardWrapperStyles
|
|
47
|
-
}, innerProps,
|
|
48
|
-
role:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, {
|
|
47
|
+
}, innerProps, {
|
|
48
|
+
role: "radio",
|
|
49
|
+
"aria-checked": isSelected,
|
|
50
|
+
"aria-selected": undefined,
|
|
52
51
|
"aria-label": label
|
|
53
52
|
}), jsx(ColorCard, {
|
|
54
53
|
type: COLOR_PICKER,
|
|
@@ -61,7 +60,8 @@ export var Option = function Option(props) {
|
|
|
61
60
|
onKeyDown: function onKeyDown(value) {
|
|
62
61
|
return onOptionKeyDown(value);
|
|
63
62
|
},
|
|
64
|
-
isTabbing: isTabbing
|
|
63
|
+
isTabbing: isTabbing,
|
|
64
|
+
variant: variant
|
|
65
65
|
}));
|
|
66
66
|
};
|
|
67
67
|
export var DropdownIndicator = function DropdownIndicator() {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import React, { type KeyboardEventHandler, type Ref } from 'react';
|
|
6
|
-
import type { ColorCardType } from '../types';
|
|
6
|
+
import type { ColorCardType, ColorCardVariant } from '../types';
|
|
7
7
|
export interface Props {
|
|
8
8
|
autoFocus?: boolean;
|
|
9
9
|
initialFocusRef?: Ref<HTMLDivElement>;
|
|
@@ -18,6 +18,7 @@ export interface Props {
|
|
|
18
18
|
focused?: boolean;
|
|
19
19
|
isOption?: boolean;
|
|
20
20
|
isTabbing?: boolean;
|
|
21
|
+
variant?: ColorCardVariant;
|
|
21
22
|
}
|
|
22
23
|
export type ColorCardRef = {
|
|
23
24
|
focus: () => void;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { type KeyboardEvent, type MouseEvent, type Ref } from 'react';
|
|
6
|
-
import { Mode, type Palette } from '../types';
|
|
6
|
+
import { Mode, type Palette, type ColorCardVariant } from '../types';
|
|
7
7
|
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
9
|
export type Props = {
|
|
@@ -31,7 +31,9 @@ export type Props = {
|
|
|
31
31
|
mode?: Mode;
|
|
32
32
|
/** the ref object (usually the currently selected color palette) that consumer can leverage to focus on load */
|
|
33
33
|
initialFocusRef?: Ref<HTMLDivElement>;
|
|
34
|
+
/** Variant of color card */
|
|
35
|
+
variant?: ColorCardVariant;
|
|
34
36
|
};
|
|
35
|
-
export declare const ColorPaletteMenuWithoutAnalytics: ({ autoFocus, isFocusLockEnabled, isInsideMenu, createAnalyticsEvent, onChange, palette, selectedColor, checkMarkColor, label, cols, mode, initialFocusRef, }: Props) => jsx.JSX.Element;
|
|
36
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "analyticsContext" | "key" | "autoFocus" | "onChange" | "initialFocusRef" | "isInsideMenu" | "checkMarkColor" | "cols" | "palette" | "selectedColor" | "isFocusLockEnabled" | "mode"> & import("react").RefAttributes<any>>;
|
|
37
|
+
export declare const ColorPaletteMenuWithoutAnalytics: ({ autoFocus, isFocusLockEnabled, isInsideMenu, createAnalyticsEvent, onChange, palette, selectedColor, checkMarkColor, label, cols, mode, initialFocusRef, variant, }: Props) => jsx.JSX.Element;
|
|
38
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "variant" | "analyticsContext" | "key" | "autoFocus" | "onChange" | "initialFocusRef" | "isInsideMenu" | "checkMarkColor" | "cols" | "palette" | "selectedColor" | "isFocusLockEnabled" | "mode"> & import("react").RefAttributes<any>>;
|
|
37
39
|
export default _default;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { type PopupSelectProps } from '@atlaskit/select';
|
|
7
|
-
import { type Palette, type SwatchSize } from '../types';
|
|
7
|
+
import { type Palette, type SwatchSize, type ColorCardVariant } from '../types';
|
|
8
8
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
9
9
|
export interface Props {
|
|
10
10
|
/** color picker button label */
|
|
@@ -33,11 +33,13 @@ export interface Props {
|
|
|
33
33
|
isDisabledSelectedSwatch?: boolean;
|
|
34
34
|
/** onMenuOpen handler */
|
|
35
35
|
onMenuOpen?: () => void;
|
|
36
|
+
/** Display filled or outline variant of the color */
|
|
37
|
+
variant?: ColorCardVariant;
|
|
36
38
|
}
|
|
37
39
|
export declare const ColorPickerWithoutAnalytics: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
|
|
38
40
|
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
39
41
|
};
|
|
40
42
|
declare const _default: React.ForwardRefExoticComponent<Pick<Omit<Omit<Props & WrappedComponentProps, "intl"> & {
|
|
41
43
|
forwardedRef?: React.Ref<any> | undefined;
|
|
42
|
-
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "analyticsContext" | "key" | "onChange" | "checkMarkColor" | "cols" | "popperProps" | "onMenuOpen" | "palette" | "triggerId" | "selectedColor" | "selectedColourSwatchSize" | "showDefaultSwatchColor" | "isDisabledSelectedSwatch" | "forwardedRef"> & React.RefAttributes<any>>;
|
|
44
|
+
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "variant" | "analyticsContext" | "key" | "onChange" | "checkMarkColor" | "cols" | "popperProps" | "onMenuOpen" | "palette" | "triggerId" | "selectedColor" | "selectedColourSwatchSize" | "showDefaultSwatchColor" | "isDisabledSelectedSwatch" | "forwardedRef"> & React.RefAttributes<any>>;
|
|
43
45
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import { type SwatchSize } from '../types';
|
|
2
|
+
import { type SwatchSize, type ColorCardVariant } from '../types';
|
|
3
3
|
export interface Props {
|
|
4
4
|
value: string;
|
|
5
5
|
label?: string;
|
|
@@ -8,6 +8,7 @@ export interface Props {
|
|
|
8
8
|
swatchSize?: SwatchSize;
|
|
9
9
|
isDisabled?: boolean;
|
|
10
10
|
id?: string;
|
|
11
|
+
variant?: ColorCardVariant;
|
|
11
12
|
}
|
|
12
|
-
declare const ColorCard: ({ value, label, expanded, onClick, swatchSize, isDisabled, id, }: Props) => jsx.JSX.Element;
|
|
13
|
+
declare const ColorCard: ({ value, label, expanded, onClick, swatchSize, isDisabled, id, variant, }: Props) => jsx.JSX.Element;
|
|
13
14
|
export default ColorCard;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import React, { type KeyboardEventHandler, type Ref } from 'react';
|
|
6
|
-
import type { ColorCardType } from '../types';
|
|
6
|
+
import type { ColorCardType, ColorCardVariant } from '../types';
|
|
7
7
|
export interface Props {
|
|
8
8
|
autoFocus?: boolean;
|
|
9
9
|
initialFocusRef?: Ref<HTMLDivElement>;
|
|
@@ -18,6 +18,7 @@ export interface Props {
|
|
|
18
18
|
focused?: boolean;
|
|
19
19
|
isOption?: boolean;
|
|
20
20
|
isTabbing?: boolean;
|
|
21
|
+
variant?: ColorCardVariant;
|
|
21
22
|
}
|
|
22
23
|
export type ColorCardRef = {
|
|
23
24
|
focus: () => void;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { type KeyboardEvent, type MouseEvent, type Ref } from 'react';
|
|
6
|
-
import { Mode, type Palette } from '../types';
|
|
6
|
+
import { Mode, type Palette, type ColorCardVariant } from '../types';
|
|
7
7
|
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
9
|
export type Props = {
|
|
@@ -31,7 +31,9 @@ export type Props = {
|
|
|
31
31
|
mode?: Mode;
|
|
32
32
|
/** the ref object (usually the currently selected color palette) that consumer can leverage to focus on load */
|
|
33
33
|
initialFocusRef?: Ref<HTMLDivElement>;
|
|
34
|
+
/** Variant of color card */
|
|
35
|
+
variant?: ColorCardVariant;
|
|
34
36
|
};
|
|
35
|
-
export declare const ColorPaletteMenuWithoutAnalytics: ({ autoFocus, isFocusLockEnabled, isInsideMenu, createAnalyticsEvent, onChange, palette, selectedColor, checkMarkColor, label, cols, mode, initialFocusRef, }: Props) => jsx.JSX.Element;
|
|
36
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "analyticsContext" | "key" | "autoFocus" | "onChange" | "initialFocusRef" | "isInsideMenu" | "checkMarkColor" | "cols" | "palette" | "selectedColor" | "isFocusLockEnabled" | "mode"> & import("react").RefAttributes<any>>;
|
|
37
|
+
export declare const ColorPaletteMenuWithoutAnalytics: ({ autoFocus, isFocusLockEnabled, isInsideMenu, createAnalyticsEvent, onChange, palette, selectedColor, checkMarkColor, label, cols, mode, initialFocusRef, variant, }: Props) => jsx.JSX.Element;
|
|
38
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "variant" | "analyticsContext" | "key" | "autoFocus" | "onChange" | "initialFocusRef" | "isInsideMenu" | "checkMarkColor" | "cols" | "palette" | "selectedColor" | "isFocusLockEnabled" | "mode"> & import("react").RefAttributes<any>>;
|
|
37
39
|
export default _default;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { type PopupSelectProps } from '@atlaskit/select';
|
|
7
|
-
import { type Palette, type SwatchSize } from '../types';
|
|
7
|
+
import { type Palette, type SwatchSize, type ColorCardVariant } from '../types';
|
|
8
8
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
9
9
|
export interface Props {
|
|
10
10
|
/** color picker button label */
|
|
@@ -33,11 +33,13 @@ export interface Props {
|
|
|
33
33
|
isDisabledSelectedSwatch?: boolean;
|
|
34
34
|
/** onMenuOpen handler */
|
|
35
35
|
onMenuOpen?: () => void;
|
|
36
|
+
/** Display filled or outline variant of the color */
|
|
37
|
+
variant?: ColorCardVariant;
|
|
36
38
|
}
|
|
37
39
|
export declare const ColorPickerWithoutAnalytics: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
|
|
38
40
|
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
39
41
|
};
|
|
40
42
|
declare const _default: React.ForwardRefExoticComponent<Pick<Omit<Omit<Props & WrappedComponentProps, "intl"> & {
|
|
41
43
|
forwardedRef?: React.Ref<any> | undefined;
|
|
42
|
-
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "analyticsContext" | "key" | "onChange" | "checkMarkColor" | "cols" | "popperProps" | "onMenuOpen" | "palette" | "triggerId" | "selectedColor" | "selectedColourSwatchSize" | "showDefaultSwatchColor" | "isDisabledSelectedSwatch" | "forwardedRef"> & React.RefAttributes<any>>;
|
|
44
|
+
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "variant" | "analyticsContext" | "key" | "onChange" | "checkMarkColor" | "cols" | "popperProps" | "onMenuOpen" | "palette" | "triggerId" | "selectedColor" | "selectedColourSwatchSize" | "showDefaultSwatchColor" | "isDisabledSelectedSwatch" | "forwardedRef"> & React.RefAttributes<any>>;
|
|
43
45
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import { type SwatchSize } from '../types';
|
|
2
|
+
import { type SwatchSize, type ColorCardVariant } from '../types';
|
|
3
3
|
export interface Props {
|
|
4
4
|
value: string;
|
|
5
5
|
label?: string;
|
|
@@ -8,6 +8,7 @@ export interface Props {
|
|
|
8
8
|
swatchSize?: SwatchSize;
|
|
9
9
|
isDisabled?: boolean;
|
|
10
10
|
id?: string;
|
|
11
|
+
variant?: ColorCardVariant;
|
|
11
12
|
}
|
|
12
|
-
declare const ColorCard: ({ value, label, expanded, onClick, swatchSize, isDisabled, id, }: Props) => jsx.JSX.Element;
|
|
13
|
+
declare const ColorCard: ({ value, label, expanded, onClick, swatchSize, isDisabled, id, variant, }: Props) => jsx.JSX.Element;
|
|
13
14
|
export default ColorCard;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/color-picker",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Jira Color Picker Component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
33
|
-
"@atlaskit/icon": "^22.
|
|
33
|
+
"@atlaskit/icon": "^22.26.0",
|
|
34
34
|
"@atlaskit/platform-feature-flags": "0.3.0",
|
|
35
|
-
"@atlaskit/select": "^18.
|
|
35
|
+
"@atlaskit/select": "^18.6.0",
|
|
36
36
|
"@atlaskit/theme": "^14.0.0",
|
|
37
37
|
"@atlaskit/tokens": "^2.3.0",
|
|
38
38
|
"@atlaskit/tooltip": "^18.9.0",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"platform-design-system-dsp-20821-color-pickr-focus": {
|
|
80
80
|
"type": "boolean"
|
|
81
81
|
},
|
|
82
|
-
"
|
|
82
|
+
"thor_colourful_single_select_milestone1_gate": {
|
|
83
83
|
"type": "boolean"
|
|
84
84
|
},
|
|
85
85
|
"one_event_rules_them_all_fg": {
|