@atlaskit/color-picker 3.0.7 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/components/ColorCard.js +12 -42
- package/dist/cjs/components/ColorPaletteMenu.js +10 -42
- package/dist/cjs/components/ColorPicker.js +16 -52
- package/dist/cjs/components/Trigger.js +3 -24
- package/dist/cjs/components/components.js +12 -28
- package/dist/cjs/index.js +1 -8
- package/dist/cjs/styled/ColorCard.js +0 -18
- package/dist/cjs/styled/ColorPalette.js +0 -13
- package/dist/cjs/styled/ColorPicker.js +0 -6
- package/dist/cjs/types.js +0 -1
- package/dist/cjs/utils.js +1 -7
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/ColorCard.js +2 -12
- package/dist/es2019/components/ColorPaletteMenu.js +0 -9
- package/dist/es2019/components/ColorPicker.js +5 -14
- package/dist/es2019/components/Trigger.js +0 -5
- package/dist/es2019/styled/ColorCard.js +2 -3
- package/dist/es2019/styled/ColorPalette.js +2 -2
- package/dist/es2019/types.js +0 -1
- package/dist/es2019/utils.js +0 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/ColorCard.js +14 -35
- package/dist/esm/components/ColorPaletteMenu.js +10 -31
- package/dist/esm/components/ColorPicker.js +16 -36
- package/dist/esm/components/Trigger.js +3 -19
- package/dist/esm/components/components.js +12 -13
- package/dist/esm/index.js +1 -1
- package/dist/esm/styled/ColorCard.js +2 -5
- package/dist/esm/styled/ColorPalette.js +2 -4
- package/dist/esm/styled/ColorPicker.js +0 -2
- package/dist/esm/types.js +0 -1
- package/dist/esm/utils.js +0 -1
- package/dist/esm/version.json +1 -1
- package/package.json +2 -2
|
@@ -6,11 +6,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
|
|
10
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
-
|
|
12
10
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
-
|
|
14
11
|
import React from 'react';
|
|
15
12
|
import { PopupSelect } from '@atlaskit/select';
|
|
16
13
|
import Trigger from './Trigger';
|
|
@@ -30,32 +27,23 @@ var defaultPopperProps = {
|
|
|
30
27
|
placement: 'bottom-start'
|
|
31
28
|
};
|
|
32
29
|
var packageName = "@atlaskit/color-picker";
|
|
33
|
-
var packageVersion = "3.0.
|
|
30
|
+
var packageVersion = "3.0.8";
|
|
34
31
|
export var ColorPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
35
32
|
_inherits(ColorPickerWithoutAnalytics, _React$Component);
|
|
36
|
-
|
|
37
33
|
var _super = _createSuper(ColorPickerWithoutAnalytics);
|
|
38
|
-
|
|
39
34
|
function ColorPickerWithoutAnalytics() {
|
|
40
35
|
var _this;
|
|
41
|
-
|
|
42
36
|
_classCallCheck(this, ColorPickerWithoutAnalytics);
|
|
43
|
-
|
|
44
37
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
45
38
|
args[_key] = arguments[_key];
|
|
46
39
|
}
|
|
47
|
-
|
|
48
40
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
49
|
-
|
|
50
41
|
_defineProperty(_assertThisInitialized(_this), "createAndFireEventOnAtlaskit", createAndFireEvent('atlaskit'));
|
|
51
|
-
|
|
52
42
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
53
43
|
isTabbing: false
|
|
54
44
|
});
|
|
55
|
-
|
|
56
45
|
_defineProperty(_assertThisInitialized(_this), "changeAnalyticsCaller", function () {
|
|
57
46
|
var createAnalyticsEvent = _this.props.createAnalyticsEvent;
|
|
58
|
-
|
|
59
47
|
if (createAnalyticsEvent) {
|
|
60
48
|
return _this.createAndFireEventOnAtlaskit({
|
|
61
49
|
action: 'clicked',
|
|
@@ -67,21 +55,16 @@ export var ColorPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component
|
|
|
67
55
|
}
|
|
68
56
|
})(createAnalyticsEvent);
|
|
69
57
|
}
|
|
70
|
-
|
|
71
58
|
return undefined;
|
|
72
59
|
});
|
|
73
|
-
|
|
74
60
|
_defineProperty(_assertThisInitialized(_this), "onChangeSelect", function (option) {
|
|
75
61
|
_this.props.onChange(option.value, _this.changeAnalyticsCaller());
|
|
76
62
|
});
|
|
77
|
-
|
|
78
63
|
_defineProperty(_assertThisInitialized(_this), "onOptionKeyDown", function (value) {
|
|
79
64
|
_this.props.onChange(value, _this.changeAnalyticsCaller());
|
|
80
65
|
});
|
|
81
|
-
|
|
82
66
|
_defineProperty(_assertThisInitialized(_this), "onKeyDown", function (e) {
|
|
83
67
|
var key = e.key;
|
|
84
|
-
|
|
85
68
|
if (key === KEY_TAB) {
|
|
86
69
|
_this.setState({
|
|
87
70
|
isTabbing: true
|
|
@@ -92,32 +75,28 @@ export var ColorPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component
|
|
|
92
75
|
});
|
|
93
76
|
}
|
|
94
77
|
});
|
|
95
|
-
|
|
96
78
|
return _this;
|
|
97
79
|
}
|
|
98
|
-
|
|
99
80
|
_createClass(ColorPickerWithoutAnalytics, [{
|
|
100
81
|
key: "render",
|
|
101
82
|
value: function render() {
|
|
102
83
|
var _this$props = this.props,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
84
|
+
palette = _this$props.palette,
|
|
85
|
+
selectedColor = _this$props.selectedColor,
|
|
86
|
+
checkMarkColor = _this$props.checkMarkColor,
|
|
87
|
+
cols = _this$props.cols,
|
|
88
|
+
_this$props$popperPro = _this$props.popperProps,
|
|
89
|
+
popperProps = _this$props$popperPro === void 0 ? defaultPopperProps : _this$props$popperPro,
|
|
90
|
+
_this$props$label = _this$props.label,
|
|
91
|
+
label = _this$props$label === void 0 ? 'Color picker' : _this$props$label;
|
|
112
92
|
var _getOptions = getOptions(palette, selectedColor),
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
93
|
+
options = _getOptions.options,
|
|
94
|
+
value = _getOptions.value;
|
|
116
95
|
var fullLabel = "".concat(label, ", ").concat(value.label, " selected");
|
|
117
96
|
return /*#__PURE__*/React.createElement(PopupSelect, {
|
|
118
97
|
target: function target(_ref) {
|
|
119
98
|
var ref = _ref.ref,
|
|
120
|
-
|
|
99
|
+
isOpen = _ref.isOpen;
|
|
121
100
|
return /*#__PURE__*/React.createElement(ColorCardWrapper, {
|
|
122
101
|
innerRef: ref
|
|
123
102
|
}, /*#__PURE__*/React.createElement(Trigger, _extends({}, value, {
|
|
@@ -132,9 +111,11 @@ export var ColorPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component
|
|
|
132
111
|
"aria-label": fullLabel,
|
|
133
112
|
value: value,
|
|
134
113
|
components: components,
|
|
135
|
-
onChange: this.onChangeSelect
|
|
114
|
+
onChange: this.onChangeSelect
|
|
115
|
+
// never show search input
|
|
136
116
|
,
|
|
137
|
-
searchThreshold: Number.MAX_VALUE
|
|
117
|
+
searchThreshold: Number.MAX_VALUE
|
|
118
|
+
// palette props
|
|
138
119
|
,
|
|
139
120
|
cols: cols,
|
|
140
121
|
checkMarkColor: checkMarkColor,
|
|
@@ -144,7 +125,6 @@ export var ColorPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component
|
|
|
144
125
|
});
|
|
145
126
|
}
|
|
146
127
|
}]);
|
|
147
|
-
|
|
148
128
|
return ColorPickerWithoutAnalytics;
|
|
149
129
|
}(React.Component);
|
|
150
130
|
export default withAnalyticsContext({
|
|
@@ -5,54 +5,40 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
|
|
11
9
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
-
|
|
13
10
|
import React from 'react';
|
|
14
11
|
import { ColorCardButton, ColorCardContent } from '../styled/ColorCard';
|
|
15
|
-
|
|
16
12
|
var ColorCard = /*#__PURE__*/function (_React$PureComponent) {
|
|
17
13
|
_inherits(ColorCard, _React$PureComponent);
|
|
18
|
-
|
|
19
14
|
var _super = _createSuper(ColorCard);
|
|
20
|
-
|
|
21
15
|
function ColorCard() {
|
|
22
16
|
var _this;
|
|
23
|
-
|
|
24
17
|
_classCallCheck(this, ColorCard);
|
|
25
|
-
|
|
26
18
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
19
|
args[_key] = arguments[_key];
|
|
28
20
|
}
|
|
29
|
-
|
|
30
21
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
31
|
-
|
|
32
22
|
_defineProperty(_assertThisInitialized(_this), "onMouseDown", function (event) {
|
|
33
23
|
event.preventDefault();
|
|
34
24
|
});
|
|
35
|
-
|
|
36
25
|
_defineProperty(_assertThisInitialized(_this), "onClick", function (event) {
|
|
37
26
|
var onClick = _this.props.onClick;
|
|
38
27
|
event.currentTarget.focus();
|
|
39
|
-
|
|
40
28
|
if (onClick) {
|
|
41
29
|
event.preventDefault();
|
|
42
30
|
onClick();
|
|
43
31
|
}
|
|
44
32
|
});
|
|
45
|
-
|
|
46
33
|
return _this;
|
|
47
34
|
}
|
|
48
|
-
|
|
49
35
|
_createClass(ColorCard, [{
|
|
50
36
|
key: "render",
|
|
51
37
|
value: function render() {
|
|
52
38
|
var _this$props = this.props,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
39
|
+
value = _this$props.value,
|
|
40
|
+
label = _this$props.label,
|
|
41
|
+
expanded = _this$props.expanded;
|
|
56
42
|
return /*#__PURE__*/React.createElement(ColorCardButton, {
|
|
57
43
|
title: label,
|
|
58
44
|
onClick: this.onClick,
|
|
@@ -67,8 +53,6 @@ var ColorCard = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
67
53
|
}));
|
|
68
54
|
}
|
|
69
55
|
}]);
|
|
70
|
-
|
|
71
56
|
return ColorCard;
|
|
72
57
|
}(React.PureComponent);
|
|
73
|
-
|
|
74
58
|
export { ColorCard as default };
|
|
@@ -7,10 +7,9 @@ import { getWidth } from '../utils';
|
|
|
7
7
|
import { ColorPaletteContainer, ColorCardWrapper } from '../styled/ColorPalette';
|
|
8
8
|
export var MenuList = function MenuList(props) {
|
|
9
9
|
var cx = props.cx,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
cols = props.selectProps.cols,
|
|
11
|
+
innerRef = props.innerRef,
|
|
12
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
14
13
|
return /*#__PURE__*/React.createElement(ColorPaletteContainer, _extends({
|
|
15
14
|
role: "grid",
|
|
16
15
|
style: {
|
|
@@ -21,15 +20,15 @@ export var MenuList = function MenuList(props) {
|
|
|
21
20
|
};
|
|
22
21
|
export var Option = function Option(props) {
|
|
23
22
|
var _props$data = props.data,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
value = _props$data.value,
|
|
24
|
+
label = _props$data.label,
|
|
25
|
+
_props$selectProps = props.selectProps,
|
|
26
|
+
checkMarkColor = _props$selectProps.checkMarkColor,
|
|
27
|
+
onOptionKeyDown = _props$selectProps.onOptionKeyDown,
|
|
28
|
+
isTabbing = _props$selectProps.isTabbing,
|
|
29
|
+
isFocused = props.isFocused,
|
|
30
|
+
isSelected = props.isSelected,
|
|
31
|
+
innerProps = props.innerProps;
|
|
33
32
|
return (
|
|
34
33
|
/*#__PURE__*/
|
|
35
34
|
// @ts-expect-error - known issue: https://github.com/mui/material-ui/issues/13921. TS treats styled components to be different from HTMLDivElement
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ColorPicker from './components/ColorPicker';
|
|
2
2
|
import { Mode } from './types';
|
|
3
3
|
var Compact = Mode.Compact,
|
|
4
|
-
|
|
4
|
+
Standard = Mode.Standard;
|
|
5
5
|
export { ColorPickerWithoutAnalytics } from './components/ColorPicker';
|
|
6
6
|
export { ColorPaletteMenuWithoutAnalytics } from './components/ColorPaletteMenu';
|
|
7
7
|
export default ColorPicker;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
|
|
3
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
// AFP-2532 TODO: Fix automatic suppressions below
|
|
6
5
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
7
|
-
|
|
8
6
|
import { borderRadius, colors } from '@atlaskit/theme';
|
|
9
7
|
import { COLOR_CARD_SIZE } from '../constants';
|
|
10
8
|
var buttonFocusedBorder = "border-color: ".concat("var(--ds-border-focused, ".concat(colors.B100, ")"), ";");
|
|
@@ -23,7 +21,6 @@ export var ColorCardButton = styled.button(_templateObject3 || (_templateObject3
|
|
|
23
21
|
return buttonFocusedBorder;
|
|
24
22
|
}
|
|
25
23
|
});
|
|
26
|
-
|
|
27
24
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
28
25
|
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) {
|
|
29
26
|
return props.color;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
|
|
3
2
|
var _templateObject, _templateObject2, _templateObject3;
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
// AFP-2532 TODO: Fix automatic suppressions below
|
|
6
5
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
7
|
-
|
|
8
6
|
import { gridSize, borderRadius, colors } from '@atlaskit/theme';
|
|
9
7
|
import { getWidth } from '../utils';
|
|
10
8
|
import { Mode } from '../types';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
|
|
3
2
|
var _templateObject;
|
|
4
|
-
|
|
5
3
|
import styled from 'styled-components';
|
|
6
4
|
export var ColorCardWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n"])));
|
package/dist/esm/types.js
CHANGED
package/dist/esm/utils.js
CHANGED
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/color-picker",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"description": "Jira Color Picker Component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@atlaskit/icon": "^21.11.0",
|
|
26
26
|
"@atlaskit/select": "^16.1.0",
|
|
27
27
|
"@atlaskit/theme": "^12.2.0",
|
|
28
|
-
"@atlaskit/tokens": "^0.
|
|
28
|
+
"@atlaskit/tokens": "^1.0.0",
|
|
29
29
|
"@babel/runtime": "^7.0.0",
|
|
30
30
|
"memoize-one": "^6.0.0",
|
|
31
31
|
"styled-components": "^3.2.6"
|