@atlaskit/color-picker 1.3.1 → 3.0.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 +18 -0
- package/dist/cjs/components/ColorCard.js +14 -6
- package/dist/cjs/components/ColorPicker.js +28 -4
- package/dist/cjs/components/components.js +9 -2
- package/dist/cjs/constants.js +8 -2
- package/dist/cjs/styled/ColorCard.js +21 -10
- package/dist/cjs/styled/ColorPalette.js +4 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/ColorCard.js +16 -7
- package/dist/es2019/components/ColorPicker.js +30 -4
- package/dist/es2019/components/components.js +6 -2
- package/dist/es2019/constants.js +4 -1
- package/dist/es2019/styled/ColorCard.js +22 -10
- package/dist/es2019/styled/ColorPalette.js +3 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/ColorCard.js +15 -7
- package/dist/esm/components/ColorPicker.js +30 -4
- package/dist/esm/components/components.js +9 -2
- package/dist/esm/constants.js +4 -1
- package/dist/esm/styled/ColorCard.js +16 -8
- package/dist/esm/styled/ColorPalette.js +3 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/components/ColorCard.d.ts +1 -0
- package/dist/types/components/ColorPicker.d.ts +6 -1
- package/dist/types/constants.d.ts +3 -0
- package/dist/types/styled/ColorCard.d.ts +2 -0
- package/package.json +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/color-picker
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`b1f4bf97543`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b1f4bf97543) - [ux] Fixes bug with tabbing
|
|
8
|
+
|
|
9
|
+
## 2.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 2.0.0
|
|
16
|
+
|
|
17
|
+
### Major Changes
|
|
18
|
+
|
|
19
|
+
- [`80b9cc64aa2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/80b9cc64aa2) - [ux] Added tokens to color-picker
|
|
20
|
+
|
|
3
21
|
## 1.3.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -73,10 +73,16 @@ var ColorCard = /*#__PURE__*/function (_PureComponent) {
|
|
|
73
73
|
var key = event.key;
|
|
74
74
|
var _this$props2 = _this.props,
|
|
75
75
|
onKeyDown = _this$props2.onKeyDown,
|
|
76
|
-
value = _this$props2.value
|
|
76
|
+
value = _this$props2.value,
|
|
77
|
+
isTabbing = _this$props2.isTabbing;
|
|
77
78
|
|
|
78
|
-
if (onKeyDown && (key === _constants.KEY_ENTER || key === _constants.KEY_SPACE)) {
|
|
79
|
+
if ((isTabbing === undefined || isTabbing) && onKeyDown && (key === _constants.KEY_ENTER || key === _constants.KEY_SPACE)) {
|
|
79
80
|
event.preventDefault();
|
|
81
|
+
|
|
82
|
+
if (isTabbing) {
|
|
83
|
+
event.stopPropagation();
|
|
84
|
+
}
|
|
85
|
+
|
|
80
86
|
onKeyDown(value);
|
|
81
87
|
}
|
|
82
88
|
});
|
|
@@ -93,20 +99,22 @@ var ColorCard = /*#__PURE__*/function (_PureComponent) {
|
|
|
93
99
|
selected = _this$props3.selected,
|
|
94
100
|
focused = _this$props3.focused,
|
|
95
101
|
_this$props3$checkMar = _this$props3.checkMarkColor,
|
|
96
|
-
checkMarkColor = _this$props3$checkMar === void 0 ? _theme.colors.N0 : _this$props3$checkMar
|
|
102
|
+
checkMarkColor = _this$props3$checkMar === void 0 ? _theme.colors.N0 : _this$props3$checkMar,
|
|
103
|
+
isTabbing = _this$props3.isTabbing;
|
|
97
104
|
return /*#__PURE__*/_react.default.createElement(_ColorCard.ColorCardOption, {
|
|
98
105
|
onClick: this.onClick,
|
|
99
106
|
onMouseDown: this.onMouseDown,
|
|
100
107
|
focused: focused,
|
|
101
108
|
"aria-label": "".concat(label).concat(selected ? ' selected' : ''),
|
|
102
109
|
tabIndex: 0,
|
|
103
|
-
onKeyDown: this.onKeyDown
|
|
110
|
+
onKeyDown: this.onKeyDown,
|
|
111
|
+
isTabbing: isTabbing
|
|
104
112
|
}, /*#__PURE__*/_react.default.createElement(_ColorCard.ColorCardContent, {
|
|
105
113
|
color: value || 'transparent'
|
|
106
|
-
}, selected && /*#__PURE__*/_react.default.createElement(_done.default, {
|
|
114
|
+
}, selected && /*#__PURE__*/_react.default.createElement(_ColorCard.ColorCardContentCheckMark, null, /*#__PURE__*/_react.default.createElement(_done.default, {
|
|
107
115
|
primaryColor: checkMarkColor,
|
|
108
116
|
label: ""
|
|
109
|
-
})));
|
|
117
|
+
}))));
|
|
110
118
|
}
|
|
111
119
|
}]);
|
|
112
120
|
return ColorCard;
|
|
@@ -33,6 +33,8 @@ var _Trigger = _interopRequireDefault(require("./Trigger"));
|
|
|
33
33
|
|
|
34
34
|
var components = _interopRequireWildcard(require("./components"));
|
|
35
35
|
|
|
36
|
+
var _constants = require("../constants");
|
|
37
|
+
|
|
36
38
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
37
39
|
|
|
38
40
|
var _ColorPicker = require("../styled/ColorPicker");
|
|
@@ -58,7 +60,7 @@ var defaultPopperProps = {
|
|
|
58
60
|
placement: 'bottom-start'
|
|
59
61
|
};
|
|
60
62
|
var packageName = "@atlaskit/color-picker";
|
|
61
|
-
var packageVersion = "
|
|
63
|
+
var packageVersion = "3.0.0";
|
|
62
64
|
|
|
63
65
|
var ColorPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
64
66
|
(0, _inherits2.default)(ColorPickerWithoutAnalytics, _React$Component);
|
|
@@ -76,6 +78,9 @@ var ColorPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
76
78
|
|
|
77
79
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
78
80
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createAndFireEventOnAtlaskit", (0, _analyticsNext.createAndFireEvent)('atlaskit'));
|
|
81
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
82
|
+
isTabbing: false
|
|
83
|
+
});
|
|
79
84
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "changeAnalyticsCaller", function () {
|
|
80
85
|
var createAnalyticsEvent = _this.props.createAnalyticsEvent;
|
|
81
86
|
|
|
@@ -93,9 +98,25 @@ var ColorPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
93
98
|
|
|
94
99
|
return undefined;
|
|
95
100
|
});
|
|
96
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
101
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onChangeSelect", function (option) {
|
|
97
102
|
_this.props.onChange(option.value, _this.changeAnalyticsCaller());
|
|
98
103
|
});
|
|
104
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onOptionKeyDown", function (value) {
|
|
105
|
+
_this.props.onChange(value, _this.changeAnalyticsCaller());
|
|
106
|
+
});
|
|
107
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onKeyDown", function (e) {
|
|
108
|
+
var key = e.key;
|
|
109
|
+
|
|
110
|
+
if (key === _constants.KEY_TAB) {
|
|
111
|
+
_this.setState({
|
|
112
|
+
isTabbing: true
|
|
113
|
+
});
|
|
114
|
+
} else if (key === _constants.KEY_ARROW_UP || key === _constants.KEY_ARROW_DOWN) {
|
|
115
|
+
_this.setState({
|
|
116
|
+
isTabbing: false
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
99
120
|
return _this;
|
|
100
121
|
}
|
|
101
122
|
|
|
@@ -135,12 +156,15 @@ var ColorPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
135
156
|
"aria-label": fullLabel,
|
|
136
157
|
value: value,
|
|
137
158
|
components: components,
|
|
138
|
-
onChange: this.
|
|
159
|
+
onChange: this.onChangeSelect // never show search input
|
|
139
160
|
,
|
|
140
161
|
searchThreshold: Number.MAX_VALUE // palette props
|
|
141
162
|
,
|
|
142
163
|
cols: cols,
|
|
143
|
-
checkMarkColor: checkMarkColor
|
|
164
|
+
checkMarkColor: checkMarkColor,
|
|
165
|
+
onKeyDown: this.onKeyDown,
|
|
166
|
+
isTabbing: this.state.isTabbing,
|
|
167
|
+
onOptionKeyDown: this.onOptionKeyDown
|
|
144
168
|
});
|
|
145
169
|
}
|
|
146
170
|
}]);
|
|
@@ -41,7 +41,10 @@ var Option = function Option(props) {
|
|
|
41
41
|
var _props$data = props.data,
|
|
42
42
|
value = _props$data.value,
|
|
43
43
|
label = _props$data.label,
|
|
44
|
-
|
|
44
|
+
_props$selectProps = props.selectProps,
|
|
45
|
+
checkMarkColor = _props$selectProps.checkMarkColor,
|
|
46
|
+
onOptionKeyDown = _props$selectProps.onOptionKeyDown,
|
|
47
|
+
isTabbing = _props$selectProps.isTabbing,
|
|
45
48
|
isFocused = props.isFocused,
|
|
46
49
|
isSelected = props.isSelected;
|
|
47
50
|
return /*#__PURE__*/_react.default.createElement(_ColorPalette.ColorCardWrapper, props.innerProps, /*#__PURE__*/_react.default.createElement(_ColorCard.default, {
|
|
@@ -50,7 +53,11 @@ var Option = function Option(props) {
|
|
|
50
53
|
checkMarkColor: checkMarkColor,
|
|
51
54
|
isOption: true,
|
|
52
55
|
focused: isFocused,
|
|
53
|
-
selected: isSelected
|
|
56
|
+
selected: isSelected,
|
|
57
|
+
onKeyDown: function onKeyDown(value) {
|
|
58
|
+
return onOptionKeyDown(value);
|
|
59
|
+
},
|
|
60
|
+
isTabbing: isTabbing
|
|
54
61
|
}));
|
|
55
62
|
};
|
|
56
63
|
|
package/dist/cjs/constants.js
CHANGED
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.KEY_SPACE = exports.KEY_ENTER = exports.COLOR_CARD_SIZE = void 0;
|
|
6
|
+
exports.KEY_TAB = exports.KEY_SPACE = exports.KEY_ENTER = exports.KEY_ARROW_UP = exports.KEY_ARROW_DOWN = exports.COLOR_CARD_SIZE = void 0;
|
|
7
7
|
var COLOR_CARD_SIZE = 30;
|
|
8
8
|
exports.COLOR_CARD_SIZE = COLOR_CARD_SIZE;
|
|
9
9
|
var KEY_SPACE = ' ';
|
|
10
10
|
exports.KEY_SPACE = KEY_SPACE;
|
|
11
11
|
var KEY_ENTER = 'Enter';
|
|
12
|
-
exports.KEY_ENTER = KEY_ENTER;
|
|
12
|
+
exports.KEY_ENTER = KEY_ENTER;
|
|
13
|
+
var KEY_ARROW_UP = 'ArrowDown';
|
|
14
|
+
exports.KEY_ARROW_UP = KEY_ARROW_UP;
|
|
15
|
+
var KEY_ARROW_DOWN = 'ArrowUp';
|
|
16
|
+
exports.KEY_ARROW_DOWN = KEY_ARROW_DOWN;
|
|
17
|
+
var KEY_TAB = 'Tab';
|
|
18
|
+
exports.KEY_TAB = KEY_TAB;
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.ColorCardOption = exports.ColorCardContent = exports.ColorCardButton = void 0;
|
|
10
|
+
exports.ColorCardOption = exports.ColorCardContentCheckMark = exports.ColorCardContent = exports.ColorCardButton = void 0;
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
@@ -17,18 +17,24 @@ var _theme = require("@atlaskit/theme");
|
|
|
17
17
|
|
|
18
18
|
var _constants = require("../constants");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _tokens = require("@atlaskit/tokens");
|
|
21
|
+
|
|
22
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
21
23
|
|
|
22
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
25
|
|
|
24
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
27
|
|
|
26
|
-
var buttonFocusedBorder = "border-color: ".concat(_theme.colors.B100, ";");
|
|
27
|
-
var sharedColorContainerStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: inline-block;\n position: relative;\n width: ", "px;\n height: ", "px;\n border: 2px solid transparent;\n box-sizing: border-box;\n border-radius: ", "px;\n transition: border-color 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38);\n background-color: transparent;\n border-color: transparent;\n padding: 0;\n cursor: pointer;\n outline: none;\n
|
|
28
|
+
var buttonFocusedBorder = "border-color: ".concat((0, _tokens.token)('color.border.focused', _theme.colors.B100), ";");
|
|
29
|
+
var sharedColorContainerStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: inline-block;\n position: relative;\n width: ", "px;\n height: ", "px;\n border: 2px solid transparent;\n box-sizing: border-box;\n border-radius: ", "px;\n transition: border-color 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38);\n background-color: transparent;\n border-color: transparent;\n padding: 0;\n cursor: pointer;\n outline: none;\n"])), _constants.COLOR_CARD_SIZE, _constants.COLOR_CARD_SIZE, (0, _theme.borderRadius)() * 2);
|
|
28
30
|
|
|
29
|
-
var ColorCardOption = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n\n ", ";\n"])), sharedColorContainerStyles, function (props) {
|
|
30
|
-
if (props.
|
|
31
|
-
return "border-color: ".concat(_theme.colors.B75);
|
|
31
|
+
var ColorCardOption = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n\n ", "\n\n ", ";\n"])), sharedColorContainerStyles, function (props) {
|
|
32
|
+
if (props.isTabbing === undefined || props.isTabbing) {
|
|
33
|
+
return "&:hover,\n &:focus {\n border-color: ".concat((0, _tokens.token)('color.border.focused', _theme.colors.B75), ";\n }");
|
|
34
|
+
}
|
|
35
|
+
}, function (props) {
|
|
36
|
+
if (props.focused && !props.isTabbing) {
|
|
37
|
+
return "border-color: ".concat((0, _tokens.token)('color.border.focused', _theme.colors.B75));
|
|
32
38
|
}
|
|
33
39
|
});
|
|
34
40
|
|
|
@@ -42,8 +48,13 @@ var ColorCardButton = _styledComponents.default.button(_templateObject3 || (_tem
|
|
|
42
48
|
|
|
43
49
|
exports.ColorCardButton = ColorCardButton;
|
|
44
50
|
|
|
45
|
-
|
|
51
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
52
|
+
var ColorCardContent = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n top: 1px;\n left: 1px;\n width: 24px;\n height: 24px;\n border-radius: ", "px;\n background: ", ";\n box-shadow: inset 0px 0px 0px 1px\n ", ";\n"])), (0, _theme.borderRadius)(), function (props) {
|
|
46
53
|
return props.color;
|
|
47
|
-
});
|
|
54
|
+
}, (0, _tokens.token)('color.background.inverse.subtle', _theme.colors.DN600A));
|
|
55
|
+
|
|
56
|
+
exports.ColorCardContent = ColorCardContent;
|
|
57
|
+
|
|
58
|
+
var ColorCardContentCheckMark = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: 1px;\n"])));
|
|
48
59
|
|
|
49
|
-
exports.
|
|
60
|
+
exports.ColorCardContentCheckMark = ColorCardContentCheckMark;
|
|
@@ -17,6 +17,8 @@ var _utils = require("../utils");
|
|
|
17
17
|
|
|
18
18
|
var _types = require("../types");
|
|
19
19
|
|
|
20
|
+
var _tokens = require("@atlaskit/tokens");
|
|
21
|
+
|
|
20
22
|
var _templateObject, _templateObject2, _templateObject3;
|
|
21
23
|
|
|
22
24
|
var ColorCardWrapper = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n margin: ", "px;\n"])), (0, _theme.gridSize)() / 4);
|
|
@@ -29,10 +31,10 @@ var ColorPaletteContainer = _styledComponents.default.div(_templateObject2 || (_
|
|
|
29
31
|
|
|
30
32
|
exports.ColorPaletteContainer = ColorPaletteContainer;
|
|
31
33
|
|
|
32
|
-
var ColorPaletteMenu = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n margin: 0;\n background-color: ", ";\n width: ", "px;\n ", "\n"])), _theme.colors.N0, function (props) {
|
|
34
|
+
var ColorPaletteMenu = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n margin: 0;\n background-color: ", ";\n width: ", "px;\n ", "\n"])), (0, _tokens.token)('elevation.surface.overlay', _theme.colors.N0), function (props) {
|
|
33
35
|
return (0, _utils.getWidth)(props.cols);
|
|
34
36
|
}, function (props) {
|
|
35
|
-
return props.mode && props.mode === _types.Mode.Standard && "\n box-radius: ".concat(_theme.borderRadius, "px;\n box-shadow: 0 0 0 1px "
|
|
37
|
+
return props.mode && props.mode === _types.Mode.Standard && "\n box-radius: ".concat(_theme.borderRadius, "px;\n box-shadow: ").concat((0, _tokens.token)('elevation.shadow.overlay', "0 0 0 1px ".concat(_theme.colors.N40, ", 0 0 8px ").concat(_theme.colors.N40)), ";\n width: ").concat((0, _utils.getWidth)(props.cols) + (0, _theme.gridSize)(), "px;\n ");
|
|
36
38
|
});
|
|
37
39
|
|
|
38
40
|
exports.ColorPaletteMenu = ColorPaletteMenu;
|
package/dist/cjs/version.json
CHANGED
|
@@ -5,7 +5,7 @@ import EditorDoneIcon from '@atlaskit/icon/glyph/editor/done'; // AFP-2532 TODO:
|
|
|
5
5
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
6
6
|
|
|
7
7
|
import { colors } from '@atlaskit/theme';
|
|
8
|
-
import { ColorCardOption, ColorCardContent } from '../styled/ColorCard';
|
|
8
|
+
import { ColorCardOption, ColorCardContent, ColorCardContentCheckMark } from '../styled/ColorCard';
|
|
9
9
|
import { KEY_SPACE, KEY_ENTER } from '../constants';
|
|
10
10
|
export default class ColorCard extends PureComponent {
|
|
11
11
|
constructor(...args) {
|
|
@@ -33,11 +33,17 @@ export default class ColorCard extends PureComponent {
|
|
|
33
33
|
} = event;
|
|
34
34
|
const {
|
|
35
35
|
onKeyDown,
|
|
36
|
-
value
|
|
36
|
+
value,
|
|
37
|
+
isTabbing
|
|
37
38
|
} = this.props;
|
|
38
39
|
|
|
39
|
-
if (onKeyDown && (key === KEY_ENTER || key === KEY_SPACE)) {
|
|
40
|
+
if ((isTabbing === undefined || isTabbing) && onKeyDown && (key === KEY_ENTER || key === KEY_SPACE)) {
|
|
40
41
|
event.preventDefault();
|
|
42
|
+
|
|
43
|
+
if (isTabbing) {
|
|
44
|
+
event.stopPropagation();
|
|
45
|
+
}
|
|
46
|
+
|
|
41
47
|
onKeyDown(value);
|
|
42
48
|
}
|
|
43
49
|
});
|
|
@@ -51,7 +57,9 @@ export default class ColorCard extends PureComponent {
|
|
|
51
57
|
label,
|
|
52
58
|
selected,
|
|
53
59
|
focused,
|
|
54
|
-
|
|
60
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
61
|
+
checkMarkColor = colors.N0,
|
|
62
|
+
isTabbing
|
|
55
63
|
} = this.props;
|
|
56
64
|
return /*#__PURE__*/React.createElement(ColorCardOption, {
|
|
57
65
|
onClick: this.onClick,
|
|
@@ -59,13 +67,14 @@ export default class ColorCard extends PureComponent {
|
|
|
59
67
|
focused: focused,
|
|
60
68
|
"aria-label": `${label}${selected ? ' selected' : ''}`,
|
|
61
69
|
tabIndex: 0,
|
|
62
|
-
onKeyDown: this.onKeyDown
|
|
70
|
+
onKeyDown: this.onKeyDown,
|
|
71
|
+
isTabbing: isTabbing
|
|
63
72
|
}, /*#__PURE__*/React.createElement(ColorCardContent, {
|
|
64
73
|
color: value || 'transparent'
|
|
65
|
-
}, selected && /*#__PURE__*/React.createElement(EditorDoneIcon, {
|
|
74
|
+
}, selected && /*#__PURE__*/React.createElement(ColorCardContentCheckMark, null, /*#__PURE__*/React.createElement(EditorDoneIcon, {
|
|
66
75
|
primaryColor: checkMarkColor,
|
|
67
76
|
label: ""
|
|
68
|
-
})));
|
|
77
|
+
}))));
|
|
69
78
|
}
|
|
70
79
|
|
|
71
80
|
}
|
|
@@ -4,6 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import { PopupSelect } from '@atlaskit/select';
|
|
5
5
|
import Trigger from './Trigger';
|
|
6
6
|
import * as components from './components';
|
|
7
|
+
import { KEY_ARROW_UP, KEY_ARROW_DOWN, KEY_TAB } from '../constants';
|
|
7
8
|
import { withAnalyticsEvents, withAnalyticsContext, createAndFireEvent } from '@atlaskit/analytics-next';
|
|
8
9
|
import { ColorCardWrapper } from '../styled/ColorPicker';
|
|
9
10
|
import { getOptions } from '../utils';
|
|
@@ -18,13 +19,17 @@ const defaultPopperProps = {
|
|
|
18
19
|
placement: 'bottom-start'
|
|
19
20
|
};
|
|
20
21
|
const packageName = "@atlaskit/color-picker";
|
|
21
|
-
const packageVersion = "
|
|
22
|
+
const packageVersion = "3.0.0";
|
|
22
23
|
export class ColorPickerWithoutAnalytics extends React.Component {
|
|
23
24
|
constructor(...args) {
|
|
24
25
|
super(...args);
|
|
25
26
|
|
|
26
27
|
_defineProperty(this, "createAndFireEventOnAtlaskit", createAndFireEvent('atlaskit'));
|
|
27
28
|
|
|
29
|
+
_defineProperty(this, "state", {
|
|
30
|
+
isTabbing: false
|
|
31
|
+
});
|
|
32
|
+
|
|
28
33
|
_defineProperty(this, "changeAnalyticsCaller", () => {
|
|
29
34
|
const {
|
|
30
35
|
createAnalyticsEvent
|
|
@@ -45,9 +50,27 @@ export class ColorPickerWithoutAnalytics extends React.Component {
|
|
|
45
50
|
return undefined;
|
|
46
51
|
});
|
|
47
52
|
|
|
48
|
-
_defineProperty(this, "
|
|
53
|
+
_defineProperty(this, "onChangeSelect", option => {
|
|
49
54
|
this.props.onChange(option.value, this.changeAnalyticsCaller());
|
|
50
55
|
});
|
|
56
|
+
|
|
57
|
+
_defineProperty(this, "onOptionKeyDown", value => {
|
|
58
|
+
this.props.onChange(value, this.changeAnalyticsCaller());
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
_defineProperty(this, "onKeyDown", e => {
|
|
62
|
+
const key = e.key;
|
|
63
|
+
|
|
64
|
+
if (key === KEY_TAB) {
|
|
65
|
+
this.setState({
|
|
66
|
+
isTabbing: true
|
|
67
|
+
});
|
|
68
|
+
} else if (key === KEY_ARROW_UP || key === KEY_ARROW_DOWN) {
|
|
69
|
+
this.setState({
|
|
70
|
+
isTabbing: false
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
51
74
|
}
|
|
52
75
|
|
|
53
76
|
render() {
|
|
@@ -81,12 +104,15 @@ export class ColorPickerWithoutAnalytics extends React.Component {
|
|
|
81
104
|
"aria-label": fullLabel,
|
|
82
105
|
value: value,
|
|
83
106
|
components: components,
|
|
84
|
-
onChange: this.
|
|
107
|
+
onChange: this.onChangeSelect // never show search input
|
|
85
108
|
,
|
|
86
109
|
searchThreshold: Number.MAX_VALUE // palette props
|
|
87
110
|
,
|
|
88
111
|
cols: cols,
|
|
89
|
-
checkMarkColor: checkMarkColor
|
|
112
|
+
checkMarkColor: checkMarkColor,
|
|
113
|
+
onKeyDown: this.onKeyDown,
|
|
114
|
+
isTabbing: this.state.isTabbing,
|
|
115
|
+
onOptionKeyDown: this.onOptionKeyDown
|
|
90
116
|
});
|
|
91
117
|
}
|
|
92
118
|
|
|
@@ -27,7 +27,9 @@ export const Option = props => {
|
|
|
27
27
|
label
|
|
28
28
|
},
|
|
29
29
|
selectProps: {
|
|
30
|
-
checkMarkColor
|
|
30
|
+
checkMarkColor,
|
|
31
|
+
onOptionKeyDown,
|
|
32
|
+
isTabbing
|
|
31
33
|
},
|
|
32
34
|
isFocused,
|
|
33
35
|
isSelected
|
|
@@ -38,7 +40,9 @@ export const Option = props => {
|
|
|
38
40
|
checkMarkColor: checkMarkColor,
|
|
39
41
|
isOption: true,
|
|
40
42
|
focused: isFocused,
|
|
41
|
-
selected: isSelected
|
|
43
|
+
selected: isSelected,
|
|
44
|
+
onKeyDown: value => onOptionKeyDown(value),
|
|
45
|
+
isTabbing: isTabbing
|
|
42
46
|
}));
|
|
43
47
|
};
|
|
44
48
|
export const DropdownIndicator = () => null;
|
package/dist/es2019/constants.js
CHANGED
|
@@ -3,7 +3,8 @@ import styled, { css } from 'styled-components'; // AFP-2532 TODO: Fix automatic
|
|
|
3
3
|
|
|
4
4
|
import { borderRadius, colors } from '@atlaskit/theme';
|
|
5
5
|
import { COLOR_CARD_SIZE } from '../constants';
|
|
6
|
-
|
|
6
|
+
import { token } from '@atlaskit/tokens';
|
|
7
|
+
const buttonFocusedBorder = `border-color: ${token('color.border.focused', colors.B100)};`;
|
|
7
8
|
const sharedColorContainerStyles = css`
|
|
8
9
|
display: inline-block;
|
|
9
10
|
position: relative;
|
|
@@ -18,17 +19,22 @@ const sharedColorContainerStyles = css`
|
|
|
18
19
|
padding: 0;
|
|
19
20
|
cursor: pointer;
|
|
20
21
|
outline: none;
|
|
21
|
-
&:hover,
|
|
22
|
-
&:focus {
|
|
23
|
-
border-color: ${colors.B75};
|
|
24
|
-
}
|
|
25
22
|
`;
|
|
26
23
|
export const ColorCardOption = styled.div`
|
|
27
24
|
${sharedColorContainerStyles};
|
|
28
25
|
|
|
29
26
|
${props => {
|
|
30
|
-
if (props.
|
|
31
|
-
return
|
|
27
|
+
if (props.isTabbing === undefined || props.isTabbing) {
|
|
28
|
+
return `&:hover,
|
|
29
|
+
&:focus {
|
|
30
|
+
border-color: ${token('color.border.focused', colors.B75)};
|
|
31
|
+
}`;
|
|
32
|
+
}
|
|
33
|
+
}}
|
|
34
|
+
|
|
35
|
+
${props => {
|
|
36
|
+
if (props.focused && !props.isTabbing) {
|
|
37
|
+
return `border-color: ${token('color.border.focused', colors.B75)}`;
|
|
32
38
|
}
|
|
33
39
|
}};
|
|
34
40
|
`;
|
|
@@ -48,13 +54,19 @@ export const ColorCardButton = styled.button`
|
|
|
48
54
|
}
|
|
49
55
|
}};
|
|
50
56
|
`;
|
|
57
|
+
|
|
58
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
51
59
|
export const ColorCardContent = styled.div`
|
|
52
60
|
position: absolute;
|
|
53
61
|
top: 1px;
|
|
54
62
|
left: 1px;
|
|
55
|
-
width:
|
|
56
|
-
height:
|
|
63
|
+
width: 24px;
|
|
64
|
+
height: 24px;
|
|
57
65
|
border-radius: ${borderRadius()}px;
|
|
58
66
|
background: ${props => props.color};
|
|
59
|
-
|
|
67
|
+
box-shadow: inset 0px 0px 0px 1px
|
|
68
|
+
${token('color.background.inverse.subtle', colors.DN600A)};
|
|
69
|
+
`;
|
|
70
|
+
export const ColorCardContentCheckMark = styled.div`
|
|
71
|
+
margin: 1px;
|
|
60
72
|
`;
|
|
@@ -4,6 +4,7 @@ import styled from 'styled-components'; // AFP-2532 TODO: Fix automatic suppress
|
|
|
4
4
|
import { gridSize, borderRadius, colors } from '@atlaskit/theme';
|
|
5
5
|
import { getWidth } from '../utils';
|
|
6
6
|
import { Mode } from '../types';
|
|
7
|
+
import { token } from '@atlaskit/tokens';
|
|
7
8
|
export const ColorCardWrapper = styled.div`
|
|
8
9
|
display: flex;
|
|
9
10
|
margin: ${gridSize() / 4}px;
|
|
@@ -16,11 +17,11 @@ export const ColorPaletteContainer = styled.div`
|
|
|
16
17
|
export const ColorPaletteMenu = styled.div`
|
|
17
18
|
position: relative;
|
|
18
19
|
margin: 0;
|
|
19
|
-
background-color: ${colors.N0};
|
|
20
|
+
background-color: ${token('elevation.surface.overlay', colors.N0)};
|
|
20
21
|
width: ${props => getWidth(props.cols)}px;
|
|
21
22
|
${props => props.mode && props.mode === Mode.Standard && `
|
|
22
23
|
box-radius: ${borderRadius}px;
|
|
23
|
-
box-shadow: 0 0 0 1px ${colors.N40}, 0 0 8px ${colors.N40};
|
|
24
|
+
box-shadow: ${token('elevation.shadow.overlay', `0 0 0 1px ${colors.N40}, 0 0 8px ${colors.N40}`)};
|
|
24
25
|
width: ${getWidth(props.cols) + gridSize()}px;
|
|
25
26
|
`}
|
|
26
27
|
`;
|
package/dist/es2019/version.json
CHANGED
|
@@ -16,7 +16,7 @@ import EditorDoneIcon from '@atlaskit/icon/glyph/editor/done'; // AFP-2532 TODO:
|
|
|
16
16
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
17
17
|
|
|
18
18
|
import { colors } from '@atlaskit/theme';
|
|
19
|
-
import { ColorCardOption, ColorCardContent } from '../styled/ColorCard';
|
|
19
|
+
import { ColorCardOption, ColorCardContent, ColorCardContentCheckMark } from '../styled/ColorCard';
|
|
20
20
|
import { KEY_SPACE, KEY_ENTER } from '../constants';
|
|
21
21
|
|
|
22
22
|
var ColorCard = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -54,10 +54,16 @@ var ColorCard = /*#__PURE__*/function (_PureComponent) {
|
|
|
54
54
|
var key = event.key;
|
|
55
55
|
var _this$props2 = _this.props,
|
|
56
56
|
onKeyDown = _this$props2.onKeyDown,
|
|
57
|
-
value = _this$props2.value
|
|
57
|
+
value = _this$props2.value,
|
|
58
|
+
isTabbing = _this$props2.isTabbing;
|
|
58
59
|
|
|
59
|
-
if (onKeyDown && (key === KEY_ENTER || key === KEY_SPACE)) {
|
|
60
|
+
if ((isTabbing === undefined || isTabbing) && onKeyDown && (key === KEY_ENTER || key === KEY_SPACE)) {
|
|
60
61
|
event.preventDefault();
|
|
62
|
+
|
|
63
|
+
if (isTabbing) {
|
|
64
|
+
event.stopPropagation();
|
|
65
|
+
}
|
|
66
|
+
|
|
61
67
|
onKeyDown(value);
|
|
62
68
|
}
|
|
63
69
|
});
|
|
@@ -76,20 +82,22 @@ var ColorCard = /*#__PURE__*/function (_PureComponent) {
|
|
|
76
82
|
selected = _this$props3.selected,
|
|
77
83
|
focused = _this$props3.focused,
|
|
78
84
|
_this$props3$checkMar = _this$props3.checkMarkColor,
|
|
79
|
-
checkMarkColor = _this$props3$checkMar === void 0 ? colors.N0 : _this$props3$checkMar
|
|
85
|
+
checkMarkColor = _this$props3$checkMar === void 0 ? colors.N0 : _this$props3$checkMar,
|
|
86
|
+
isTabbing = _this$props3.isTabbing;
|
|
80
87
|
return /*#__PURE__*/React.createElement(ColorCardOption, {
|
|
81
88
|
onClick: this.onClick,
|
|
82
89
|
onMouseDown: this.onMouseDown,
|
|
83
90
|
focused: focused,
|
|
84
91
|
"aria-label": "".concat(label).concat(selected ? ' selected' : ''),
|
|
85
92
|
tabIndex: 0,
|
|
86
|
-
onKeyDown: this.onKeyDown
|
|
93
|
+
onKeyDown: this.onKeyDown,
|
|
94
|
+
isTabbing: isTabbing
|
|
87
95
|
}, /*#__PURE__*/React.createElement(ColorCardContent, {
|
|
88
96
|
color: value || 'transparent'
|
|
89
|
-
}, selected && /*#__PURE__*/React.createElement(EditorDoneIcon, {
|
|
97
|
+
}, selected && /*#__PURE__*/React.createElement(ColorCardContentCheckMark, null, /*#__PURE__*/React.createElement(EditorDoneIcon, {
|
|
90
98
|
primaryColor: checkMarkColor,
|
|
91
99
|
label: ""
|
|
92
|
-
})));
|
|
100
|
+
}))));
|
|
93
101
|
}
|
|
94
102
|
}]);
|
|
95
103
|
|
|
@@ -15,6 +15,7 @@ import React from 'react';
|
|
|
15
15
|
import { PopupSelect } from '@atlaskit/select';
|
|
16
16
|
import Trigger from './Trigger';
|
|
17
17
|
import * as components from './components';
|
|
18
|
+
import { KEY_ARROW_UP, KEY_ARROW_DOWN, KEY_TAB } from '../constants';
|
|
18
19
|
import { withAnalyticsEvents, withAnalyticsContext, createAndFireEvent } from '@atlaskit/analytics-next';
|
|
19
20
|
import { ColorCardWrapper } from '../styled/ColorPicker';
|
|
20
21
|
import { getOptions } from '../utils';
|
|
@@ -29,7 +30,7 @@ var defaultPopperProps = {
|
|
|
29
30
|
placement: 'bottom-start'
|
|
30
31
|
};
|
|
31
32
|
var packageName = "@atlaskit/color-picker";
|
|
32
|
-
var packageVersion = "
|
|
33
|
+
var packageVersion = "3.0.0";
|
|
33
34
|
export var ColorPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
34
35
|
_inherits(ColorPickerWithoutAnalytics, _React$Component);
|
|
35
36
|
|
|
@@ -48,6 +49,10 @@ export var ColorPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component
|
|
|
48
49
|
|
|
49
50
|
_defineProperty(_assertThisInitialized(_this), "createAndFireEventOnAtlaskit", createAndFireEvent('atlaskit'));
|
|
50
51
|
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
53
|
+
isTabbing: false
|
|
54
|
+
});
|
|
55
|
+
|
|
51
56
|
_defineProperty(_assertThisInitialized(_this), "changeAnalyticsCaller", function () {
|
|
52
57
|
var createAnalyticsEvent = _this.props.createAnalyticsEvent;
|
|
53
58
|
|
|
@@ -66,10 +71,28 @@ export var ColorPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component
|
|
|
66
71
|
return undefined;
|
|
67
72
|
});
|
|
68
73
|
|
|
69
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
74
|
+
_defineProperty(_assertThisInitialized(_this), "onChangeSelect", function (option) {
|
|
70
75
|
_this.props.onChange(option.value, _this.changeAnalyticsCaller());
|
|
71
76
|
});
|
|
72
77
|
|
|
78
|
+
_defineProperty(_assertThisInitialized(_this), "onOptionKeyDown", function (value) {
|
|
79
|
+
_this.props.onChange(value, _this.changeAnalyticsCaller());
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
_defineProperty(_assertThisInitialized(_this), "onKeyDown", function (e) {
|
|
83
|
+
var key = e.key;
|
|
84
|
+
|
|
85
|
+
if (key === KEY_TAB) {
|
|
86
|
+
_this.setState({
|
|
87
|
+
isTabbing: true
|
|
88
|
+
});
|
|
89
|
+
} else if (key === KEY_ARROW_UP || key === KEY_ARROW_DOWN) {
|
|
90
|
+
_this.setState({
|
|
91
|
+
isTabbing: false
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
73
96
|
return _this;
|
|
74
97
|
}
|
|
75
98
|
|
|
@@ -109,12 +132,15 @@ export var ColorPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component
|
|
|
109
132
|
"aria-label": fullLabel,
|
|
110
133
|
value: value,
|
|
111
134
|
components: components,
|
|
112
|
-
onChange: this.
|
|
135
|
+
onChange: this.onChangeSelect // never show search input
|
|
113
136
|
,
|
|
114
137
|
searchThreshold: Number.MAX_VALUE // palette props
|
|
115
138
|
,
|
|
116
139
|
cols: cols,
|
|
117
|
-
checkMarkColor: checkMarkColor
|
|
140
|
+
checkMarkColor: checkMarkColor,
|
|
141
|
+
onKeyDown: this.onKeyDown,
|
|
142
|
+
isTabbing: this.state.isTabbing,
|
|
143
|
+
onOptionKeyDown: this.onOptionKeyDown
|
|
118
144
|
});
|
|
119
145
|
}
|
|
120
146
|
}]);
|
|
@@ -23,7 +23,10 @@ export var Option = function Option(props) {
|
|
|
23
23
|
var _props$data = props.data,
|
|
24
24
|
value = _props$data.value,
|
|
25
25
|
label = _props$data.label,
|
|
26
|
-
|
|
26
|
+
_props$selectProps = props.selectProps,
|
|
27
|
+
checkMarkColor = _props$selectProps.checkMarkColor,
|
|
28
|
+
onOptionKeyDown = _props$selectProps.onOptionKeyDown,
|
|
29
|
+
isTabbing = _props$selectProps.isTabbing,
|
|
27
30
|
isFocused = props.isFocused,
|
|
28
31
|
isSelected = props.isSelected;
|
|
29
32
|
return /*#__PURE__*/React.createElement(ColorCardWrapper, props.innerProps, /*#__PURE__*/React.createElement(ColorCard, {
|
|
@@ -32,7 +35,11 @@ export var Option = function Option(props) {
|
|
|
32
35
|
checkMarkColor: checkMarkColor,
|
|
33
36
|
isOption: true,
|
|
34
37
|
focused: isFocused,
|
|
35
|
-
selected: isSelected
|
|
38
|
+
selected: isSelected,
|
|
39
|
+
onKeyDown: function onKeyDown(value) {
|
|
40
|
+
return onOptionKeyDown(value);
|
|
41
|
+
},
|
|
42
|
+
isTabbing: isTabbing
|
|
36
43
|
}));
|
|
37
44
|
};
|
|
38
45
|
export var DropdownIndicator = function DropdownIndicator() {
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
4
4
|
|
|
5
5
|
import styled, { css } from 'styled-components'; // AFP-2532 TODO: Fix automatic suppressions below
|
|
6
6
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
7
7
|
|
|
8
8
|
import { borderRadius, colors } from '@atlaskit/theme';
|
|
9
9
|
import { COLOR_CARD_SIZE } from '../constants';
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
import { token } from '@atlaskit/tokens';
|
|
11
|
+
var buttonFocusedBorder = "border-color: ".concat(token('color.border.focused', colors.B100), ";");
|
|
12
|
+
var sharedColorContainerStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n position: relative;\n width: ", "px;\n height: ", "px;\n border: 2px solid transparent;\n box-sizing: border-box;\n border-radius: ", "px;\n transition: border-color 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38);\n background-color: transparent;\n border-color: transparent;\n padding: 0;\n cursor: pointer;\n outline: none;\n"])), COLOR_CARD_SIZE, COLOR_CARD_SIZE, borderRadius() * 2);
|
|
13
|
+
export var ColorCardOption = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", ";\n\n ", "\n\n ", ";\n"])), sharedColorContainerStyles, function (props) {
|
|
14
|
+
if (props.isTabbing === undefined || props.isTabbing) {
|
|
15
|
+
return "&:hover,\n &:focus {\n border-color: ".concat(token('color.border.focused', colors.B75), ";\n }");
|
|
16
|
+
}
|
|
17
|
+
}, function (props) {
|
|
18
|
+
if (props.focused && !props.isTabbing) {
|
|
19
|
+
return "border-color: ".concat(token('color.border.focused', colors.B75));
|
|
15
20
|
}
|
|
16
21
|
});
|
|
17
22
|
export var ColorCardButton = styled.button(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", ";\n &:hover {\n border-color: transparent;\n }\n &:not(:focus):hover,\n &:focus {\n ", ";\n }\n\n ", ";\n"])), sharedColorContainerStyles, buttonFocusedBorder, function (props) {
|
|
@@ -19,6 +24,9 @@ export var ColorCardButton = styled.button(_templateObject3 || (_templateObject3
|
|
|
19
24
|
return buttonFocusedBorder;
|
|
20
25
|
}
|
|
21
26
|
});
|
|
22
|
-
|
|
27
|
+
|
|
28
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
29
|
+
export var ColorCardContent = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n top: 1px;\n left: 1px;\n width: 24px;\n height: 24px;\n border-radius: ", "px;\n background: ", ";\n box-shadow: inset 0px 0px 0px 1px\n ", ";\n"])), borderRadius(), function (props) {
|
|
23
30
|
return props.color;
|
|
24
|
-
});
|
|
31
|
+
}, token('color.background.inverse.subtle', colors.DN600A));
|
|
32
|
+
export var ColorCardContentCheckMark = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: 1px;\n"])));
|
|
@@ -8,12 +8,13 @@ import styled from 'styled-components'; // AFP-2532 TODO: Fix automatic suppress
|
|
|
8
8
|
import { gridSize, borderRadius, colors } from '@atlaskit/theme';
|
|
9
9
|
import { getWidth } from '../utils';
|
|
10
10
|
import { Mode } from '../types';
|
|
11
|
+
import { token } from '@atlaskit/tokens';
|
|
11
12
|
export var ColorCardWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n margin: ", "px;\n"])), gridSize() / 4);
|
|
12
13
|
export var ColorPaletteContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: wrap;\n padding: ", ";\n"])), function (props) {
|
|
13
14
|
return props.mode === Mode.Compact ? "0" : "".concat(gridSize() / 2, "px");
|
|
14
15
|
});
|
|
15
|
-
export var ColorPaletteMenu = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n margin: 0;\n background-color: ", ";\n width: ", "px;\n ", "\n"])), colors.N0, function (props) {
|
|
16
|
+
export var ColorPaletteMenu = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n margin: 0;\n background-color: ", ";\n width: ", "px;\n ", "\n"])), token('elevation.surface.overlay', colors.N0), function (props) {
|
|
16
17
|
return getWidth(props.cols);
|
|
17
18
|
}, function (props) {
|
|
18
|
-
return props.mode && props.mode === Mode.Standard && "\n box-radius: ".concat(borderRadius, "px;\n box-shadow: 0 0 0 1px "
|
|
19
|
+
return props.mode && props.mode === Mode.Standard && "\n box-radius: ".concat(borderRadius, "px;\n box-shadow: ").concat(token('elevation.shadow.overlay', "0 0 0 1px ".concat(colors.N40, ", 0 0 8px ").concat(colors.N40)), ";\n width: ").concat(getWidth(props.cols) + gridSize(), "px;\n ");
|
|
19
20
|
});
|
package/dist/esm/version.json
CHANGED
|
@@ -21,8 +21,13 @@ export interface Props {
|
|
|
21
21
|
}
|
|
22
22
|
export declare class ColorPickerWithoutAnalytics extends React.Component<Props> {
|
|
23
23
|
createAndFireEventOnAtlaskit: (payload: import("@atlaskit/analytics-next").AnalyticsEventPayload) => (createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent) => import("@atlaskit/analytics-next").UIAnalyticsEvent;
|
|
24
|
+
state: {
|
|
25
|
+
isTabbing: boolean;
|
|
26
|
+
};
|
|
24
27
|
changeAnalyticsCaller: () => import("@atlaskit/analytics-next").UIAnalyticsEvent | undefined;
|
|
25
|
-
|
|
28
|
+
onChangeSelect: (option: ValueType<Color>) => void;
|
|
29
|
+
onOptionKeyDown: (value: string) => void;
|
|
30
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;
|
|
26
31
|
render(): JSX.Element;
|
|
27
32
|
}
|
|
28
33
|
declare const _default: React.ForwardRefExoticComponent<Pick<Omit<Props, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "key" | "onChange" | "checkMarkColor" | "cols" | "popperProps" | "palette" | "selectedColor" | "analyticsContext"> & React.RefAttributes<any>>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare type ColorCardProps = {
|
|
3
3
|
focused?: boolean;
|
|
4
|
+
isTabbing?: boolean;
|
|
4
5
|
};
|
|
5
6
|
export declare const ColorCardOption: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & ColorCardProps, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & ColorCardProps>;
|
|
6
7
|
export declare const ColorCardButton: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & ColorCardProps, any, import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & ColorCardProps>;
|
|
@@ -8,4 +9,5 @@ declare type ColorCardContentProps = {
|
|
|
8
9
|
color: string;
|
|
9
10
|
};
|
|
10
11
|
export declare const ColorCardContent: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & ColorCardContentProps, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & ColorCardContentProps>;
|
|
12
|
+
export declare const ColorCardContentCheckMark: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
|
|
11
13
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/color-picker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Jira Color Picker Component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@atlaskit/icon": "^21.10.0",
|
|
26
26
|
"@atlaskit/select": "^15.0.0",
|
|
27
27
|
"@atlaskit/theme": "^12.1.0",
|
|
28
|
+
"@atlaskit/tokens": "^0.10.0",
|
|
28
29
|
"@babel/runtime": "^7.0.0",
|
|
29
30
|
"memoize-one": "^6.0.0",
|
|
30
31
|
"styled-components": "^3.2.6"
|
|
@@ -53,5 +54,10 @@
|
|
|
53
54
|
"./ColorPaletteMenu": "./src/components/ColorPaletteMenu.tsx",
|
|
54
55
|
".": "./src/index.ts"
|
|
55
56
|
},
|
|
57
|
+
"techstack": {
|
|
58
|
+
"@repo/internal": {
|
|
59
|
+
"theming": "tokens"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
56
62
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
57
63
|
}
|