@chaoswise/ui 2.5.5 → 2.5.6
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/lib/ColorPicker/SketchPicker/components/common/Alpha.js +133 -0
- package/lib/ColorPicker/SketchPicker/components/common/Checkboard.js +40 -0
- package/lib/ColorPicker/SketchPicker/components/common/ColorWrap.js +80 -0
- package/lib/ColorPicker/SketchPicker/components/common/EditableInput.js +172 -0
- package/lib/ColorPicker/SketchPicker/components/common/Hue.js +118 -0
- package/lib/ColorPicker/SketchPicker/components/common/Raised.js +91 -0
- package/lib/ColorPicker/SketchPicker/components/common/Saturation.js +139 -0
- package/lib/ColorPicker/SketchPicker/components/common/Swatch.js +62 -0
- package/lib/ColorPicker/SketchPicker/components/common/index.js +8 -0
- package/lib/ColorPicker/SketchPicker/components/sketch/SketchFields.js +148 -0
- package/lib/ColorPicker/SketchPicker/components/sketch/SketchPresetColors.js +72 -0
- package/lib/ColorPicker/SketchPicker/components/sketch/index.js +160 -0
- package/lib/ColorPicker/SketchPicker/helpers/alpha.js +46 -0
- package/lib/ColorPicker/SketchPicker/helpers/checkboard.js +29 -0
- package/lib/ColorPicker/SketchPicker/helpers/color.js +86 -0
- package/lib/ColorPicker/SketchPicker/helpers/hue.js +48 -0
- package/lib/ColorPicker/SketchPicker/helpers/index.js +2 -0
- package/lib/ColorPicker/SketchPicker/helpers/interaction.js +55 -0
- package/lib/ColorPicker/SketchPicker/helpers/saturation.js +28 -0
- package/lib/ColorPicker/index.js +2 -3
- package/lib/QuickTransfer/Drag.js +4 -2
- package/lib/QuickTransfer/DragList.js +27 -4
- package/lib/QuickTransfer/index.js +12 -5
- package/package.json +2 -4
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
6
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
9
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
11
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
13
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
import React, { Component, PureComponent } from 'react';
|
|
18
|
+
import reactCSS from 'reactcss';
|
|
19
|
+
import * as alpha from '../../helpers/alpha';
|
|
20
|
+
import Checkboard from './Checkboard';
|
|
21
|
+
export var Alpha = /*#__PURE__*/function (_ref) {
|
|
22
|
+
_inherits(Alpha, _ref);
|
|
23
|
+
function Alpha() {
|
|
24
|
+
var _this;
|
|
25
|
+
_classCallCheck(this, Alpha);
|
|
26
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
|
+
args[_key] = arguments[_key];
|
|
28
|
+
}
|
|
29
|
+
_this = _callSuper(this, Alpha, [].concat(args));
|
|
30
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function (e) {
|
|
31
|
+
var change = alpha.calculateChange(e, _this.props.hsl, _this.props.direction, _this.props.a, _this.container);
|
|
32
|
+
change && typeof _this.props.onChange === 'function' && _this.props.onChange(change, e);
|
|
33
|
+
});
|
|
34
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseDown", function (e) {
|
|
35
|
+
_this.handleChange(e);
|
|
36
|
+
window.addEventListener('mousemove', _this.handleChange);
|
|
37
|
+
window.addEventListener('mouseup', _this.handleMouseUp);
|
|
38
|
+
});
|
|
39
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseUp", function () {
|
|
40
|
+
_this.unbindEventListeners();
|
|
41
|
+
});
|
|
42
|
+
_defineProperty(_assertThisInitialized(_this), "unbindEventListeners", function () {
|
|
43
|
+
window.removeEventListener('mousemove', _this.handleChange);
|
|
44
|
+
window.removeEventListener('mouseup', _this.handleMouseUp);
|
|
45
|
+
});
|
|
46
|
+
return _this;
|
|
47
|
+
}
|
|
48
|
+
_createClass(Alpha, [{
|
|
49
|
+
key: "componentWillUnmount",
|
|
50
|
+
value: function componentWillUnmount() {
|
|
51
|
+
this.unbindEventListeners();
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "render",
|
|
55
|
+
value: function render() {
|
|
56
|
+
var _this2 = this;
|
|
57
|
+
var rgb = this.props.rgb;
|
|
58
|
+
var styles = reactCSS({
|
|
59
|
+
'default': {
|
|
60
|
+
alpha: {
|
|
61
|
+
absolute: '0px 0px 0px 0px',
|
|
62
|
+
borderRadius: this.props.radius
|
|
63
|
+
},
|
|
64
|
+
checkboard: {
|
|
65
|
+
absolute: '0px 0px 0px 0px',
|
|
66
|
+
overflow: 'hidden',
|
|
67
|
+
borderRadius: this.props.radius
|
|
68
|
+
},
|
|
69
|
+
gradient: {
|
|
70
|
+
absolute: '0px 0px 0px 0px',
|
|
71
|
+
background: "linear-gradient(to right, rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ", 0) 0%,\n rgba(").concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ", 1) 100%)"),
|
|
72
|
+
boxShadow: this.props.shadow,
|
|
73
|
+
borderRadius: this.props.radius
|
|
74
|
+
},
|
|
75
|
+
container: {
|
|
76
|
+
position: 'relative',
|
|
77
|
+
height: '100%',
|
|
78
|
+
margin: '0 3px'
|
|
79
|
+
},
|
|
80
|
+
pointer: {
|
|
81
|
+
position: 'absolute',
|
|
82
|
+
left: "".concat(rgb.a * 100, "%")
|
|
83
|
+
},
|
|
84
|
+
slider: {
|
|
85
|
+
width: '4px',
|
|
86
|
+
borderRadius: '1px',
|
|
87
|
+
height: '8px',
|
|
88
|
+
boxShadow: '0 0 2px rgba(0, 0, 0, .6)',
|
|
89
|
+
background: '#fff',
|
|
90
|
+
marginTop: '1px',
|
|
91
|
+
transform: 'translateX(-2px)'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
'vertical': {
|
|
95
|
+
gradient: {
|
|
96
|
+
background: "linear-gradient(to bottom, rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ", 0) 0%,\n rgba(").concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ", 1) 100%)")
|
|
97
|
+
},
|
|
98
|
+
pointer: {
|
|
99
|
+
left: 0,
|
|
100
|
+
top: "".concat(rgb.a * 100, "%")
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
'overwrite': _objectSpread({}, this.props.style)
|
|
104
|
+
}, {
|
|
105
|
+
vertical: this.props.direction === 'vertical',
|
|
106
|
+
overwrite: true
|
|
107
|
+
});
|
|
108
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
109
|
+
style: styles.alpha
|
|
110
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
111
|
+
style: styles.checkboard
|
|
112
|
+
}, /*#__PURE__*/React.createElement(Checkboard, {
|
|
113
|
+
renderers: this.props.renderers
|
|
114
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
115
|
+
style: styles.gradient
|
|
116
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
117
|
+
style: styles.container,
|
|
118
|
+
ref: function ref(container) {
|
|
119
|
+
return _this2.container = container;
|
|
120
|
+
},
|
|
121
|
+
onMouseDown: this.handleMouseDown,
|
|
122
|
+
onTouchMove: this.handleChange,
|
|
123
|
+
onTouchStart: this.handleChange
|
|
124
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
125
|
+
style: styles.pointer
|
|
126
|
+
}, this.props.pointer ? /*#__PURE__*/React.createElement(this.props.pointer, this.props) : /*#__PURE__*/React.createElement("div", {
|
|
127
|
+
style: styles.slider
|
|
128
|
+
}))));
|
|
129
|
+
}
|
|
130
|
+
}]);
|
|
131
|
+
return Alpha;
|
|
132
|
+
}(PureComponent || Component);
|
|
133
|
+
export default Alpha;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import React, { isValidElement } from 'react';
|
|
8
|
+
import reactCSS from 'reactcss';
|
|
9
|
+
import * as checkboard from '../../helpers/checkboard';
|
|
10
|
+
export var Checkboard = function Checkboard(_ref) {
|
|
11
|
+
var white = _ref.white,
|
|
12
|
+
grey = _ref.grey,
|
|
13
|
+
size = _ref.size,
|
|
14
|
+
renderers = _ref.renderers,
|
|
15
|
+
borderRadius = _ref.borderRadius,
|
|
16
|
+
boxShadow = _ref.boxShadow,
|
|
17
|
+
children = _ref.children;
|
|
18
|
+
var styles = reactCSS({
|
|
19
|
+
'default': {
|
|
20
|
+
grid: {
|
|
21
|
+
borderRadius: borderRadius,
|
|
22
|
+
boxShadow: boxShadow,
|
|
23
|
+
absolute: '0px 0px 0px 0px',
|
|
24
|
+
background: "url(".concat(checkboard.get(white, grey, size, renderers.canvas), ") center left")
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return /*#__PURE__*/isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, {
|
|
29
|
+
style: _objectSpread(_objectSpread({}, children.props.style), styles.grid)
|
|
30
|
+
})) : /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
style: styles.grid
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Checkboard.defaultProps = {
|
|
35
|
+
size: 8,
|
|
36
|
+
white: 'transparent',
|
|
37
|
+
grey: 'rgba(0,0,0,.08)',
|
|
38
|
+
renderers: {}
|
|
39
|
+
};
|
|
40
|
+
export default Checkboard;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
10
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
12
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
13
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
14
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
+
import React, { Component, PureComponent } from 'react';
|
|
19
|
+
import debounce from 'lodash/debounce';
|
|
20
|
+
import * as color from '../../helpers/color';
|
|
21
|
+
export var ColorWrap = function ColorWrap(Picker) {
|
|
22
|
+
var ColorPicker = /*#__PURE__*/function (_ref) {
|
|
23
|
+
_inherits(ColorPicker, _ref);
|
|
24
|
+
function ColorPicker(props) {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, ColorPicker);
|
|
27
|
+
_this = _callSuper(this, ColorPicker);
|
|
28
|
+
// static getDerivedStateFromProps(nextProps, state) {
|
|
29
|
+
// return {
|
|
30
|
+
// ...color.toState(nextProps.color, state.oldHue),
|
|
31
|
+
// }
|
|
32
|
+
// }
|
|
33
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function (data, event) {
|
|
34
|
+
var isValidColor = color.simpleCheckForValidColor(data);
|
|
35
|
+
if (isValidColor) {
|
|
36
|
+
var colors = color.toState(data, data.h || _this.state.oldHue);
|
|
37
|
+
_this.setState(colors);
|
|
38
|
+
_this.props.onChangeComplete && _this.debounce(_this.props.onChangeComplete, colors, event);
|
|
39
|
+
_this.props.onChange && _this.props.onChange(colors, event);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
_defineProperty(_assertThisInitialized(_this), "handleSwatchHover", function (data, event) {
|
|
43
|
+
var isValidColor = color.simpleCheckForValidColor(data);
|
|
44
|
+
if (isValidColor) {
|
|
45
|
+
var colors = color.toState(data, data.h || _this.state.oldHue);
|
|
46
|
+
_this.props.onSwatchHover && _this.props.onSwatchHover(colors, event);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
_this.state = _objectSpread({}, color.toState(props.color, 0));
|
|
50
|
+
_this.debounce = debounce(function (fn, data, event) {
|
|
51
|
+
fn(data, event);
|
|
52
|
+
}, 100);
|
|
53
|
+
return _this;
|
|
54
|
+
}
|
|
55
|
+
_createClass(ColorPicker, [{
|
|
56
|
+
key: "render",
|
|
57
|
+
value: function render() {
|
|
58
|
+
var optionalEvents = {};
|
|
59
|
+
if (this.props.onSwatchHover) {
|
|
60
|
+
optionalEvents.onSwatchHover = this.handleSwatchHover;
|
|
61
|
+
}
|
|
62
|
+
return /*#__PURE__*/React.createElement(Picker, _extends({}, this.props, this.state, {
|
|
63
|
+
onChange: this.handleChange
|
|
64
|
+
}, optionalEvents));
|
|
65
|
+
}
|
|
66
|
+
}]);
|
|
67
|
+
return ColorPicker;
|
|
68
|
+
}(PureComponent || Component);
|
|
69
|
+
ColorPicker.propTypes = _objectSpread({}, Picker.propTypes);
|
|
70
|
+
ColorPicker.defaultProps = _objectSpread(_objectSpread({}, Picker.defaultProps), {}, {
|
|
71
|
+
color: {
|
|
72
|
+
h: 250,
|
|
73
|
+
s: 0.50,
|
|
74
|
+
l: 0.20,
|
|
75
|
+
a: 1
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return ColorPicker;
|
|
79
|
+
};
|
|
80
|
+
export default ColorWrap;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
7
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
8
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
9
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
10
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
import React, { Component, PureComponent } from 'react';
|
|
16
|
+
import reactCSS from 'reactcss';
|
|
17
|
+
var DEFAULT_ARROW_OFFSET = 1;
|
|
18
|
+
var UP_KEY_CODE = 38;
|
|
19
|
+
var DOWN_KEY_CODE = 40;
|
|
20
|
+
var VALID_KEY_CODES = [UP_KEY_CODE, DOWN_KEY_CODE];
|
|
21
|
+
var isValidKeyCode = function isValidKeyCode(keyCode) {
|
|
22
|
+
return VALID_KEY_CODES.indexOf(keyCode) > -1;
|
|
23
|
+
};
|
|
24
|
+
var getNumberValue = function getNumberValue(value) {
|
|
25
|
+
return Number(String(value).replace(/%/g, ''));
|
|
26
|
+
};
|
|
27
|
+
var idCounter = 1;
|
|
28
|
+
export var EditableInput = /*#__PURE__*/function (_ref) {
|
|
29
|
+
_inherits(EditableInput, _ref);
|
|
30
|
+
function EditableInput(props) {
|
|
31
|
+
var _this;
|
|
32
|
+
_classCallCheck(this, EditableInput);
|
|
33
|
+
_this = _callSuper(this, EditableInput);
|
|
34
|
+
_defineProperty(_assertThisInitialized(_this), "handleBlur", function () {
|
|
35
|
+
if (_this.state.blurValue) {
|
|
36
|
+
_this.setState({
|
|
37
|
+
value: _this.state.blurValue,
|
|
38
|
+
blurValue: null
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function (e) {
|
|
43
|
+
_this.setUpdatedValue(e.target.value, e);
|
|
44
|
+
});
|
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (e) {
|
|
46
|
+
// In case `e.target.value` is a percentage remove the `%` character
|
|
47
|
+
// and update accordingly with a percentage
|
|
48
|
+
// https://github.com/casesandberg/react-color/issues/383
|
|
49
|
+
var value = getNumberValue(e.target.value);
|
|
50
|
+
if (!isNaN(value) && isValidKeyCode(e.keyCode)) {
|
|
51
|
+
var offset = _this.getArrowOffset();
|
|
52
|
+
var updatedValue = e.keyCode === UP_KEY_CODE ? value + offset : value - offset;
|
|
53
|
+
_this.setUpdatedValue(updatedValue, e);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "handleDrag", function (e) {
|
|
57
|
+
if (_this.props.dragLabel) {
|
|
58
|
+
var newValue = Math.round(_this.props.value + e.movementX);
|
|
59
|
+
if (newValue >= 0 && newValue <= _this.props.dragMax) {
|
|
60
|
+
_this.props.onChange && _this.props.onChange(_this.getValueObjectWithLabel(newValue), e);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseDown", function (e) {
|
|
65
|
+
if (_this.props.dragLabel) {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
_this.handleDrag(e);
|
|
68
|
+
window.addEventListener('mousemove', _this.handleDrag);
|
|
69
|
+
window.addEventListener('mouseup', _this.handleMouseUp);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseUp", function () {
|
|
73
|
+
_this.unbindEventListeners();
|
|
74
|
+
});
|
|
75
|
+
_defineProperty(_assertThisInitialized(_this), "unbindEventListeners", function () {
|
|
76
|
+
window.removeEventListener('mousemove', _this.handleDrag);
|
|
77
|
+
window.removeEventListener('mouseup', _this.handleMouseUp);
|
|
78
|
+
});
|
|
79
|
+
_this.state = {
|
|
80
|
+
value: String(props.value).toUpperCase(),
|
|
81
|
+
blurValue: String(props.value).toUpperCase()
|
|
82
|
+
};
|
|
83
|
+
_this.inputId = "rc-editable-input-".concat(idCounter++);
|
|
84
|
+
return _this;
|
|
85
|
+
}
|
|
86
|
+
_createClass(EditableInput, [{
|
|
87
|
+
key: "componentDidUpdate",
|
|
88
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
89
|
+
if (this.props.value !== this.state.value && (prevProps.value !== this.props.value || prevState.value !== this.state.value)) {
|
|
90
|
+
if (this.input === document.activeElement) {
|
|
91
|
+
this.setState({
|
|
92
|
+
blurValue: String(this.props.value).toUpperCase()
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
this.setState({
|
|
96
|
+
value: String(this.props.value).toUpperCase(),
|
|
97
|
+
blurValue: !this.state.blurValue && String(this.props.value).toUpperCase()
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
key: "componentWillUnmount",
|
|
104
|
+
value: function componentWillUnmount() {
|
|
105
|
+
this.unbindEventListeners();
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
key: "getValueObjectWithLabel",
|
|
109
|
+
value: function getValueObjectWithLabel(value) {
|
|
110
|
+
return _defineProperty({}, this.props.label, value);
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
key: "getArrowOffset",
|
|
114
|
+
value: function getArrowOffset() {
|
|
115
|
+
return this.props.arrowOffset || DEFAULT_ARROW_OFFSET;
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "setUpdatedValue",
|
|
119
|
+
value: function setUpdatedValue(value, e) {
|
|
120
|
+
var onChangeValue = this.props.label ? this.getValueObjectWithLabel(value) : value;
|
|
121
|
+
this.props.onChange && this.props.onChange(onChangeValue, e);
|
|
122
|
+
this.setState({
|
|
123
|
+
value: value
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
127
|
+
key: "render",
|
|
128
|
+
value: function render() {
|
|
129
|
+
var _this2 = this;
|
|
130
|
+
var styles = reactCSS({
|
|
131
|
+
'default': {
|
|
132
|
+
wrap: {
|
|
133
|
+
position: 'relative'
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
'user-override': {
|
|
137
|
+
wrap: this.props.style && this.props.style.wrap ? this.props.style.wrap : {},
|
|
138
|
+
input: this.props.style && this.props.style.input ? this.props.style.input : {},
|
|
139
|
+
label: this.props.style && this.props.style.label ? this.props.style.label : {}
|
|
140
|
+
},
|
|
141
|
+
'dragLabel-true': {
|
|
142
|
+
label: {
|
|
143
|
+
cursor: 'ew-resize'
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}, {
|
|
147
|
+
'user-override': true
|
|
148
|
+
}, this.props);
|
|
149
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
150
|
+
style: styles.wrap
|
|
151
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
152
|
+
id: this.inputId,
|
|
153
|
+
style: styles.input,
|
|
154
|
+
ref: function ref(input) {
|
|
155
|
+
return _this2.input = input;
|
|
156
|
+
},
|
|
157
|
+
value: this.state.value,
|
|
158
|
+
onKeyDown: this.handleKeyDown,
|
|
159
|
+
onChange: this.handleChange,
|
|
160
|
+
onBlur: this.handleBlur,
|
|
161
|
+
placeholder: this.props.placeholder,
|
|
162
|
+
spellCheck: "false"
|
|
163
|
+
}), this.props.label && !this.props.hideLabel ? /*#__PURE__*/React.createElement("label", {
|
|
164
|
+
htmlFor: this.inputId,
|
|
165
|
+
style: styles.label,
|
|
166
|
+
onMouseDown: this.handleMouseDown
|
|
167
|
+
}, this.props.label) : null);
|
|
168
|
+
}
|
|
169
|
+
}]);
|
|
170
|
+
return EditableInput;
|
|
171
|
+
}(PureComponent || Component);
|
|
172
|
+
export default EditableInput;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
7
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
8
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
9
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
10
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
import React, { Component, PureComponent } from "react";
|
|
16
|
+
import reactCSS from "reactcss";
|
|
17
|
+
import * as hue from "../../helpers/hue";
|
|
18
|
+
import { floor, round } from "@chaoswise/utils";
|
|
19
|
+
export var Hue = /*#__PURE__*/function (_ref) {
|
|
20
|
+
_inherits(Hue, _ref);
|
|
21
|
+
function Hue() {
|
|
22
|
+
var _this;
|
|
23
|
+
_classCallCheck(this, Hue);
|
|
24
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
|
+
args[_key] = arguments[_key];
|
|
26
|
+
}
|
|
27
|
+
_this = _callSuper(this, Hue, [].concat(args));
|
|
28
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function (e) {
|
|
29
|
+
var change = hue.calculateChange(e, _this.props.direction, _this.props.hsl, _this.container);
|
|
30
|
+
change && typeof _this.props.onChange === "function" && _this.props.onChange(change, e);
|
|
31
|
+
});
|
|
32
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseDown", function (e) {
|
|
33
|
+
_this.handleChange(e);
|
|
34
|
+
window.addEventListener("mousemove", _this.handleChange);
|
|
35
|
+
window.addEventListener("mouseup", _this.handleMouseUp);
|
|
36
|
+
});
|
|
37
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseUp", function () {
|
|
38
|
+
_this.unbindEventListeners();
|
|
39
|
+
});
|
|
40
|
+
return _this;
|
|
41
|
+
}
|
|
42
|
+
_createClass(Hue, [{
|
|
43
|
+
key: "componentWillUnmount",
|
|
44
|
+
value: function componentWillUnmount() {
|
|
45
|
+
this.unbindEventListeners();
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
key: "unbindEventListeners",
|
|
49
|
+
value: function unbindEventListeners() {
|
|
50
|
+
window.removeEventListener("mousemove", this.handleChange);
|
|
51
|
+
window.removeEventListener("mouseup", this.handleMouseUp);
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "render",
|
|
55
|
+
value: function render() {
|
|
56
|
+
var _this2 = this;
|
|
57
|
+
var _this$props$direction = this.props.direction,
|
|
58
|
+
direction = _this$props$direction === void 0 ? "horizontal" : _this$props$direction;
|
|
59
|
+
var leftValue = this.props.hsl.h * 100 / 360;
|
|
60
|
+
var resLeft = floor(leftValue) === 0 ? 0 : round(leftValue);
|
|
61
|
+
var styles = reactCSS({
|
|
62
|
+
"default": {
|
|
63
|
+
hue: {
|
|
64
|
+
absolute: "0px 0px 0px 0px",
|
|
65
|
+
borderRadius: this.props.radius,
|
|
66
|
+
boxShadow: this.props.shadow
|
|
67
|
+
},
|
|
68
|
+
container: {
|
|
69
|
+
margin: "0 3px",
|
|
70
|
+
position: "relative",
|
|
71
|
+
height: "100%",
|
|
72
|
+
borderRadius: this.props.radius
|
|
73
|
+
},
|
|
74
|
+
pointer: {
|
|
75
|
+
position: "absolute",
|
|
76
|
+
left: "".concat(resLeft, "%")
|
|
77
|
+
},
|
|
78
|
+
slider: {
|
|
79
|
+
marginTop: "1px",
|
|
80
|
+
width: "4px",
|
|
81
|
+
borderRadius: "1px",
|
|
82
|
+
height: "8px",
|
|
83
|
+
boxShadow: "0 0 2px rgba(0, 0, 0, .6)",
|
|
84
|
+
background: "#fff",
|
|
85
|
+
transform: "translateX(-2px)"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
vertical: {
|
|
89
|
+
pointer: {
|
|
90
|
+
left: "0px",
|
|
91
|
+
top: "".concat(-(this.props.hsl.h * 100 / 360) + 100, "%")
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
vertical: direction === "vertical"
|
|
96
|
+
});
|
|
97
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
style: styles.hue,
|
|
99
|
+
className: "hue-".concat(direction, "-custom")
|
|
100
|
+
}, /*#__PURE__*/React.createElement("style", null, "\n .hue-horizontal-custom {\n background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0\n 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n background: -webkit-linear-gradient(to right, #f00 0%, #ff0\n 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n }\n\n .hue-vertical {\n background: linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%,\n #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n background: -webkit-linear-gradient(to top, #f00 0%, #ff0 17%,\n #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n }\n "), /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: "hue-".concat(direction),
|
|
102
|
+
style: styles.container,
|
|
103
|
+
ref: function ref(container) {
|
|
104
|
+
return _this2.container = container;
|
|
105
|
+
},
|
|
106
|
+
onMouseDown: this.handleMouseDown,
|
|
107
|
+
onTouchMove: this.handleChange,
|
|
108
|
+
onTouchStart: this.handleChange
|
|
109
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
style: styles.pointer
|
|
111
|
+
}, this.props.pointer ? /*#__PURE__*/React.createElement(this.props.pointer, this.props) : /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
style: styles.slider
|
|
113
|
+
}))));
|
|
114
|
+
}
|
|
115
|
+
}]);
|
|
116
|
+
return Hue;
|
|
117
|
+
}(PureComponent || Component);
|
|
118
|
+
export default Hue;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import reactCSS from 'reactcss';
|
|
4
|
+
import merge from 'lodash/merge';
|
|
5
|
+
export var Raised = function Raised(_ref) {
|
|
6
|
+
var zDepth = _ref.zDepth,
|
|
7
|
+
radius = _ref.radius,
|
|
8
|
+
background = _ref.background,
|
|
9
|
+
children = _ref.children,
|
|
10
|
+
_ref$styles = _ref.styles,
|
|
11
|
+
passedStyles = _ref$styles === void 0 ? {} : _ref$styles;
|
|
12
|
+
var styles = reactCSS(merge({
|
|
13
|
+
'default': {
|
|
14
|
+
wrap: {
|
|
15
|
+
position: 'relative',
|
|
16
|
+
display: 'inline-block'
|
|
17
|
+
},
|
|
18
|
+
content: {
|
|
19
|
+
position: 'relative'
|
|
20
|
+
},
|
|
21
|
+
bg: {
|
|
22
|
+
absolute: '0px 0px 0px 0px',
|
|
23
|
+
boxShadow: "0 ".concat(zDepth, "px ").concat(zDepth * 4, "px rgba(0,0,0,.24)"),
|
|
24
|
+
borderRadius: radius,
|
|
25
|
+
background: background
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
'zDepth-0': {
|
|
29
|
+
bg: {
|
|
30
|
+
boxShadow: 'none'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
'zDepth-1': {
|
|
34
|
+
bg: {
|
|
35
|
+
boxShadow: '0 2px 10px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.16)'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
'zDepth-2': {
|
|
39
|
+
bg: {
|
|
40
|
+
boxShadow: '0 6px 20px rgba(0,0,0,.19), 0 8px 17px rgba(0,0,0,.2)'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
'zDepth-3': {
|
|
44
|
+
bg: {
|
|
45
|
+
boxShadow: '0 17px 50px rgba(0,0,0,.19), 0 12px 15px rgba(0,0,0,.24)'
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
'zDepth-4': {
|
|
49
|
+
bg: {
|
|
50
|
+
boxShadow: '0 25px 55px rgba(0,0,0,.21), 0 16px 28px rgba(0,0,0,.22)'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
'zDepth-5': {
|
|
54
|
+
bg: {
|
|
55
|
+
boxShadow: '0 40px 77px rgba(0,0,0,.22), 0 27px 24px rgba(0,0,0,.2)'
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
'square': {
|
|
59
|
+
bg: {
|
|
60
|
+
borderRadius: '0'
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
'circle': {
|
|
64
|
+
bg: {
|
|
65
|
+
borderRadius: '50%'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, passedStyles), {
|
|
69
|
+
'zDepth-1': zDepth === 1
|
|
70
|
+
});
|
|
71
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
style: styles.wrap
|
|
73
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
style: styles.bg
|
|
75
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
style: styles.content
|
|
77
|
+
}, children));
|
|
78
|
+
};
|
|
79
|
+
Raised.propTypes = {
|
|
80
|
+
background: PropTypes.string,
|
|
81
|
+
zDepth: PropTypes.oneOf([0, 1, 2, 3, 4, 5]),
|
|
82
|
+
radius: PropTypes.number,
|
|
83
|
+
styles: PropTypes.object
|
|
84
|
+
};
|
|
85
|
+
Raised.defaultProps = {
|
|
86
|
+
background: '#fff',
|
|
87
|
+
zDepth: 1,
|
|
88
|
+
radius: 2,
|
|
89
|
+
styles: {}
|
|
90
|
+
};
|
|
91
|
+
export default Raised;
|