rc-color-picker
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -7,2 +7,4 @@ 'use strict'; | ||
var _extends = Object.assign || 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; }; | ||
var _createClass = (function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
@@ -56,5 +58,7 @@ | ||
var alpha = typeof props.alpha === 'undefined' ? props.defaultAlpha : Math.min(props.alpha, props.defaultAlpha); | ||
this.state = { | ||
color: props.color || props.defaultColor, | ||
alpha: props.alpha || props.defaultAlpha, | ||
alpha: alpha, | ||
open: false | ||
@@ -97,7 +101,7 @@ }; | ||
value: function onChange(colors) { | ||
this.setState({ | ||
color: colors.color, | ||
alpha: colors.alpha | ||
var _this2 = this; | ||
this.setState(_extends({}, colors), function () { | ||
_this2.props.onChange(_this2.state); | ||
}); | ||
this.props.onChange(colors); | ||
} | ||
@@ -107,5 +111,3 @@ }, { | ||
value: function onBlur() { | ||
this.setState({ | ||
open: false | ||
}); | ||
this.setOpen(false); | ||
} | ||
@@ -115,7 +117,7 @@ }, { | ||
value: function onVisibleChange(open) { | ||
var _this2 = this; | ||
var _this3 = this; | ||
this.setOpen(open, function () { | ||
if (open) { | ||
_reactDom2['default'].findDOMNode(_this2.pickerPanelInstance).focus(); | ||
_reactDom2['default'].findDOMNode(_this3.pickerPanelInstance).focus(); | ||
} | ||
@@ -127,2 +129,4 @@ }); | ||
value: function setOpen(open, callback) { | ||
var _this4 = this; | ||
var _props = this.props; | ||
@@ -135,11 +139,13 @@ var onOpen = _props.onOpen; | ||
open: open | ||
}, callback); | ||
var _event = { | ||
open: open | ||
}; | ||
if (open) { | ||
onOpen(_event); | ||
} else { | ||
onClose(_event); | ||
} | ||
}, function () { | ||
if (typeof callback === 'function') { | ||
callback(); | ||
} | ||
if (_this4.state.open) { | ||
onOpen(_this4.state); | ||
} else { | ||
onClose(_this4.state); | ||
} | ||
}); | ||
} | ||
@@ -146,0 +152,0 @@ } |
@@ -66,6 +66,8 @@ 'use strict'; | ||
var alpha = typeof props.alpha === 'undefined' ? props.defaultAlpha : Math.min(props.alpha, props.defaultAlpha); | ||
this.state = { | ||
paramsHsv: hsv, | ||
hsv: hsv, | ||
alpha: props.alpha || props.defaultAlpha | ||
alpha: alpha | ||
}; | ||
@@ -86,3 +88,4 @@ | ||
this.setState({ | ||
hsv: hsv | ||
hsv: hsv, | ||
paramsHsv: hsv | ||
}); | ||
@@ -89,0 +92,0 @@ } |
{ | ||
"name": "rc-color-picker", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "color-picker ui component for react", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -9,8 +9,9 @@ # rc-color-picker | ||
[![npm dependency](https://david-dm.org/react-component/color-picker.svg)](https://david-dm.org/react-component/color-picker) | ||
[![Build Status](https://travis-ci.org/react-component/color-picker.svg?branch=master)](https://travis-ci.org/react-component/color-picker) | ||
## Browser Support | ||
|![IE](https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png) | ![Chrome](https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png)| | ||
| --- | --- | --- | --- | --- | | ||
| IE 10+ ✔ | Chrome 31.0+ ✔ | Firefox 31.0+ ✔ | Opera 30.0+ ✔ | Safari 7.0+ ✔ | | ||
| ![Chrome](https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png) | ![Edge](https://raw.github.com/alrra/browser-logos/master/edge/edge_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png) | | ||
| --- | --- | --- | --- | --- | --- | | ||
| Chrome 31.0+ ✔ | Edge 12.0+ ✔ | Firefox 31.0+ ✔ | IE 10+ ✔ | Opera 30.0+ ✔ | Safari 7.0+ ✔ | | ||
@@ -17,0 +18,0 @@ ## Screenshots |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73420
1793
88