diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..f2de52a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,31 @@ +[brief explanation of changes] + +#### Asana Ticket +paste the link here + +#### Jira Ticket +paste the link here + +#### Deployment Details +[step by step guide of what is needed to deploy these changes to production] +* env variables or settings that need to be updated +* are these changes dependant on other work? +* are there feature flags that need to be set? + +#### QA Guide +[Steps for assignee responsible for merging to qa changes. Reminder: the assignee is responsible for the happy path once merged] +* Include screenshots or screencasts for all UI changes +* Answer theses questions in a comment on the Asana Ticket: + * What is the best way to test the changes? +* Make sure to test the Herkou Review App for this Branch and have it ready for QA + +#### Security +- [ ] Security impact of change has been considered +- [ ] Code follows company security practices and guidelines + +Reminders +- [ ] Add Reviewer and Assignee, if unsure refer to the [Areas of Expertise Doc](https://sayrhino.atlassian.net/wiki/spaces/EN/pages/1644298426/Areas+of+Expertise) +- [ ] All scenarios are tested +- [ ] Feature tests are added if UI changed +- [ ] Schema and migrations are current +- [ ] A11y guidelines are followed [WCAG](https://www.w3.org/WAI/standards-guidelines/wcag/) diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65c2e60..0000000 --- a/lib/index.js +++ /dev/null @@ -1,319 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -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; }; }(); - -var _propTypes = require('prop-types'); - -var _propTypes2 = _interopRequireDefault(_propTypes); - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _reactDom = require('react-dom'); - -var _reactDom2 = _interopRequireDefault(_reactDom); - -var _mask3 = require('./mask.js'); - -var _mask4 = _interopRequireDefault(_mask3); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -// IE* parseFloat polyfill -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/parseFloat#Polyfill -Number.parseFloat = parseFloat; - -var CurrencyInput = function (_Component) { - _inherits(CurrencyInput, _Component); - - function CurrencyInput(props) { - _classCallCheck(this, CurrencyInput); - - var _this = _possibleConstructorReturn(this, (CurrencyInput.__proto__ || Object.getPrototypeOf(CurrencyInput)).call(this, props)); - - _this.prepareProps = _this.prepareProps.bind(_this); - _this.handleChange = _this.handleChange.bind(_this); - _this.handleFocus = _this.handleFocus.bind(_this); - _this.state = _this.prepareProps(_this.props); - - _this.inputSelectionStart = 0; - _this.inputSelectionEnd = 0; - return _this; - } - - /** - * Exposes the current masked value. - * - * @returns {String} - */ - - - _createClass(CurrencyInput, [{ - key: 'getMaskedValue', - value: function getMaskedValue() { - return this.state.maskedValue; - } - - /** - * General function used to cleanup and define the final props used for rendering - * @returns {{ maskedValue: {String}, value: {Number}, customProps: {Object} }} - */ - - }, { - key: 'prepareProps', - value: function prepareProps(props) { - var customProps = _extends({}, props); // babeljs converts to Object.assign, then polyfills. - delete customProps.onChange; - delete customProps.onChangeEvent; - delete customProps.value; - delete customProps.decimalSeparator; - delete customProps.thousandSeparator; - delete customProps.precision; - delete customProps.inputType; - delete customProps.allowNegative; - delete customProps.allowEmpty; - delete customProps.prefix; - delete customProps.suffix; - - var initialValue = props.value; - if (initialValue === null) { - initialValue = props.allowEmpty ? null : ''; - } else { - - if (typeof initialValue == 'string') { - // Some people, when confronted with a problem, think "I know, I'll use regular expressions." - // Now they have two problems. - - // Strip out thousand separators, prefix, and suffix, etc. - if (props.thousandSeparator === ".") { - // special handle the . thousand separator - initialValue = initialValue.replace(/\./g, ''); - } - - if (props.decimalSeparator != ".") { - // fix the decimal separator - initialValue = initialValue.replace(new RegExp(props.decimalSeparator, 'g'), '.'); - } - - //Strip out anything that is not a digit, -, or decimal separator - initialValue = initialValue.replace(/[^0-9-.]/g, ''); - - // now we can parse. - initialValue = Number.parseFloat(initialValue); - } - initialValue = Number(initialValue).toLocaleString(undefined, { - style: 'decimal', - minimumFractionDigits: props.precision, - maximumFractionDigits: props.precision - }); - } - - var _mask = (0, _mask4.default)(initialValue, props.precision, props.decimalSeparator, props.thousandSeparator, props.allowNegative, props.prefix, props.suffix), - maskedValue = _mask.maskedValue, - value = _mask.value; - - return { maskedValue: maskedValue, value: value, customProps: customProps }; - } - - /** - * Component lifecycle function. - * Invoked when a component is receiving new props. This method is not called for the initial render. - * - * @param nextProps - * @see https://facebook.github.io/react/docs/component-specs.html#updating-componentwillreceiveprops - */ - - }, { - key: 'componentWillReceiveProps', - value: function componentWillReceiveProps(nextProps) { - this.setState(this.prepareProps(nextProps)); - } - - /** - * Component lifecycle function. - * @returns {XML} - * @see https://facebook.github.io/react/docs/react-component.html#componentdidmount - */ - - }, { - key: 'componentDidMount', - value: function componentDidMount() { - var node = _reactDom2.default.findDOMNode(this.theInput); - - var selectionEnd = Math.min(node.selectionEnd, this.theInput.value.length - this.props.suffix.length); - var selectionStart = Math.min(node.selectionStart, selectionEnd); - //console.log("normal", selectionStart, selectionEnd); - node.setSelectionRange(selectionStart, selectionEnd); - } - - /** - * Component lifecycle function - * @returns {XML} - * @see https://facebook.github.io/react/docs/react-component.html#componentwillupdate - */ - - }, { - key: 'componentWillUpdate', - value: function componentWillUpdate() { - var node = _reactDom2.default.findDOMNode(this.theInput); - this.inputSelectionStart = node.selectionStart; - this.inputSelectionEnd = node.selectionEnd; - } - - /** - * Component lifecycle function. - * @returns {XML} - * @see https://facebook.github.io/react/docs/react-component.html#componentdidupdate - */ - - }, { - key: 'componentDidUpdate', - value: function componentDidUpdate(prevProps, prevState) { - - var node = _reactDom2.default.findDOMNode(this.theInput); - var isNegative = (this.theInput.value.match(/-/g) || []).length % 2 === 1; - var minPos = this.props.prefix.length + (isNegative ? 1 : 0); - var selectionEnd = Math.max(minPos, Math.min(this.inputSelectionEnd, this.theInput.value.length - this.props.suffix.length)); - var selectionStart = Math.max(minPos, Math.min(this.inputSelectionEnd, selectionEnd)); - - var regexEscapeRegex = /[-[\]{}()*+?.,\\^$|#\s]/g; - var separatorsRegex = new RegExp(this.props.decimalSeparator.replace(regexEscapeRegex, '\\$&') + '|' + this.props.thousandSeparator.replace(regexEscapeRegex, '\\$&'), 'g'); - var currSeparatorCount = (this.state.maskedValue.match(separatorsRegex) || []).length; - var prevSeparatorCount = (prevState.maskedValue.match(separatorsRegex) || []).length; - var adjustment = Math.max(currSeparatorCount - prevSeparatorCount, 0); - - selectionEnd = selectionEnd + adjustment; - selectionStart = selectionStart + adjustment; - - var baselength = this.props.suffix.length + this.props.prefix.length + this.props.decimalSeparator.length + Number(this.props.precision) + 1; // This is to account for the default '0' value that comes before the decimal separator - - if (this.state.maskedValue.length == baselength) { - // if we are already at base length, position the cursor at the end. - selectionEnd = this.theInput.value.length - this.props.suffix.length; - selectionStart = selectionEnd; - } - - node.setSelectionRange(selectionStart, selectionEnd); - this.inputSelectionStart = selectionStart; - this.inputSelectionEnd = selectionEnd; - } - - /** - * onChange Event Handler - * @param event - */ - - }, { - key: 'handleChange', - value: function handleChange(event) { - var _this2 = this; - - event.preventDefault(); - - var _mask2 = (0, _mask4.default)(event.target.value, this.props.precision, this.props.decimalSeparator, this.props.thousandSeparator, this.props.allowNegative, this.props.prefix, this.props.suffix), - maskedValue = _mask2.maskedValue, - value = _mask2.value; - - event.persist(); // fixes issue #23 - - this.setState({ maskedValue: maskedValue, value: value }, function () { - _this2.props.onChange(maskedValue, value, event); - _this2.props.onChangeEvent(event, maskedValue, value); - }); - } - - /** - * onFocus Event Handler - * @param event - */ - - }, { - key: 'handleFocus', - value: function handleFocus(event) { - //Whenever we receive focus check to see if the position is before the suffix, if not, move it. - var selectionEnd = this.theInput.value.length - this.props.suffix.length; - var isNegative = (this.theInput.value.match(/-/g) || []).length % 2 === 1; - var selectionStart = this.props.prefix.length + (isNegative ? 1 : 0); - event.target.setSelectionRange(selectionStart, selectionEnd); - this.inputSelectionStart = selectionStart; - this.inputSelectionEnd = selectionEnd; - } - }, { - key: 'handleBlur', - value: function handleBlur(event) { - this.inputSelectionStart = 0; - this.inputSelectionEnd = 0; - } - - /** - * Component lifecycle function. - * @returns {XML} - * @see https://facebook.github.io/react/docs/component-specs.html#render - */ - - }, { - key: 'render', - value: function render() { - var _this3 = this; - - return _react2.default.createElement('input', _extends({ - ref: function ref(input) { - _this3.theInput = input; - }, - type: this.props.inputType, - value: this.state.maskedValue, - onChange: this.handleChange, - onFocus: this.handleFocus, - onMouseUp: this.handleFocus - }, this.state.customProps)); - } - }]); - - return CurrencyInput; -}(_react.Component); - -/** - * Prop validation. - * @see https://facebook.github.io/react/docs/component-specs.html#proptypes - */ - -CurrencyInput.propTypes = { - onChange: _propTypes2.default.func, - value: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]), - decimalSeparator: _propTypes2.default.string, - thousandSeparator: _propTypes2.default.string, - precision: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]), - inputType: _propTypes2.default.string, - allowNegative: _propTypes2.default.bool, - allowEmpty: _propTypes2.default.bool, - prefix: _propTypes2.default.string, - suffix: _propTypes2.default.string -}; - -CurrencyInput.defaultProps = { - onChange: function onChange(maskValue, value, event) {/*no-op*/}, - onChangeEvent: function onChangeEvent(event, maskValue, value) {/*no-op*/}, - value: '0', - decimalSeparator: '.', - thousandSeparator: ',', - precision: '2', - inputType: 'text', - allowNegative: false, - prefix: '', - suffix: '' -}; - -exports.default = CurrencyInput; \ No newline at end of file diff --git a/lib/mask.js b/lib/mask.js deleted file mode 100644 index b0e2a9b..0000000 --- a/lib/mask.js +++ /dev/null @@ -1,110 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = mask; -function mask(value) { - var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2; - var decimalSeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.'; - var thousandSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ','; - var allowNegative = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; - var prefix = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : ''; - var suffix = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : ''; - - // provide some default values and arg validation. - if (precision < 0) { - precision = 0; - } // precision cannot be negative - if (precision > 20) { - precision = 20; - } // precision cannot be greater than 20 - - if (value === null || value === undefined) { - return { - value: 0, - maskedValue: '' - }; - } - - value = String(value); //if the given value is a Number, let's convert into String to manipulate that - - if (value.length == 0) { - return { - value: 0, - maskedValue: '' - }; - } - - // extract digits. if no digits, fill in a zero. - var digits = value.match(/\d/g) || ['0']; - - var numberIsNegative = false; - if (allowNegative) { - var negativeSignCount = (value.match(/-/g) || []).length; - // number will be negative if we have an odd number of "-" - // ideally, we should only ever have 0, 1 or 2 (positive number, making a number negative - // and making a negative number positive, respectively) - numberIsNegative = negativeSignCount % 2 === 1; - - // if every digit in the array is '0', then the number should never be negative - var allDigitsAreZero = true; - for (var idx = 0; idx < digits.length; idx += 1) { - if (digits[idx] !== '0') { - allDigitsAreZero = false; - break; - } - } - if (allDigitsAreZero) { - numberIsNegative = false; - } - } - - // zero-pad a input - while (digits.length <= precision) { - digits.unshift('0'); - } - - if (precision > 0) { - // add the decimal separator - digits.splice(digits.length - precision, 0, "."); - } - - // clean up extraneous digits like leading zeros. - digits = Number(digits.join('')).toFixed(precision).split(''); - var raw = Number(digits.join('')); - - var decimalpos = digits.length - precision - 1; // -1 needed to position the decimal separator before the digits. - if (precision > 0) { - // set the final decimal separator - digits[decimalpos] = decimalSeparator; - } else { - // when precision is 0, there is no decimal separator. - decimalpos = digits.length; - } - - // add in any thousand separators - for (var x = decimalpos - 3; x > 0; x = x - 3) { - digits.splice(x, 0, thousandSeparator); - } - - // if we have a prefix or suffix, add them in. - if (prefix.length > 0) { - digits.unshift(prefix); - } - if (suffix.length > 0) { - digits.push(suffix); - } - - // if the number is negative, insert a "-" to - // the front of the array and negate the raw value - if (allowNegative && numberIsNegative) { - digits.unshift('-'); - raw = -raw; - } - - return { - value: raw, - maskedValue: digits.join('').trim() - }; -} \ No newline at end of file diff --git a/lib/react-currency-input.cjs.js b/lib/react-currency-input.cjs.js new file mode 100644 index 0000000..8b0556c --- /dev/null +++ b/lib/react-currency-input.cjs.js @@ -0,0 +1,405 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var PropTypes = _interopDefault(require('prop-types')); +var React = require('react'); +var React__default = _interopDefault(React); +var ReactDOM = _interopDefault(require('react-dom')); + +function mask(value, precision, decimalSeparator, thousandSeparator, allowNegative, prefix, suffix){ + if ( precision === void 0 ) precision = 2; + if ( decimalSeparator === void 0 ) decimalSeparator = '.'; + if ( thousandSeparator === void 0 ) thousandSeparator = ','; + if ( allowNegative === void 0 ) allowNegative = false; + if ( prefix === void 0 ) prefix = ''; + if ( suffix === void 0 ) suffix = ''; + + // provide some default values and arg validation. + if (precision < 0) { precision = 0; } // precision cannot be negative + if (precision > 20) { precision = 20; } // precision cannot be greater than 20 + + if (value === null || value===undefined) { + return { + value: 0, + maskedValue: '' + }; + } + + value = String(value); //if the given value is a Number, let's convert into String to manipulate that + + if (value.length == 0) { + return { + value: 0, + maskedValue: '' + }; + } + + + // extract digits. if no digits, fill in a zero. + var digits = value.match(/\d/g) || ['0']; + + var numberIsNegative = false; + if (allowNegative) { + var negativeSignCount = (value.match(/-/g) || []).length; + // number will be negative if we have an odd number of "-" + // ideally, we should only ever have 0, 1 or 2 (positive number, making a number negative + // and making a negative number positive, respectively) + numberIsNegative = negativeSignCount % 2 === 1; + + // if every digit in the array is '0', then the number should never be negative + var allDigitsAreZero = true; + for (var idx=0; idx < digits.length; idx += 1) { + if(digits[idx] !== '0') { + allDigitsAreZero = false; + break; + } + } + if (allDigitsAreZero) { + numberIsNegative = false; + } + } + + // zero-pad a input + while (digits.length <= precision) { digits.unshift('0'); } + + if (precision > 0) { + // add the decimal separator + digits.splice(digits.length - precision, 0, "."); + } + + // clean up extraneous digits like leading zeros. + digits = Number(digits.join('')).toFixed(precision).split(''); + var raw = Number(digits.join('')); + + var decimalpos = digits.length - precision - 1; // -1 needed to position the decimal separator before the digits. + if (precision > 0) { + // set the final decimal separator + digits[decimalpos] = decimalSeparator; + } else { + // when precision is 0, there is no decimal separator. + decimalpos = digits.length; + } + + // add in any thousand separators + for (var x=decimalpos - 3; x > 0; x = x - 3) { + digits.splice(x, 0, thousandSeparator); + } + + // if we have a prefix or suffix, add them in. + if (prefix.length > 0) { digits.unshift(prefix); } + if (suffix.length > 0) { digits.push(suffix); } + + // if the number is negative, insert a "-" to + // the front of the array and negate the raw value + if (allowNegative && numberIsNegative) { + digits.unshift('-'); + raw = -raw; + } + + return { + value: raw, + maskedValue: digits.join('').trim() + }; +} + +// IE* parseFloat polyfill +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/parseFloat#Polyfill +Number.parseFloat = parseFloat; + +var CurrencyInput = (function (Component$$1) { + function CurrencyInput(props) { + Component$$1.call(this, props); + this.prepareProps = this.prepareProps.bind(this); + this.handleChange = this.handleChange.bind(this); + this.handleFocus = this.handleFocus.bind(this); + this.setSelectionRange = this.setSelectionRange.bind(this); + this.state = this.prepareProps(this.props); + + this.inputSelectionStart = 0; + this.inputSelectionEnd = 0; + } + + if ( Component$$1 ) CurrencyInput.__proto__ = Component$$1; + CurrencyInput.prototype = Object.create( Component$$1 && Component$$1.prototype ); + CurrencyInput.prototype.constructor = CurrencyInput; + + + /** + * Exposes the current masked value. + * + * @returns {String} + */ + CurrencyInput.prototype.getMaskedValue = function getMaskedValue () { + return this.state.maskedValue; + }; + + + /** + * General function used to cleanup and define the final props used for rendering + * @returns {{ maskedValue: {String}, value: {Number}, customProps: {Object} }} + */ + CurrencyInput.prototype.prepareProps = function prepareProps (props) { + var customProps = Object.assign({}, props); // babeljs converts to Object.assign, then polyfills. + delete customProps.onChange; + delete customProps.onChangeEvent; + delete customProps.value; + delete customProps.decimalSeparator; + delete customProps.thousandSeparator; + delete customProps.precision; + delete customProps.inputType; + delete customProps.allowNegative; + delete customProps.allowEmpty; + delete customProps.prefix; + delete customProps.suffix; + delete customProps.autoFocus; + + var initialValue = props.value; + if (initialValue === null) { + initialValue = props.allowEmpty? null : ''; + }else{ + + if (typeof initialValue == 'string') { + // Some people, when confronted with a problem, think "I know, I'll use regular expressions." + // Now they have two problems. + + // Strip out thousand separators, prefix, and suffix, etc. + if (props.thousandSeparator === "."){ + // special handle the . thousand separator + initialValue = initialValue.replace(/\./g, ''); + } + + if (props.decimalSeparator != "."){ + // fix the decimal separator + initialValue = initialValue.replace(new RegExp(props.decimalSeparator, 'g'), '.'); + } + + //Strip out anything that is not a digit, -, or decimal separator + initialValue = initialValue.replace(/[^0-9-.]/g, ''); + + // now we can parse. + initialValue = Number.parseFloat(initialValue); + } + initialValue = Number(initialValue).toLocaleString(undefined, { + style : 'decimal', + minimumFractionDigits: props.precision, + maximumFractionDigits: props.precision + }); + + } + + var ref = mask( + initialValue, + props.precision, + props.decimalSeparator, + props.thousandSeparator, + props.allowNegative, + props.prefix, + props.suffix + ); + var maskedValue = ref.maskedValue; + var value = ref.value; + + return { maskedValue: maskedValue, value: value, customProps: customProps }; + }; + + + /** + * Component lifecycle function. + * Invoked when a component is receiving new props. This method is not called for the initial render. + * + * @param nextProps + * @see https://facebook.github.io/react/docs/component-specs.html#updating-componentwillreceiveprops + */ + CurrencyInput.prototype.componentWillReceiveProps = function componentWillReceiveProps (nextProps) { + this.setState(this.prepareProps(nextProps)); + }; + + + /** + * Component lifecycle function. + * @returns {XML} + * @see https://facebook.github.io/react/docs/react-component.html#componentdidmount + */ + CurrencyInput.prototype.componentDidMount = function componentDidMount (){ + var node = ReactDOM.findDOMNode(this.theInput); + + var selectionEnd = Math.min(node.selectionEnd, this.theInput.value.length - this.props.suffix.length); + var selectionStart = Math.min(node.selectionStart, selectionEnd); + //console.log("normal", selectionStart, selectionEnd); + this.setSelectionRange(node, selectionStart, selectionEnd); + + }; + + + /** + * Component lifecycle function + * @returns {XML} + * @see https://facebook.github.io/react/docs/react-component.html#componentwillupdate + */ + CurrencyInput.prototype.componentWillUpdate = function componentWillUpdate () { + var node = ReactDOM.findDOMNode(this.theInput); + this.inputSelectionStart = node.selectionStart; + this.inputSelectionEnd = node.selectionEnd; + }; + + + /** + * Component lifecycle function. + * @returns {XML} + * @see https://facebook.github.io/react/docs/react-component.html#componentdidupdate + */ + CurrencyInput.prototype.componentDidUpdate = function componentDidUpdate (prevProps, prevState){ + + var node = ReactDOM.findDOMNode(this.theInput); + var isNegative = (this.theInput.value.match(/-/g) || []).length % 2 === 1; + var minPos = this.props.prefix.length + (isNegative ? 1 : 0); + var selectionEnd = Math.max(minPos, Math.min(this.inputSelectionEnd, this.theInput.value.length - this.props.suffix.length)); + var selectionStart = Math.max(minPos, Math.min(this.inputSelectionEnd, selectionEnd)); + + var regexEscapeRegex = /[-[\]{}()*+?.,\\^$|#\s]/g; + var separatorsRegex = new RegExp(this.props.decimalSeparator.replace(regexEscapeRegex, '\\$&') + '|' + this.props.thousandSeparator.replace(regexEscapeRegex, '\\$&'), 'g'); + var currSeparatorCount = (this.state.maskedValue.match(separatorsRegex) || []).length; + var prevSeparatorCount = (prevState.maskedValue.match(separatorsRegex) || []).length; + var adjustment = Math.max(currSeparatorCount - prevSeparatorCount, 0); + + selectionEnd = selectionEnd + adjustment; + selectionStart = selectionStart + adjustment; + + var baselength = this.props.suffix.length + + this.props.prefix.length + + this.props.decimalSeparator.length + + Number(this.props.precision) + + 1; // This is to account for the default '0' value that comes before the decimal separator + + if (this.state.maskedValue.length == baselength){ + // if we are already at base length, position the cursor at the end. + selectionEnd = this.theInput.value.length - this.props.suffix.length; + selectionStart = selectionEnd; + } + + this.setSelectionRange(node, selectionStart, selectionEnd); + this.inputSelectionStart = selectionStart; + this.inputSelectionEnd = selectionEnd; + }; + + + /** + * Set selection range only if input is in focused state + * @param node DOMElement + * @param start number + * @param end number + */ + CurrencyInput.prototype.setSelectionRange = function setSelectionRange (node, start, end) { + if (document.activeElement === node) { + node.setSelectionRange(start, end); + } + }; + + + /** + * onChange Event Handler + * @param event + */ + CurrencyInput.prototype.handleChange = function handleChange (event) { + var this$1 = this; + + event.preventDefault(); + var ref = mask( + event.target.value, + this.props.precision, + this.props.decimalSeparator, + this.props.thousandSeparator, + this.props.allowNegative, + this.props.prefix, + this.props.suffix + ); + var maskedValue = ref.maskedValue; + var value = ref.value; + + event.persist(); // fixes issue #23 + + this.setState({ maskedValue: maskedValue, value: value }, function () { + this$1.props.onChange(maskedValue, value, event); + this$1.props.onChangeEvent(event, maskedValue, value); + }); + }; + + + /** + * onFocus Event Handler + * @param event + */ + CurrencyInput.prototype.handleFocus = function handleFocus (event) { + //Whenever we receive focus check to see if the position is before the suffix, if not, move it. + var selectionEnd = this.theInput.value.length - this.props.suffix.length; + var isNegative = (this.theInput.value.match(/-/g) || []).length % 2 === 1; + var selectionStart = this.props.prefix.length + (isNegative ? 1 : 0); + event.target.setSelectionRange(selectionStart, selectionEnd); + this.inputSelectionStart = selectionStart; + this.inputSelectionEnd = selectionEnd; + }; + + + CurrencyInput.prototype.handleBlur = function handleBlur (event) { + this.inputSelectionStart = 0; + this.inputSelectionEnd = 0; + }; + + + /** + * Component lifecycle function. + * @returns {XML} + * @see https://facebook.github.io/react/docs/component-specs.html#render + */ + CurrencyInput.prototype.render = function render () { + var this$1 = this; + + return ( + React__default.createElement( 'input', Object.assign({}, + { ref: function (input) { this$1.theInput = input; }, autoFocus: this.props.autoFocus, type: this.props.inputType, value: this.state.maskedValue, onChange: this.handleChange, onFocus: this.handleFocus, onMouseUp: this.handleFocus }, this.state.customProps)) + ) + }; + + return CurrencyInput; +}(React.Component)); + + + +/** + * Prop validation. + * @see https://facebook.github.io/react/docs/component-specs.html#proptypes + */ + +CurrencyInput.propTypes = { + onChange: PropTypes.func, + value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), + decimalSeparator: PropTypes.string, + thousandSeparator: PropTypes.string, + precision: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), + inputType: PropTypes.string, + allowNegative: PropTypes.bool, + allowEmpty: PropTypes.bool, + prefix: PropTypes.string, + suffix: PropTypes.string +}; + + +CurrencyInput.defaultProps = { + onChange: function(maskValue, value, event) {/*no-op*/}, + onChangeEvent: function(event, maskValue, value) {/*no-op*/}, + value: '0', + decimalSeparator: '.', + thousandSeparator: ',', + precision: '2', + inputType: 'text', + allowNegative: false, + prefix: '', + suffix: '' +}; + +exports['default'] = CurrencyInput; +exports.mask = mask; +//# sourceMappingURL=react-currency-input.cjs.js.map diff --git a/lib/react-currency-input.cjs.js.map b/lib/react-currency-input.cjs.js.map new file mode 100644 index 0000000..61fb3f7 --- /dev/null +++ b/lib/react-currency-input.cjs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"react-currency-input.cjs.js","sources":["../src/mask.js","../src/index.js"],"sourcesContent":["\nexport default function mask(value, precision = 2, decimalSeparator = '.', thousandSeparator = ',', allowNegative = false, prefix = '', suffix = ''){\n // provide some default values and arg validation.\n if (precision < 0) { precision = 0; } // precision cannot be negative\n if (precision > 20) { precision = 20; } // precision cannot be greater than 20\n \n if (value === null || value===undefined) {\n return {\n value: 0,\n maskedValue: ''\n };\n }\n \n value = String(value); //if the given value is a Number, let's convert into String to manipulate that\n\n if (value.length == 0) {\n return {\n value: 0,\n maskedValue: ''\n };\n }\n\n\n // extract digits. if no digits, fill in a zero.\n let digits = value.match(/\\d/g) || ['0'];\n \n let numberIsNegative = false;\n if (allowNegative) {\n let negativeSignCount = (value.match(/-/g) || []).length;\n // number will be negative if we have an odd number of \"-\"\n // ideally, we should only ever have 0, 1 or 2 (positive number, making a number negative\n // and making a negative number positive, respectively)\n numberIsNegative = negativeSignCount % 2 === 1;\n \n // if every digit in the array is '0', then the number should never be negative\n let allDigitsAreZero = true;\n for (let idx=0; idx < digits.length; idx += 1) {\n if(digits[idx] !== '0') {\n allDigitsAreZero = false;\n break;\n }\n }\n if (allDigitsAreZero) {\n numberIsNegative = false;\n }\n }\n\n // zero-pad a input\n while (digits.length <= precision) { digits.unshift('0'); }\n\n if (precision > 0) {\n // add the decimal separator\n digits.splice(digits.length - precision, 0, \".\");\n }\n\n // clean up extraneous digits like leading zeros.\n digits = Number(digits.join('')).toFixed(precision).split('');\n let raw = Number(digits.join(''));\n\n let decimalpos = digits.length - precision - 1; // -1 needed to position the decimal separator before the digits.\n if (precision > 0) {\n // set the final decimal separator\n digits[decimalpos] = decimalSeparator;\n } else {\n // when precision is 0, there is no decimal separator.\n decimalpos = digits.length;\n }\n\n // add in any thousand separators\n for (let x=decimalpos - 3; x > 0; x = x - 3) {\n digits.splice(x, 0, thousandSeparator);\n }\n\n // if we have a prefix or suffix, add them in.\n if (prefix.length > 0) { digits.unshift(prefix); }\n if (suffix.length > 0) { digits.push(suffix); }\n\n // if the number is negative, insert a \"-\" to\n // the front of the array and negate the raw value\n if (allowNegative && numberIsNegative) {\n digits.unshift('-');\n raw = -raw;\n }\n\n return {\n value: raw,\n maskedValue: digits.join('').trim()\n };\n}\n","import PropTypes from 'prop-types';\nimport React, { Component } from 'react'\nimport ReactDOM from 'react-dom'\nimport mask from './mask.js'\n\n// IE* parseFloat polyfill\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/parseFloat#Polyfill\nNumber.parseFloat = parseFloat;\n\nclass CurrencyInput extends Component {\n constructor(props) {\n super(props);\n this.prepareProps = this.prepareProps.bind(this);\n this.handleChange = this.handleChange.bind(this);\n this.handleFocus = this.handleFocus.bind(this);\n this.setSelectionRange = this.setSelectionRange.bind(this);\n this.state = this.prepareProps(this.props);\n\n this.inputSelectionStart = 0;\n this.inputSelectionEnd = 0;\n }\n\n\n /**\n * Exposes the current masked value.\n *\n * @returns {String}\n */\n getMaskedValue() {\n return this.state.maskedValue;\n }\n\n\n /**\n * General function used to cleanup and define the final props used for rendering\n * @returns {{ maskedValue: {String}, value: {Number}, customProps: {Object} }}\n */\n prepareProps(props) {\n let customProps = {...props}; // babeljs converts to Object.assign, then polyfills.\n delete customProps.onChange;\n delete customProps.onChangeEvent;\n delete customProps.value;\n delete customProps.decimalSeparator;\n delete customProps.thousandSeparator;\n delete customProps.precision;\n delete customProps.inputType;\n delete customProps.allowNegative;\n delete customProps.allowEmpty;\n delete customProps.prefix;\n delete customProps.suffix;\n delete customProps.autoFocus;\n\n let initialValue = props.value;\n if (initialValue === null) {\n initialValue = props.allowEmpty? null : '';\n }else{\n\n if (typeof initialValue == 'string') {\n // Some people, when confronted with a problem, think \"I know, I'll use regular expressions.\"\n // Now they have two problems.\n\n // Strip out thousand separators, prefix, and suffix, etc.\n if (props.thousandSeparator === \".\"){\n // special handle the . thousand separator\n initialValue = initialValue.replace(/\\./g, '');\n }\n\n if (props.decimalSeparator != \".\"){\n // fix the decimal separator\n initialValue = initialValue.replace(new RegExp(props.decimalSeparator, 'g'), '.');\n }\n\n //Strip out anything that is not a digit, -, or decimal separator\n initialValue = initialValue.replace(/[^0-9-.]/g, '');\n\n // now we can parse.\n initialValue = Number.parseFloat(initialValue);\n }\n initialValue = Number(initialValue).toLocaleString(undefined, {\n style : 'decimal',\n minimumFractionDigits: props.precision,\n maximumFractionDigits: props.precision\n })\n\n }\n\n const { maskedValue, value } = mask(\n initialValue,\n props.precision,\n props.decimalSeparator,\n props.thousandSeparator,\n props.allowNegative,\n props.prefix,\n props.suffix\n );\n\n return { maskedValue, value, customProps };\n }\n\n\n /**\n * Component lifecycle function.\n * Invoked when a component is receiving new props. This method is not called for the initial render.\n *\n * @param nextProps\n * @see https://facebook.github.io/react/docs/component-specs.html#updating-componentwillreceiveprops\n */\n componentWillReceiveProps(nextProps) {\n this.setState(this.prepareProps(nextProps));\n }\n\n\n /**\n * Component lifecycle function.\n * @returns {XML}\n * @see https://facebook.github.io/react/docs/react-component.html#componentdidmount\n */\n componentDidMount(){\n let node = ReactDOM.findDOMNode(this.theInput);\n\n let selectionEnd = Math.min(node.selectionEnd, this.theInput.value.length - this.props.suffix.length);\n let selectionStart = Math.min(node.selectionStart, selectionEnd);\n //console.log(\"normal\", selectionStart, selectionEnd);\n this.setSelectionRange(node, selectionStart, selectionEnd);\n\n }\n\n\n /**\n * Component lifecycle function\n * @returns {XML}\n * @see https://facebook.github.io/react/docs/react-component.html#componentwillupdate\n */\n componentWillUpdate() {\n let node = ReactDOM.findDOMNode(this.theInput);\n this.inputSelectionStart = node.selectionStart;\n this.inputSelectionEnd = node.selectionEnd;\n }\n\n\n /**\n * Component lifecycle function.\n * @returns {XML}\n * @see https://facebook.github.io/react/docs/react-component.html#componentdidupdate\n */\n componentDidUpdate(prevProps, prevState){\n\n let node = ReactDOM.findDOMNode(this.theInput);\n let isNegative = (this.theInput.value.match(/-/g) || []).length % 2 === 1;\n let minPos = this.props.prefix.length + (isNegative ? 1 : 0);\n let selectionEnd = Math.max(minPos, Math.min(this.inputSelectionEnd, this.theInput.value.length - this.props.suffix.length));\n let selectionStart = Math.max(minPos, Math.min(this.inputSelectionEnd, selectionEnd));\n\n let regexEscapeRegex = /[-[\\]{}()*+?.,\\\\^$|#\\s]/g;\n let separatorsRegex = new RegExp(this.props.decimalSeparator.replace(regexEscapeRegex, '\\\\$&') + '|' + this.props.thousandSeparator.replace(regexEscapeRegex, '\\\\$&'), 'g');\n let currSeparatorCount = (this.state.maskedValue.match(separatorsRegex) || []).length;\n let prevSeparatorCount = (prevState.maskedValue.match(separatorsRegex) || []).length;\n let adjustment = Math.max(currSeparatorCount - prevSeparatorCount, 0);\n\n selectionEnd = selectionEnd + adjustment;\n selectionStart = selectionStart + adjustment;\n\n let baselength = this.props.suffix.length\n + this.props.prefix.length\n + this.props.decimalSeparator.length\n + Number(this.props.precision)\n + 1; // This is to account for the default '0' value that comes before the decimal separator\n\n if (this.state.maskedValue.length == baselength){\n // if we are already at base length, position the cursor at the end.\n selectionEnd = this.theInput.value.length - this.props.suffix.length;\n selectionStart = selectionEnd;\n }\n\n this.setSelectionRange(node, selectionStart, selectionEnd);\n this.inputSelectionStart = selectionStart;\n this.inputSelectionEnd = selectionEnd;\n }\n\n\n /**\n * Set selection range only if input is in focused state\n * @param node DOMElement\n * @param start number\n * @param end number\n */\n setSelectionRange(node, start, end) {\n if (document.activeElement === node) {\n node.setSelectionRange(start, end);\n }\n }\n\n\n /**\n * onChange Event Handler\n * @param event\n */\n handleChange(event) {\n event.preventDefault();\n let { maskedValue, value } = mask(\n event.target.value,\n this.props.precision,\n this.props.decimalSeparator,\n this.props.thousandSeparator,\n this.props.allowNegative,\n this.props.prefix,\n this.props.suffix\n );\n\n event.persist(); // fixes issue #23\n\n this.setState({ maskedValue, value }, () => {\n this.props.onChange(maskedValue, value, event);\n this.props.onChangeEvent(event, maskedValue, value);\n });\n }\n\n\n /**\n * onFocus Event Handler\n * @param event\n */\n handleFocus(event) {\n //Whenever we receive focus check to see if the position is before the suffix, if not, move it.\n let selectionEnd = this.theInput.value.length - this.props.suffix.length;\n let isNegative = (this.theInput.value.match(/-/g) || []).length % 2 === 1;\n let selectionStart = this.props.prefix.length + (isNegative ? 1 : 0);\n event.target.setSelectionRange(selectionStart, selectionEnd);\n this.inputSelectionStart = selectionStart;\n this.inputSelectionEnd = selectionEnd;\n }\n\n\n handleBlur(event) {\n this.inputSelectionStart = 0;\n this.inputSelectionEnd = 0;\n }\n\n\n /**\n * Component lifecycle function.\n * @returns {XML}\n * @see https://facebook.github.io/react/docs/component-specs.html#render\n */\n render() {\n return (\n { this.theInput = input; }}\n autoFocus={this.props.autoFocus}\n type={this.props.inputType}\n value={this.state.maskedValue}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onMouseUp={this.handleFocus}\n {...this.state.customProps}\n />\n )\n }\n}\n\n\n\n/**\n * Prop validation.\n * @see https://facebook.github.io/react/docs/component-specs.html#proptypes\n */\n\nCurrencyInput.propTypes = {\n onChange: PropTypes.func,\n value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n decimalSeparator: PropTypes.string,\n thousandSeparator: PropTypes.string,\n precision: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n inputType: PropTypes.string,\n allowNegative: PropTypes.bool,\n allowEmpty: PropTypes.bool,\n prefix: PropTypes.string,\n suffix: PropTypes.string\n};\n\n\nCurrencyInput.defaultProps = {\n onChange: function(maskValue, value, event) {/*no-op*/},\n onChangeEvent: function(event, maskValue, value) {/*no-op*/},\n value: '0',\n decimalSeparator: '.',\n thousandSeparator: ',',\n precision: '2',\n inputType: 'text',\n allowNegative: false,\n prefix: '',\n suffix: ''\n};\n\n\nexport default CurrencyInput\nexport {mask}\n"],"names":["let","super","this","React","Component"],"mappings":";;;;;;;;;;;AACe,SAAS,IAAI,CAAC,KAAK,EAAE,SAAa,EAAE,gBAAsB,EAAE,iBAAuB,EAAE,aAAqB,EAAE,MAAW,EAAE,MAAW,CAAC;yCAAvG,GAAG,CAAC,CAA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AAE,GAAG;IACtB,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,KAAK;IACpB,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;CACb,CAAC;;;;;"} \ No newline at end of file diff --git a/lib/react-currency-input.es.js b/lib/react-currency-input.es.js new file mode 100644 index 0000000..5981b88 --- /dev/null +++ b/lib/react-currency-input.es.js @@ -0,0 +1,398 @@ +import PropTypes from 'prop-types'; +import React, { Component } from 'react'; +import ReactDOM from 'react-dom'; + +function mask(value, precision, decimalSeparator, thousandSeparator, allowNegative, prefix, suffix){ + if ( precision === void 0 ) precision = 2; + if ( decimalSeparator === void 0 ) decimalSeparator = '.'; + if ( thousandSeparator === void 0 ) thousandSeparator = ','; + if ( allowNegative === void 0 ) allowNegative = false; + if ( prefix === void 0 ) prefix = ''; + if ( suffix === void 0 ) suffix = ''; + + // provide some default values and arg validation. + if (precision < 0) { precision = 0; } // precision cannot be negative + if (precision > 20) { precision = 20; } // precision cannot be greater than 20 + + if (value === null || value===undefined) { + return { + value: 0, + maskedValue: '' + }; + } + + value = String(value); //if the given value is a Number, let's convert into String to manipulate that + + if (value.length == 0) { + return { + value: 0, + maskedValue: '' + }; + } + + + // extract digits. if no digits, fill in a zero. + var digits = value.match(/\d/g) || ['0']; + + var numberIsNegative = false; + if (allowNegative) { + var negativeSignCount = (value.match(/-/g) || []).length; + // number will be negative if we have an odd number of "-" + // ideally, we should only ever have 0, 1 or 2 (positive number, making a number negative + // and making a negative number positive, respectively) + numberIsNegative = negativeSignCount % 2 === 1; + + // if every digit in the array is '0', then the number should never be negative + var allDigitsAreZero = true; + for (var idx=0; idx < digits.length; idx += 1) { + if(digits[idx] !== '0') { + allDigitsAreZero = false; + break; + } + } + if (allDigitsAreZero) { + numberIsNegative = false; + } + } + + // zero-pad a input + while (digits.length <= precision) { digits.unshift('0'); } + + if (precision > 0) { + // add the decimal separator + digits.splice(digits.length - precision, 0, "."); + } + + // clean up extraneous digits like leading zeros. + digits = Number(digits.join('')).toFixed(precision).split(''); + var raw = Number(digits.join('')); + + var decimalpos = digits.length - precision - 1; // -1 needed to position the decimal separator before the digits. + if (precision > 0) { + // set the final decimal separator + digits[decimalpos] = decimalSeparator; + } else { + // when precision is 0, there is no decimal separator. + decimalpos = digits.length; + } + + // add in any thousand separators + for (var x=decimalpos - 3; x > 0; x = x - 3) { + digits.splice(x, 0, thousandSeparator); + } + + // if we have a prefix or suffix, add them in. + if (prefix.length > 0) { digits.unshift(prefix); } + if (suffix.length > 0) { digits.push(suffix); } + + // if the number is negative, insert a "-" to + // the front of the array and negate the raw value + if (allowNegative && numberIsNegative) { + digits.unshift('-'); + raw = -raw; + } + + return { + value: raw, + maskedValue: digits.join('').trim() + }; +} + +// IE* parseFloat polyfill +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/parseFloat#Polyfill +Number.parseFloat = parseFloat; + +var CurrencyInput = (function (Component$$1) { + function CurrencyInput(props) { + Component$$1.call(this, props); + this.prepareProps = this.prepareProps.bind(this); + this.handleChange = this.handleChange.bind(this); + this.handleFocus = this.handleFocus.bind(this); + this.setSelectionRange = this.setSelectionRange.bind(this); + this.state = this.prepareProps(this.props); + + this.inputSelectionStart = 0; + this.inputSelectionEnd = 0; + } + + if ( Component$$1 ) CurrencyInput.__proto__ = Component$$1; + CurrencyInput.prototype = Object.create( Component$$1 && Component$$1.prototype ); + CurrencyInput.prototype.constructor = CurrencyInput; + + + /** + * Exposes the current masked value. + * + * @returns {String} + */ + CurrencyInput.prototype.getMaskedValue = function getMaskedValue () { + return this.state.maskedValue; + }; + + + /** + * General function used to cleanup and define the final props used for rendering + * @returns {{ maskedValue: {String}, value: {Number}, customProps: {Object} }} + */ + CurrencyInput.prototype.prepareProps = function prepareProps (props) { + var customProps = Object.assign({}, props); // babeljs converts to Object.assign, then polyfills. + delete customProps.onChange; + delete customProps.onChangeEvent; + delete customProps.value; + delete customProps.decimalSeparator; + delete customProps.thousandSeparator; + delete customProps.precision; + delete customProps.inputType; + delete customProps.allowNegative; + delete customProps.allowEmpty; + delete customProps.prefix; + delete customProps.suffix; + delete customProps.autoFocus; + + var initialValue = props.value; + if (initialValue === null) { + initialValue = props.allowEmpty? null : ''; + }else{ + + if (typeof initialValue == 'string') { + // Some people, when confronted with a problem, think "I know, I'll use regular expressions." + // Now they have two problems. + + // Strip out thousand separators, prefix, and suffix, etc. + if (props.thousandSeparator === "."){ + // special handle the . thousand separator + initialValue = initialValue.replace(/\./g, ''); + } + + if (props.decimalSeparator != "."){ + // fix the decimal separator + initialValue = initialValue.replace(new RegExp(props.decimalSeparator, 'g'), '.'); + } + + //Strip out anything that is not a digit, -, or decimal separator + initialValue = initialValue.replace(/[^0-9-.]/g, ''); + + // now we can parse. + initialValue = Number.parseFloat(initialValue); + } + initialValue = Number(initialValue).toLocaleString(undefined, { + style : 'decimal', + minimumFractionDigits: props.precision, + maximumFractionDigits: props.precision + }); + + } + + var ref = mask( + initialValue, + props.precision, + props.decimalSeparator, + props.thousandSeparator, + props.allowNegative, + props.prefix, + props.suffix + ); + var maskedValue = ref.maskedValue; + var value = ref.value; + + return { maskedValue: maskedValue, value: value, customProps: customProps }; + }; + + + /** + * Component lifecycle function. + * Invoked when a component is receiving new props. This method is not called for the initial render. + * + * @param nextProps + * @see https://facebook.github.io/react/docs/component-specs.html#updating-componentwillreceiveprops + */ + CurrencyInput.prototype.componentWillReceiveProps = function componentWillReceiveProps (nextProps) { + this.setState(this.prepareProps(nextProps)); + }; + + + /** + * Component lifecycle function. + * @returns {XML} + * @see https://facebook.github.io/react/docs/react-component.html#componentdidmount + */ + CurrencyInput.prototype.componentDidMount = function componentDidMount (){ + var node = ReactDOM.findDOMNode(this.theInput); + + var selectionEnd = Math.min(node.selectionEnd, this.theInput.value.length - this.props.suffix.length); + var selectionStart = Math.min(node.selectionStart, selectionEnd); + //console.log("normal", selectionStart, selectionEnd); + this.setSelectionRange(node, selectionStart, selectionEnd); + + }; + + + /** + * Component lifecycle function + * @returns {XML} + * @see https://facebook.github.io/react/docs/react-component.html#componentwillupdate + */ + CurrencyInput.prototype.componentWillUpdate = function componentWillUpdate () { + var node = ReactDOM.findDOMNode(this.theInput); + this.inputSelectionStart = node.selectionStart; + this.inputSelectionEnd = node.selectionEnd; + }; + + + /** + * Component lifecycle function. + * @returns {XML} + * @see https://facebook.github.io/react/docs/react-component.html#componentdidupdate + */ + CurrencyInput.prototype.componentDidUpdate = function componentDidUpdate (prevProps, prevState){ + + var node = ReactDOM.findDOMNode(this.theInput); + var isNegative = (this.theInput.value.match(/-/g) || []).length % 2 === 1; + var minPos = this.props.prefix.length + (isNegative ? 1 : 0); + var selectionEnd = Math.max(minPos, Math.min(this.inputSelectionEnd, this.theInput.value.length - this.props.suffix.length)); + var selectionStart = Math.max(minPos, Math.min(this.inputSelectionEnd, selectionEnd)); + + var regexEscapeRegex = /[-[\]{}()*+?.,\\^$|#\s]/g; + var separatorsRegex = new RegExp(this.props.decimalSeparator.replace(regexEscapeRegex, '\\$&') + '|' + this.props.thousandSeparator.replace(regexEscapeRegex, '\\$&'), 'g'); + var currSeparatorCount = (this.state.maskedValue.match(separatorsRegex) || []).length; + var prevSeparatorCount = (prevState.maskedValue.match(separatorsRegex) || []).length; + var adjustment = Math.max(currSeparatorCount - prevSeparatorCount, 0); + + selectionEnd = selectionEnd + adjustment; + selectionStart = selectionStart + adjustment; + + var baselength = this.props.suffix.length + + this.props.prefix.length + + this.props.decimalSeparator.length + + Number(this.props.precision) + + 1; // This is to account for the default '0' value that comes before the decimal separator + + if (this.state.maskedValue.length == baselength){ + // if we are already at base length, position the cursor at the end. + selectionEnd = this.theInput.value.length - this.props.suffix.length; + selectionStart = selectionEnd; + } + + this.setSelectionRange(node, selectionStart, selectionEnd); + this.inputSelectionStart = selectionStart; + this.inputSelectionEnd = selectionEnd; + }; + + + /** + * Set selection range only if input is in focused state + * @param node DOMElement + * @param start number + * @param end number + */ + CurrencyInput.prototype.setSelectionRange = function setSelectionRange (node, start, end) { + if (document.activeElement === node) { + node.setSelectionRange(start, end); + } + }; + + + /** + * onChange Event Handler + * @param event + */ + CurrencyInput.prototype.handleChange = function handleChange (event) { + var this$1 = this; + + event.preventDefault(); + var ref = mask( + event.target.value, + this.props.precision, + this.props.decimalSeparator, + this.props.thousandSeparator, + this.props.allowNegative, + this.props.prefix, + this.props.suffix + ); + var maskedValue = ref.maskedValue; + var value = ref.value; + + event.persist(); // fixes issue #23 + + this.setState({ maskedValue: maskedValue, value: value }, function () { + this$1.props.onChange(maskedValue, value, event); + this$1.props.onChangeEvent(event, maskedValue, value); + }); + }; + + + /** + * onFocus Event Handler + * @param event + */ + CurrencyInput.prototype.handleFocus = function handleFocus (event) { + //Whenever we receive focus check to see if the position is before the suffix, if not, move it. + var selectionEnd = this.theInput.value.length - this.props.suffix.length; + var isNegative = (this.theInput.value.match(/-/g) || []).length % 2 === 1; + var selectionStart = this.props.prefix.length + (isNegative ? 1 : 0); + event.target.setSelectionRange(selectionStart, selectionEnd); + this.inputSelectionStart = selectionStart; + this.inputSelectionEnd = selectionEnd; + }; + + + CurrencyInput.prototype.handleBlur = function handleBlur (event) { + this.inputSelectionStart = 0; + this.inputSelectionEnd = 0; + }; + + + /** + * Component lifecycle function. + * @returns {XML} + * @see https://facebook.github.io/react/docs/component-specs.html#render + */ + CurrencyInput.prototype.render = function render () { + var this$1 = this; + + return ( + React.createElement( 'input', Object.assign({}, + { ref: function (input) { this$1.theInput = input; }, autoFocus: this.props.autoFocus, type: this.props.inputType, value: this.state.maskedValue, onChange: this.handleChange, onFocus: this.handleFocus, onMouseUp: this.handleFocus }, this.state.customProps)) + ) + }; + + return CurrencyInput; +}(Component)); + + + +/** + * Prop validation. + * @see https://facebook.github.io/react/docs/component-specs.html#proptypes + */ + +CurrencyInput.propTypes = { + onChange: PropTypes.func, + value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), + decimalSeparator: PropTypes.string, + thousandSeparator: PropTypes.string, + precision: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), + inputType: PropTypes.string, + allowNegative: PropTypes.bool, + allowEmpty: PropTypes.bool, + prefix: PropTypes.string, + suffix: PropTypes.string +}; + + +CurrencyInput.defaultProps = { + onChange: function(maskValue, value, event) {/*no-op*/}, + onChangeEvent: function(event, maskValue, value) {/*no-op*/}, + value: '0', + decimalSeparator: '.', + thousandSeparator: ',', + precision: '2', + inputType: 'text', + allowNegative: false, + prefix: '', + suffix: '' +}; + +export { mask }; +export default CurrencyInput; +//# sourceMappingURL=react-currency-input.es.js.map diff --git a/lib/react-currency-input.es.js.map b/lib/react-currency-input.es.js.map new file mode 100644 index 0000000..051998a --- /dev/null +++ b/lib/react-currency-input.es.js.map @@ -0,0 +1 @@ +{"version":3,"file":"react-currency-input.es.js","sources":["../src/mask.js","../src/index.js"],"sourcesContent":["\nexport default function mask(value, precision = 2, decimalSeparator = '.', thousandSeparator = ',', allowNegative = false, prefix = '', suffix = ''){\n // provide some default values and arg validation.\n if (precision < 0) { precision = 0; } // precision cannot be negative\n if (precision > 20) { precision = 20; } // precision cannot be greater than 20\n \n if (value === null || value===undefined) {\n return {\n value: 0,\n maskedValue: ''\n };\n }\n \n value = String(value); //if the given value is a Number, let's convert into String to manipulate that\n\n if (value.length == 0) {\n return {\n value: 0,\n maskedValue: ''\n };\n }\n\n\n // extract digits. if no digits, fill in a zero.\n let digits = value.match(/\\d/g) || ['0'];\n \n let numberIsNegative = false;\n if (allowNegative) {\n let negativeSignCount = (value.match(/-/g) || []).length;\n // number will be negative if we have an odd number of \"-\"\n // ideally, we should only ever have 0, 1 or 2 (positive number, making a number negative\n // and making a negative number positive, respectively)\n numberIsNegative = negativeSignCount % 2 === 1;\n \n // if every digit in the array is '0', then the number should never be negative\n let allDigitsAreZero = true;\n for (let idx=0; idx < digits.length; idx += 1) {\n if(digits[idx] !== '0') {\n allDigitsAreZero = false;\n break;\n }\n }\n if (allDigitsAreZero) {\n numberIsNegative = false;\n }\n }\n\n // zero-pad a input\n while (digits.length <= precision) { digits.unshift('0'); }\n\n if (precision > 0) {\n // add the decimal separator\n digits.splice(digits.length - precision, 0, \".\");\n }\n\n // clean up extraneous digits like leading zeros.\n digits = Number(digits.join('')).toFixed(precision).split('');\n let raw = Number(digits.join(''));\n\n let decimalpos = digits.length - precision - 1; // -1 needed to position the decimal separator before the digits.\n if (precision > 0) {\n // set the final decimal separator\n digits[decimalpos] = decimalSeparator;\n } else {\n // when precision is 0, there is no decimal separator.\n decimalpos = digits.length;\n }\n\n // add in any thousand separators\n for (let x=decimalpos - 3; x > 0; x = x - 3) {\n digits.splice(x, 0, thousandSeparator);\n }\n\n // if we have a prefix or suffix, add them in.\n if (prefix.length > 0) { digits.unshift(prefix); }\n if (suffix.length > 0) { digits.push(suffix); }\n\n // if the number is negative, insert a \"-\" to\n // the front of the array and negate the raw value\n if (allowNegative && numberIsNegative) {\n digits.unshift('-');\n raw = -raw;\n }\n\n return {\n value: raw,\n maskedValue: digits.join('').trim()\n };\n}\n","import PropTypes from 'prop-types';\nimport React, { Component } from 'react'\nimport ReactDOM from 'react-dom'\nimport mask from './mask.js'\n\n// IE* parseFloat polyfill\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/parseFloat#Polyfill\nNumber.parseFloat = parseFloat;\n\nclass CurrencyInput extends Component {\n constructor(props) {\n super(props);\n this.prepareProps = this.prepareProps.bind(this);\n this.handleChange = this.handleChange.bind(this);\n this.handleFocus = this.handleFocus.bind(this);\n this.setSelectionRange = this.setSelectionRange.bind(this);\n this.state = this.prepareProps(this.props);\n\n this.inputSelectionStart = 0;\n this.inputSelectionEnd = 0;\n }\n\n\n /**\n * Exposes the current masked value.\n *\n * @returns {String}\n */\n getMaskedValue() {\n return this.state.maskedValue;\n }\n\n\n /**\n * General function used to cleanup and define the final props used for rendering\n * @returns {{ maskedValue: {String}, value: {Number}, customProps: {Object} }}\n */\n prepareProps(props) {\n let customProps = {...props}; // babeljs converts to Object.assign, then polyfills.\n delete customProps.onChange;\n delete customProps.onChangeEvent;\n delete customProps.value;\n delete customProps.decimalSeparator;\n delete customProps.thousandSeparator;\n delete customProps.precision;\n delete customProps.inputType;\n delete customProps.allowNegative;\n delete customProps.allowEmpty;\n delete customProps.prefix;\n delete customProps.suffix;\n delete customProps.autoFocus;\n\n let initialValue = props.value;\n if (initialValue === null) {\n initialValue = props.allowEmpty? null : '';\n }else{\n\n if (typeof initialValue == 'string') {\n // Some people, when confronted with a problem, think \"I know, I'll use regular expressions.\"\n // Now they have two problems.\n\n // Strip out thousand separators, prefix, and suffix, etc.\n if (props.thousandSeparator === \".\"){\n // special handle the . thousand separator\n initialValue = initialValue.replace(/\\./g, '');\n }\n\n if (props.decimalSeparator != \".\"){\n // fix the decimal separator\n initialValue = initialValue.replace(new RegExp(props.decimalSeparator, 'g'), '.');\n }\n\n //Strip out anything that is not a digit, -, or decimal separator\n initialValue = initialValue.replace(/[^0-9-.]/g, '');\n\n // now we can parse.\n initialValue = Number.parseFloat(initialValue);\n }\n initialValue = Number(initialValue).toLocaleString(undefined, {\n style : 'decimal',\n minimumFractionDigits: props.precision,\n maximumFractionDigits: props.precision\n })\n\n }\n\n const { maskedValue, value } = mask(\n initialValue,\n props.precision,\n props.decimalSeparator,\n props.thousandSeparator,\n props.allowNegative,\n props.prefix,\n props.suffix\n );\n\n return { maskedValue, value, customProps };\n }\n\n\n /**\n * Component lifecycle function.\n * Invoked when a component is receiving new props. This method is not called for the initial render.\n *\n * @param nextProps\n * @see https://facebook.github.io/react/docs/component-specs.html#updating-componentwillreceiveprops\n */\n componentWillReceiveProps(nextProps) {\n this.setState(this.prepareProps(nextProps));\n }\n\n\n /**\n * Component lifecycle function.\n * @returns {XML}\n * @see https://facebook.github.io/react/docs/react-component.html#componentdidmount\n */\n componentDidMount(){\n let node = ReactDOM.findDOMNode(this.theInput);\n\n let selectionEnd = Math.min(node.selectionEnd, this.theInput.value.length - this.props.suffix.length);\n let selectionStart = Math.min(node.selectionStart, selectionEnd);\n //console.log(\"normal\", selectionStart, selectionEnd);\n this.setSelectionRange(node, selectionStart, selectionEnd);\n\n }\n\n\n /**\n * Component lifecycle function\n * @returns {XML}\n * @see https://facebook.github.io/react/docs/react-component.html#componentwillupdate\n */\n componentWillUpdate() {\n let node = ReactDOM.findDOMNode(this.theInput);\n this.inputSelectionStart = node.selectionStart;\n this.inputSelectionEnd = node.selectionEnd;\n }\n\n\n /**\n * Component lifecycle function.\n * @returns {XML}\n * @see https://facebook.github.io/react/docs/react-component.html#componentdidupdate\n */\n componentDidUpdate(prevProps, prevState){\n\n let node = ReactDOM.findDOMNode(this.theInput);\n let isNegative = (this.theInput.value.match(/-/g) || []).length % 2 === 1;\n let minPos = this.props.prefix.length + (isNegative ? 1 : 0);\n let selectionEnd = Math.max(minPos, Math.min(this.inputSelectionEnd, this.theInput.value.length - this.props.suffix.length));\n let selectionStart = Math.max(minPos, Math.min(this.inputSelectionEnd, selectionEnd));\n\n let regexEscapeRegex = /[-[\\]{}()*+?.,\\\\^$|#\\s]/g;\n let separatorsRegex = new RegExp(this.props.decimalSeparator.replace(regexEscapeRegex, '\\\\$&') + '|' + this.props.thousandSeparator.replace(regexEscapeRegex, '\\\\$&'), 'g');\n let currSeparatorCount = (this.state.maskedValue.match(separatorsRegex) || []).length;\n let prevSeparatorCount = (prevState.maskedValue.match(separatorsRegex) || []).length;\n let adjustment = Math.max(currSeparatorCount - prevSeparatorCount, 0);\n\n selectionEnd = selectionEnd + adjustment;\n selectionStart = selectionStart + adjustment;\n\n let baselength = this.props.suffix.length\n + this.props.prefix.length\n + this.props.decimalSeparator.length\n + Number(this.props.precision)\n + 1; // This is to account for the default '0' value that comes before the decimal separator\n\n if (this.state.maskedValue.length == baselength){\n // if we are already at base length, position the cursor at the end.\n selectionEnd = this.theInput.value.length - this.props.suffix.length;\n selectionStart = selectionEnd;\n }\n\n this.setSelectionRange(node, selectionStart, selectionEnd);\n this.inputSelectionStart = selectionStart;\n this.inputSelectionEnd = selectionEnd;\n }\n\n\n /**\n * Set selection range only if input is in focused state\n * @param node DOMElement\n * @param start number\n * @param end number\n */\n setSelectionRange(node, start, end) {\n if (document.activeElement === node) {\n node.setSelectionRange(start, end);\n }\n }\n\n\n /**\n * onChange Event Handler\n * @param event\n */\n handleChange(event) {\n event.preventDefault();\n let { maskedValue, value } = mask(\n event.target.value,\n this.props.precision,\n this.props.decimalSeparator,\n this.props.thousandSeparator,\n this.props.allowNegative,\n this.props.prefix,\n this.props.suffix\n );\n\n event.persist(); // fixes issue #23\n\n this.setState({ maskedValue, value }, () => {\n this.props.onChange(maskedValue, value, event);\n this.props.onChangeEvent(event, maskedValue, value);\n });\n }\n\n\n /**\n * onFocus Event Handler\n * @param event\n */\n handleFocus(event) {\n //Whenever we receive focus check to see if the position is before the suffix, if not, move it.\n let selectionEnd = this.theInput.value.length - this.props.suffix.length;\n let isNegative = (this.theInput.value.match(/-/g) || []).length % 2 === 1;\n let selectionStart = this.props.prefix.length + (isNegative ? 1 : 0);\n event.target.setSelectionRange(selectionStart, selectionEnd);\n this.inputSelectionStart = selectionStart;\n this.inputSelectionEnd = selectionEnd;\n }\n\n\n handleBlur(event) {\n this.inputSelectionStart = 0;\n this.inputSelectionEnd = 0;\n }\n\n\n /**\n * Component lifecycle function.\n * @returns {XML}\n * @see https://facebook.github.io/react/docs/component-specs.html#render\n */\n render() {\n return (\n { this.theInput = input; }}\n autoFocus={this.props.autoFocus}\n type={this.props.inputType}\n value={this.state.maskedValue}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onMouseUp={this.handleFocus}\n {...this.state.customProps}\n />\n )\n }\n}\n\n\n\n/**\n * Prop validation.\n * @see https://facebook.github.io/react/docs/component-specs.html#proptypes\n */\n\nCurrencyInput.propTypes = {\n onChange: PropTypes.func,\n value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n decimalSeparator: PropTypes.string,\n thousandSeparator: PropTypes.string,\n precision: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n inputType: PropTypes.string,\n allowNegative: PropTypes.bool,\n allowEmpty: PropTypes.bool,\n prefix: PropTypes.string,\n suffix: PropTypes.string\n};\n\n\nCurrencyInput.defaultProps = {\n onChange: function(maskValue, value, event) {/*no-op*/},\n onChangeEvent: function(event, maskValue, value) {/*no-op*/},\n value: '0',\n decimalSeparator: '.',\n thousandSeparator: ',',\n precision: '2',\n inputType: 'text',\n allowNegative: false,\n prefix: '',\n suffix: ''\n};\n\n\nexport default CurrencyInput\nexport {mask}\n"],"names":["let","super","this"],"mappings":";;;;AACe,SAAS,IAAI,CAAC,KAAK,EAAE,SAAa,EAAE,gBAAsB,EAAE,iBAAuB,EAAE,aAAqB,EAAE,MAAW,EAAE,MAAW,CAAC;yCAAvG,GAAG,CAAC,CAAkB;uDAAA,GAAG,GAAG,CAAmB;yDAAA,GAAG,GAAG,CAAe;iDAAA,GAAG,KAAK,CAAQ;mCAAA,GAAG,EAAE,CAAQ;mCAAA,GAAG,EAAE;;;IAE/I,IAAI,SAAS,GAAG,CAAC,EAAE,EAAE,SAAS,GAAG,CAAC,CAAC,EAAE;IACrC,IAAI,SAAS,GAAG,EAAE,EAAE,EAAE,SAAS,GAAG,EAAE,CAAC,EAAE;;IAEvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,GAAG,SAAS,EAAE;UACnC,OAAO;cACH,KAAK,EAAE,CAAC;cACR,WAAW,EAAE,EAAE;WAClB,CAAC;MACN;;IAEF,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;;IAEtB,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE;QACnB,OAAO;YACH,KAAK,EAAE,CAAC;YACR,WAAW,EAAE,EAAE;SAClB,CAAC;KACL;;;;IAIDA,IAAI,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;IAEzCA,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAC7B,IAAI,aAAa,EAAE;QACfA,IAAI,iBAAiB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,SAAS,CAAC,MAAM,CAAC,CAAC;IACpE,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,aAAa,EAAE,SAAS,CAAC,IAAI;IAC7B,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,MAAM,EAAE,SAAS,CAAC,MAAM;CAC3B,CAAC;;;AAGF,aAAa,CAAC,YAAY,GAAG;IACzB,QAAQ,EAAE,SAAS,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW;IACvD,aAAa,EAAE,SAAS,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW;IAC5D,KAAK,EAAE,GAAG;IACV,gBAAgB,EAAE,GAAG;IACrB,iBAAiB,EAAE,GAAG;IACtB,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,KAAK;IACpB,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;CACb,CAAC;;;;;"} \ No newline at end of file diff --git a/lib/react-currency-input.min.js b/lib/react-currency-input.min.js new file mode 100644 index 0000000..0041d51 --- /dev/null +++ b/lib/react-currency-input.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("prop-types"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","prop-types","react","react-dom"],t):t(e["react-currency-input"]={},e.PropTypes,e.React,e.ReactDOM)}(this,function(e,t,n,d){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var i="default"in n?n.default:n;function o(e,t,n,i,a,o,s){if(void 0===t&&(t=2),void 0===n&&(n="."),void 0===i&&(i=","),void 0===a&&(a=!1),void 0===o&&(o=""),void 0===s&&(s=""),t<0&&(t=0),20 20) { precision = 20; } // precision cannot be greater than 20\n \n if (value === null || value===undefined) {\n return {\n value: 0,\n maskedValue: ''\n };\n }\n \n value = String(value); //if the given value is a Number, let's convert into String to manipulate that\n\n if (value.length == 0) {\n return {\n value: 0,\n maskedValue: ''\n };\n }\n\n\n // extract digits. if no digits, fill in a zero.\n let digits = value.match(/\\d/g) || ['0'];\n \n let numberIsNegative = false;\n if (allowNegative) {\n let negativeSignCount = (value.match(/-/g) || []).length;\n // number will be negative if we have an odd number of \"-\"\n // ideally, we should only ever have 0, 1 or 2 (positive number, making a number negative\n // and making a negative number positive, respectively)\n numberIsNegative = negativeSignCount % 2 === 1;\n \n // if every digit in the array is '0', then the number should never be negative\n let allDigitsAreZero = true;\n for (let idx=0; idx < digits.length; idx += 1) {\n if(digits[idx] !== '0') {\n allDigitsAreZero = false;\n break;\n }\n }\n if (allDigitsAreZero) {\n numberIsNegative = false;\n }\n }\n\n // zero-pad a input\n while (digits.length <= precision) { digits.unshift('0'); }\n\n if (precision > 0) {\n // add the decimal separator\n digits.splice(digits.length - precision, 0, \".\");\n }\n\n // clean up extraneous digits like leading zeros.\n digits = Number(digits.join('')).toFixed(precision).split('');\n let raw = Number(digits.join(''));\n\n let decimalpos = digits.length - precision - 1; // -1 needed to position the decimal separator before the digits.\n if (precision > 0) {\n // set the final decimal separator\n digits[decimalpos] = decimalSeparator;\n } else {\n // when precision is 0, there is no decimal separator.\n decimalpos = digits.length;\n }\n\n // add in any thousand separators\n for (let x=decimalpos - 3; x > 0; x = x - 3) {\n digits.splice(x, 0, thousandSeparator);\n }\n\n // if we have a prefix or suffix, add them in.\n if (prefix.length > 0) { digits.unshift(prefix); }\n if (suffix.length > 0) { digits.push(suffix); }\n\n // if the number is negative, insert a \"-\" to\n // the front of the array and negate the raw value\n if (allowNegative && numberIsNegative) {\n digits.unshift('-');\n raw = -raw;\n }\n\n return {\n value: raw,\n maskedValue: digits.join('').trim()\n };\n}\n","import PropTypes from 'prop-types';\nimport React, { Component } from 'react'\nimport ReactDOM from 'react-dom'\nimport mask from './mask.js'\n\n// IE* parseFloat polyfill\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/parseFloat#Polyfill\nNumber.parseFloat = parseFloat;\n\nclass CurrencyInput extends Component {\n constructor(props) {\n super(props);\n this.prepareProps = this.prepareProps.bind(this);\n this.handleChange = this.handleChange.bind(this);\n this.handleFocus = this.handleFocus.bind(this);\n this.setSelectionRange = this.setSelectionRange.bind(this);\n this.state = this.prepareProps(this.props);\n\n this.inputSelectionStart = 0;\n this.inputSelectionEnd = 0;\n }\n\n\n /**\n * Exposes the current masked value.\n *\n * @returns {String}\n */\n getMaskedValue() {\n return this.state.maskedValue;\n }\n\n\n /**\n * General function used to cleanup and define the final props used for rendering\n * @returns {{ maskedValue: {String}, value: {Number}, customProps: {Object} }}\n */\n prepareProps(props) {\n let customProps = {...props}; // babeljs converts to Object.assign, then polyfills.\n delete customProps.onChange;\n delete customProps.onChangeEvent;\n delete customProps.value;\n delete customProps.decimalSeparator;\n delete customProps.thousandSeparator;\n delete customProps.precision;\n delete customProps.inputType;\n delete customProps.allowNegative;\n delete customProps.allowEmpty;\n delete customProps.prefix;\n delete customProps.suffix;\n delete customProps.autoFocus;\n\n let initialValue = props.value;\n if (initialValue === null) {\n initialValue = props.allowEmpty? null : '';\n }else{\n\n if (typeof initialValue == 'string') {\n // Some people, when confronted with a problem, think \"I know, I'll use regular expressions.\"\n // Now they have two problems.\n\n // Strip out thousand separators, prefix, and suffix, etc.\n if (props.thousandSeparator === \".\"){\n // special handle the . thousand separator\n initialValue = initialValue.replace(/\\./g, '');\n }\n\n if (props.decimalSeparator != \".\"){\n // fix the decimal separator\n initialValue = initialValue.replace(new RegExp(props.decimalSeparator, 'g'), '.');\n }\n\n //Strip out anything that is not a digit, -, or decimal separator\n initialValue = initialValue.replace(/[^0-9-.]/g, '');\n\n // now we can parse.\n initialValue = Number.parseFloat(initialValue);\n }\n initialValue = Number(initialValue).toLocaleString(undefined, {\n style : 'decimal',\n minimumFractionDigits: props.precision,\n maximumFractionDigits: props.precision\n })\n\n }\n\n const { maskedValue, value } = mask(\n initialValue,\n props.precision,\n props.decimalSeparator,\n props.thousandSeparator,\n props.allowNegative,\n props.prefix,\n props.suffix\n );\n\n return { maskedValue, value, customProps };\n }\n\n\n /**\n * Component lifecycle function.\n * Invoked when a component is receiving new props. This method is not called for the initial render.\n *\n * @param nextProps\n * @see https://facebook.github.io/react/docs/component-specs.html#updating-componentwillreceiveprops\n */\n componentWillReceiveProps(nextProps) {\n this.setState(this.prepareProps(nextProps));\n }\n\n\n /**\n * Component lifecycle function.\n * @returns {XML}\n * @see https://facebook.github.io/react/docs/react-component.html#componentdidmount\n */\n componentDidMount(){\n let node = ReactDOM.findDOMNode(this.theInput);\n\n let selectionEnd = Math.min(node.selectionEnd, this.theInput.value.length - this.props.suffix.length);\n let selectionStart = Math.min(node.selectionStart, selectionEnd);\n //console.log(\"normal\", selectionStart, selectionEnd);\n this.setSelectionRange(node, selectionStart, selectionEnd);\n\n }\n\n\n /**\n * Component lifecycle function\n * @returns {XML}\n * @see https://facebook.github.io/react/docs/react-component.html#componentwillupdate\n */\n componentWillUpdate() {\n let node = ReactDOM.findDOMNode(this.theInput);\n this.inputSelectionStart = node.selectionStart;\n this.inputSelectionEnd = node.selectionEnd;\n }\n\n\n /**\n * Component lifecycle function.\n * @returns {XML}\n * @see https://facebook.github.io/react/docs/react-component.html#componentdidupdate\n */\n componentDidUpdate(prevProps, prevState){\n\n let node = ReactDOM.findDOMNode(this.theInput);\n let isNegative = (this.theInput.value.match(/-/g) || []).length % 2 === 1;\n let minPos = this.props.prefix.length + (isNegative ? 1 : 0);\n let selectionEnd = Math.max(minPos, Math.min(this.inputSelectionEnd, this.theInput.value.length - this.props.suffix.length));\n let selectionStart = Math.max(minPos, Math.min(this.inputSelectionEnd, selectionEnd));\n\n let regexEscapeRegex = /[-[\\]{}()*+?.,\\\\^$|#\\s]/g;\n let separatorsRegex = new RegExp(this.props.decimalSeparator.replace(regexEscapeRegex, '\\\\$&') + '|' + this.props.thousandSeparator.replace(regexEscapeRegex, '\\\\$&'), 'g');\n let currSeparatorCount = (this.state.maskedValue.match(separatorsRegex) || []).length;\n let prevSeparatorCount = (prevState.maskedValue.match(separatorsRegex) || []).length;\n let adjustment = Math.max(currSeparatorCount - prevSeparatorCount, 0);\n\n selectionEnd = selectionEnd + adjustment;\n selectionStart = selectionStart + adjustment;\n\n let baselength = this.props.suffix.length\n + this.props.prefix.length\n + this.props.decimalSeparator.length\n + Number(this.props.precision)\n + 1; // This is to account for the default '0' value that comes before the decimal separator\n\n if (this.state.maskedValue.length == baselength){\n // if we are already at base length, position the cursor at the end.\n selectionEnd = this.theInput.value.length - this.props.suffix.length;\n selectionStart = selectionEnd;\n }\n\n this.setSelectionRange(node, selectionStart, selectionEnd);\n this.inputSelectionStart = selectionStart;\n this.inputSelectionEnd = selectionEnd;\n }\n\n\n /**\n * Set selection range only if input is in focused state\n * @param node DOMElement\n * @param start number\n * @param end number\n */\n setSelectionRange(node, start, end) {\n if (document.activeElement === node) {\n node.setSelectionRange(start, end);\n }\n }\n\n\n /**\n * onChange Event Handler\n * @param event\n */\n handleChange(event) {\n event.preventDefault();\n let { maskedValue, value } = mask(\n event.target.value,\n this.props.precision,\n this.props.decimalSeparator,\n this.props.thousandSeparator,\n this.props.allowNegative,\n this.props.prefix,\n this.props.suffix\n );\n\n event.persist(); // fixes issue #23\n\n this.setState({ maskedValue, value }, () => {\n this.props.onChange(maskedValue, value, event);\n this.props.onChangeEvent(event, maskedValue, value);\n });\n }\n\n\n /**\n * onFocus Event Handler\n * @param event\n */\n handleFocus(event) {\n //Whenever we receive focus check to see if the position is before the suffix, if not, move it.\n let selectionEnd = this.theInput.value.length - this.props.suffix.length;\n let isNegative = (this.theInput.value.match(/-/g) || []).length % 2 === 1;\n let selectionStart = this.props.prefix.length + (isNegative ? 1 : 0);\n event.target.setSelectionRange(selectionStart, selectionEnd);\n this.inputSelectionStart = selectionStart;\n this.inputSelectionEnd = selectionEnd;\n }\n\n\n handleBlur(event) {\n this.inputSelectionStart = 0;\n this.inputSelectionEnd = 0;\n }\n\n\n /**\n * Component lifecycle function.\n * @returns {XML}\n * @see https://facebook.github.io/react/docs/component-specs.html#render\n */\n render() {\n return (\n { this.theInput = input; }}\n autoFocus={this.props.autoFocus}\n type={this.props.inputType}\n value={this.state.maskedValue}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onMouseUp={this.handleFocus}\n {...this.state.customProps}\n />\n )\n }\n}\n\n\n\n/**\n * Prop validation.\n * @see https://facebook.github.io/react/docs/component-specs.html#proptypes\n */\n\nCurrencyInput.propTypes = {\n onChange: PropTypes.func,\n value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n decimalSeparator: PropTypes.string,\n thousandSeparator: PropTypes.string,\n precision: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n inputType: PropTypes.string,\n allowNegative: PropTypes.bool,\n allowEmpty: PropTypes.bool,\n prefix: PropTypes.string,\n suffix: PropTypes.string\n};\n\n\nCurrencyInput.defaultProps = {\n onChange: function(maskValue, value, event) {/*no-op*/},\n onChangeEvent: function(event, maskValue, value) {/*no-op*/},\n value: '0',\n decimalSeparator: '.',\n thousandSeparator: ',',\n precision: '2',\n inputType: 'text',\n allowNegative: false,\n prefix: '',\n suffix: ''\n};\n\n\nexport default CurrencyInput\nexport {mask}\n"],"names":["mask","value","precision","decimalSeparator","thousandSeparator","allowNegative","prefix","suffix","maskedValue","String","length","let","digits","match","numberIsNegative","allDigitsAreZero","idx","unshift","splice","Number","join","toFixed","split","raw","decimalpos","x","push","trim","parseFloat","CurrencyInput","props","super","this","prepareProps","bind","handleChange","handleFocus","setSelectionRange","state","inputSelectionStart","inputSelectionEnd","getMaskedValue","customProps","Object","onChange","onChangeEvent","inputType","allowEmpty","autoFocus","initialValue","replace","RegExp","toLocaleString","undefined","style","minimumFractionDigits","maximumFractionDigits","componentWillReceiveProps","nextProps","setState","componentDidMount","node","ReactDOM","findDOMNode","theInput","selectionEnd","Math","min","selectionStart","componentWillUpdate","componentDidUpdate","prevProps","prevState","isNegative","minPos","max","regexEscapeRegex","separatorsRegex","currSeparatorCount","prevSeparatorCount","adjustment","baselength","start","end","document","activeElement","event","preventDefault","target","persist","handleBlur","render","React","ref","input","type","onFocus","onMouseUp","Component","propTypes","PropTypes","func","oneOfType","number","string","bool","defaultProps","maskValue"],"mappings":"yZACe,SAASA,EAAKC,EAAOC,EAAeC,EAAwBC,EAAyBC,EAAuBC,EAAaC,GAKpI,kBAL4C,kBAAsB,oBAAyB,qBAAqB,kBAAgB,mBAAa,IAEzIL,EAAY,IAAKA,EAAY,GACjB,GAAZA,IAAkBA,EAAY,IAE9BD,MAAAA,EACE,MAAO,CACHA,MAAO,EACPO,YAAa,IAMvB,GAAoB,IAFpBP,EAAQQ,OAAOR,IAELS,OACN,MAAO,CACHT,MAAO,EACPO,YAAa,IAMrBG,IAAIC,EAASX,EAAMY,MAAM,QAAU,CAAC,KAEhCC,GAAmB,EACvB,GAAIT,EAAe,CAKfS,GAJyBb,EAAMY,MAAM,OAAS,IAAIH,OAIX,GAAM,EAI7C,IADAC,IAAII,GAAmB,EACdC,EAAI,EAAGA,EAAMJ,EAAOF,OAAQM,GAAO,EACxC,GAAmB,MAAhBJ,EAAOI,GAAc,CACpBD,GAAmB,EACnB,MAGJA,IACAD,GAAmB,GAK3B,KAAOF,EAAOF,QAAUR,GAAaU,EAAOK,QAAQ,KAEpC,EAAZf,GAEAU,EAAOM,OAAON,EAAOF,OAASR,EAAW,EAAG,KAIhDU,EAASO,OAAOP,EAAOQ,KAAK,KAAKC,QAAQnB,GAAWoB,MAAM,IAC1DX,IAAIY,EAAMJ,OAAOP,EAAOQ,KAAK,KAEzBI,EAAaZ,EAAOF,OAASR,EAAY,EAC7B,EAAZA,EAEAU,EAAOY,GAAcrB,EAGrBqB,EAAaZ,EAAOF,OAIxB,IAAKC,IAAIc,EAAED,EAAa,EAAO,EAAJC,EAAOA,GAAQ,EACtCb,EAAOM,OAAOO,EAAG,EAAGrB,GAcxB,OAVoB,EAAhBE,EAAOI,QAAcE,EAAOK,QAAQX,GACpB,EAAhBC,EAAOG,QAAcE,EAAOc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CjC,KAAKO,oBAAsB6B,EAC3BpC,KAAKQ,kBAAoByB,GAI7BpC,YAAA6D,oBAAWJ,GACPtD,KAAKO,oBAAsB,EAC3BP,KAAKQ,kBAAoB,GAS7BX,YAAA8D,6BACI,OACIC,gBAAC,yBACG,CAAAC,IAAI,SAAEC,GAAY9D,EAAKgC,SAAW8B,GAClC9C,UAAUhB,KAAMF,MAAMkB,UACtB+C,KAAK/D,KAAMF,MAAMgB,UACjB7C,MAAM+B,KAAMM,MAAM9B,YAClBoC,SAASZ,KAAMG,aACf6D,QAAQhE,KAAMI,YACd6D,UAAUjE,KAAMI,aAChBJ,KAASM,MAAMI,kBArPHwD,aAkQ5BrE,EAAcsE,UAAY,CACtBvD,SAAUwD,EAAUC,KACpBpG,MAAOmG,EAAUE,UAAU,CAACF,EAAUG,OAAQH,EAAUI,SACxDrG,iBAAkBiG,EAAUI,OAC5BpG,kBAAmBgG,EAAUI,OAC7BtG,UAAWkG,EAAUE,UAAU,CAACF,EAAUG,OAAQH,EAAUI,SAC5D1D,UAAWsD,EAAUI,OACrBnG,cAAe+F,EAAUK,KACzB1D,WAAYqD,EAAUK,KACtBnG,OAAQ8F,EAAUI,OAClBjG,OAAQ6F,EAAUI,QAItB3E,EAAc6E,aAAe,CACzB9D,SAAU,SAAS+D,EAAW1G,EAAOqF,KACrCzC,cAAe,SAASyC,EAAOqB,EAAW1G,KAC1CA,MAAO,IACPE,iBAAkB,IAClBC,kBAAmB,IACnBF,UAAW,IACX4C,UAAW,OACXzC,eAAe,EACfC,OAAQ,GACRC,OAAQ"} \ No newline at end of file diff --git a/package.json b/package.json index b6515e1..d6da9e9 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,19 @@ { "name": "react-currency-input", - "version": "1.3.4", + "version": "1.3.8", "description": "React component for inputing currency amounts", - "main": "lib/index.js", + "main": "lib/react-currency-input.cjs.js", + "jsnext:main": "lib/react-currency-input.es.js", + "module": "lib/react-currency-input.es.js", "scripts": { "lint": "eslint src/**", - "lib": "rimraf lib && npm run babel", - "babel": "babel --out-dir lib src", - "build": "npm run lib", + "build:umd": "cross-env NODE_ENV=umd rollup -c", + "build:cjs": "cross-env NODE_ENV=cjs rollup -c", + "build:es": "cross-env NODE_ENV=es rollup -c", + "build": "rimraf lib && npm run build:umd && npm run build:cjs && npm run build:es", "prepublish": "npm run build", - "build-example": "browserify example/example.js -o example/bundle.js -t [ babelify --presets [ es2015 react ] ]", - "test": "mocha --compilers js:babel-register ", + "build-example": "browserify examples/index.js -o examples/bundle.js -t [ babelify --presets [ es2015 react ] ]", + "test": "mocha --compilers js:babel-register", "webpack": "webpack", "webpack-dev": "webpack-dev-server" }, @@ -33,10 +36,10 @@ "url": "https://github.com/jsillitoe/react-currency-input/issues" }, "homepage": "https://github.com/jsillitoe/react-currency-input#readme", - "dependencies": { - "react": "^15.5.0", - "react-dom": "^15.5.0", - "prop-types": "^15.5.0" + "peerDependencies": { + "prop-types": "^15.6.0", + "react": "^16.0.0", + "react-dom": "^16.0.0" }, "devDependencies": { "babel-cli": "^6.18.0", @@ -48,16 +51,26 @@ "babelify": "^7.3.0", "browserify": "^13.0.1", "chai": "^3.5.0", + "cross-env": "^5.1.0", "eslint": "^2.13.1", - "jsdom": "^9.2.1", "mocha": "^2.5.3", - "prop-types": "^15.5.9", - "react-addons-test-utils": "^15.1.0", - "react-dom": "^15.1.0", "rimraf": "^2.5.2", + "rollup": "^0.50.0", + "rollup-plugin-buble": "^0.16.0", + "rollup-plugin-commonjs": "^8.2.1", + "rollup-plugin-filesize": "^1.4.2", + "rollup-plugin-node-resolve": "^3.0.0", + "rollup-plugin-peer-deps-external": "^1.0.0", + "rollup-plugin-uglify": "^2.0.1", "sinon": "^1.17.4", "sinon-chai": "^2.8.0", "webpack": "2.2.1", "webpack-dev-server": "2.4.1" + }, + "dependencies": { + "jsdom": "^9.12.0", + "prop-types": "^15.6.0", + "react": "^16.4.1", + "react-dom": "^16.4.1" } } diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..e19b194 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,37 @@ +import buble from 'rollup-plugin-buble'; +import resolve from 'rollup-plugin-node-resolve'; +import commonjs from 'rollup-plugin-commonjs'; +import uglify from 'rollup-plugin-uglify'; +import filesize from 'rollup-plugin-filesize'; +import peerDeps from 'rollup-plugin-peer-deps-external'; + +const format = process.env.NODE_ENV; +const isUmd = format === 'umd'; +const file = `lib/react-currency-input.${isUmd ? 'min' : format}.js` + +const config = { + input: './src/index.js', + name: 'react-currency-input', + sourcemap: true, + output: { + file, + format, + }, + plugins: [ + peerDeps(), + resolve({ + jsnext: true, + main: true, + browser: true, + }), + buble({ + objectAssign: 'Object.assign', + exclude: ['node_modules/**'], + }), + commonjs(), + ], +}; + +isUmd && config.plugins.push(uglify(), filesize()); + +export default config; diff --git a/src/index.js b/src/index.js index 5b1d7be..ec032a4 100644 --- a/src/index.js +++ b/src/index.js @@ -13,6 +13,7 @@ class CurrencyInput extends Component { this.prepareProps = this.prepareProps.bind(this); this.handleChange = this.handleChange.bind(this); this.handleFocus = this.handleFocus.bind(this); + this.setSelectionRange = this.setSelectionRange.bind(this); this.state = this.prepareProps(this.props); this.inputSelectionStart = 0; @@ -47,6 +48,7 @@ class CurrencyInput extends Component { delete customProps.allowEmpty; delete customProps.prefix; delete customProps.suffix; + delete customProps.autoFocus; let initialValue = props.value; if (initialValue === null) { @@ -119,7 +121,7 @@ class CurrencyInput extends Component { let selectionEnd = Math.min(node.selectionEnd, this.theInput.value.length - this.props.suffix.length); let selectionStart = Math.min(node.selectionStart, selectionEnd); //console.log("normal", selectionStart, selectionEnd); - node.setSelectionRange(selectionStart, selectionEnd); + this.setSelectionRange(node, selectionStart, selectionEnd); } @@ -170,12 +172,25 @@ class CurrencyInput extends Component { selectionStart = selectionEnd; } - node.setSelectionRange(selectionStart, selectionEnd); + this.setSelectionRange(node, selectionStart, selectionEnd); this.inputSelectionStart = selectionStart; this.inputSelectionEnd = selectionEnd; } + /** + * Set selection range only if input is in focused state + * @param node DOMElement + * @param start number + * @param end number + */ + setSelectionRange(node, start, end) { + if (document.activeElement === node) { + node.setSelectionRange(start, end); + } + } + + /** * onChange Event Handler * @param event @@ -231,6 +246,7 @@ class CurrencyInput extends Component { return ( { this.theInput = input; }} + autoFocus={this.props.autoFocus} type={this.props.inputType} value={this.state.maskedValue} onChange={this.handleChange} @@ -278,3 +294,4 @@ CurrencyInput.defaultProps = { export default CurrencyInput +export {mask} diff --git a/yarn.lock b/yarn.lock index 36ed3c6..eddb6a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,9 +9,9 @@ JSONStream@^1.0.3: jsonparse "^1.2.0" through ">=2.2.7 <3" -abab@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d" +abab@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" abbrev@1: version "1.0.9" @@ -30,27 +30,33 @@ acorn-dynamic-import@^2.0.0: dependencies: acorn "^4.0.3" -acorn-globals@^1.0.4: - version "1.0.9" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-1.0.9.tgz#55bb5e98691507b74579d0513413217c380c54cf" +acorn-globals@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf" dependencies: - acorn "^2.1.0" + acorn "^4.0.4" -acorn-jsx@^3.0.0: +acorn-jsx@^3.0.0, acorn-jsx@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" dependencies: acorn "^3.0.4" +acorn-object-spread@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/acorn-object-spread/-/acorn-object-spread-1.0.0.tgz#48ead0f4a8eb16995a17a0db9ffc6acaada4ba68" + dependencies: + acorn "^3.1.0" + acorn@^1.0.3: version "1.2.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-1.2.2.tgz#c8ce27de0acc76d896d2b1fad3df588d9e82f014" -acorn@^2.1.0, acorn@^2.4.0, acorn@^2.7.0: +acorn@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-2.7.0.tgz#ab6e7d9d886aaca8b085bc3312b79a198433f0e7" -acorn@^3.0.4, acorn@^3.1.0: +acorn@^3.0.4, acorn@^3.1.0, acorn@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" @@ -58,6 +64,10 @@ acorn@^4.0.1, acorn@^4.0.3, acorn@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" +acorn@^5.2.1: + version "5.7.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" + ajv-keywords@^1.0.0, ajv-keywords@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.2.0.tgz#676c4f087bfe1e8b12dca6fda2f3c74f417b099c" @@ -81,6 +91,12 @@ amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" +ansi-align@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-2.0.0.tgz#c36aeccba563b89ceb556f3690f0b1d9e3547f7f" + dependencies: + string-width "^2.0.0" + ansi-escapes@^1.1.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" @@ -93,10 +109,20 @@ ansi-regex@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.0.0.tgz#c5061b6e0ef8a81775e50f5d66151bf6bf371107" +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + dependencies: + color-convert "^1.9.0" + anymatch@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507" @@ -127,10 +153,22 @@ arr-diff@^2.0.0: dependencies: arr-flatten "^1.0.1" +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + arr-flatten@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.0.1.tgz#e5ffe54d45e19f32f216e91eb99c8ce892bb604b" +arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + array-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" @@ -165,14 +203,14 @@ array-unique@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" -asap@~2.0.3: - version "2.0.5" - resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f" - asn1.js@^4.0.0: version "4.9.0" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.9.0.tgz#f71a1243f3e79d46d7b07d7fbf4824ee73af054a" @@ -203,6 +241,10 @@ assertion-error@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c" +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + astw@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/astw/-/astw-2.0.0.tgz#08121ac8288d35611c0ceec663f6cd545604897d" @@ -227,6 +269,10 @@ asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" +atob@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + aws-sign2@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" @@ -912,6 +958,18 @@ base64-js@^1.0.2: version "1.2.0" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.2.0.tgz#a39992d723584811982be5e290bb6a53d86700f1" +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" + batch@0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" @@ -946,6 +1004,18 @@ boom@2.x.x: dependencies: hoek "2.x.x" +boxen@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.3.0.tgz#55c6c39a8ba58d9c61ad22cd877532deb665a20b" + dependencies: + ansi-align "^2.0.0" + camelcase "^4.0.0" + chalk "^2.0.1" + cli-boxes "^1.0.0" + string-width "^2.0.0" + term-size "^1.2.0" + widest-line "^2.0.0" + brace-expansion@^1.0.0: version "1.1.6" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9" @@ -961,6 +1031,21 @@ braces@^1.8.2: preserve "^0.2.0" repeat-element "^1.1.2" +braces@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + dependencies: + arr-flatten "^1.1.0" + array-unique "^0.3.2" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" + brorand@^1.0.1: version "1.0.6" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.0.6.tgz#4028706b915f91f7b349a2e0bf3c376039d216e5" @@ -1084,6 +1169,19 @@ browserify@^13.0.1: vm-browserify "~0.0.1" xtend "^4.0.0" +buble@^0.16.0: + version "0.16.0" + resolved "https://registry.yarnpkg.com/buble/-/buble-0.16.0.tgz#1773e7b5a383f5c722af6b1b16b2ba49cb866a98" + dependencies: + acorn "^3.3.0" + acorn-jsx "^3.0.1" + acorn-object-spread "^1.0.0" + chalk "^1.1.3" + magic-string "^0.14.0" + minimist "^1.2.0" + os-homedir "^1.0.1" + vlq "^0.2.2" + buffer-shims@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" @@ -1104,6 +1202,10 @@ builtin-modules@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" +builtin-modules@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-2.0.0.tgz#60b7ef5ae6546bd7deefa74b08b62a43a232648e" + builtin-status-codes@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-2.0.0.tgz#6f22003baacf003ccd287afe6872151fddc58579" @@ -1112,6 +1214,20 @@ bytes@2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-2.5.0.tgz#4c9423ea2d252c270c41b2bdefeff9bb6b62c06a" +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" + cached-path-relative@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/cached-path-relative/-/cached-path-relative-1.0.0.tgz#d1094c577fbd9a8b8bd43c96af6188aa205d05f4" @@ -1134,6 +1250,10 @@ camelcase@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" +camelcase@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + caseless@~0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7" @@ -1163,6 +1283,14 @@ chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@^2.0.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + chokidar@^1.0.0, chokidar@^1.6.0: version "1.6.1" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2" @@ -1203,6 +1331,19 @@ circular-json@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + +cli-boxes@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" + cli-cursor@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" @@ -1237,6 +1378,27 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + dependencies: + color-name "1.1.3" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + +colors@^1.1.2: + version "1.3.3" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.3.3.tgz#39e005d546afe01e01f9c4ca8fa50f686a01205d" + combine-source-map@~0.7.1: version "0.7.2" resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.7.2.tgz#0870312856b307a87cc4ac486f3a9a62aeccc09e" @@ -1266,10 +1428,18 @@ commander@^2.8.1, commander@^2.9.0: dependencies: graceful-readlink ">= 1.0.0" +commander@~2.17.1: + version "2.17.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" + commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" +component-emitter@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" + compressible@~2.0.10: version "2.0.10" resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.10.tgz#feda1c7f7617912732b29bf8cf26252a20b9eecd" @@ -1346,9 +1516,9 @@ cookie@0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" -core-js@^1.0.0: - version "1.2.7" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" core-js@^2.4.0: version "2.4.1" @@ -1381,13 +1551,30 @@ create-hmac@^1.1.0, create-hmac@^1.1.2: create-hash "^1.1.0" inherits "^2.0.1" -create-react-class@^15.6.0: - version "15.6.0" - resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.0.tgz#ab448497c26566e1e29413e883207d57cfe7bed4" +cross-env@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.2.0.tgz#6ecd4c015d5773e614039ee529076669b9d126f2" dependencies: - fbjs "^0.8.9" - loose-envify "^1.3.1" - object-assign "^4.1.1" + cross-spawn "^6.0.5" + is-windows "^1.0.0" + +cross-spawn@^5.0.1: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + +cross-spawn@^6.0.5: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" cryptiles@2.x.x: version "2.0.5" @@ -1410,11 +1597,15 @@ crypto-browserify@^3.0.0, crypto-browserify@^3.11.0: public-encrypt "^4.0.0" randombytes "^2.0.0" -cssom@0.3.x, "cssom@>= 0.3.0 < 0.4.0": +cssom@0.3.x: version "0.3.1" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.1.tgz#c9e37ef2490e64f6d1baa10fda852257082c25d3" -"cssstyle@>= 0.2.36 < 0.3.0": +"cssom@>= 0.3.2 < 0.4.0": + version "0.3.6" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.6.tgz#f85206cee04efa841f3c5982a74ba96ab20d65ad" + +"cssstyle@>= 0.2.37 < 0.3.0": version "0.2.37" resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54" dependencies: @@ -1460,10 +1651,26 @@ debug@^2.1.1, debug@^2.2.0: dependencies: ms "0.7.2" +debug@^2.3.3: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + dependencies: + ms "2.0.0" + decamelize@^1.0.0, decamelize@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + +deep-assign@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/deep-assign/-/deep-assign-2.0.0.tgz#ebe06b1f07f08dae597620e3dd1622f371a1c572" + dependencies: + is-obj "^1.0.0" + deep-eql@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2" @@ -1478,6 +1685,25 @@ deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + defined@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" @@ -1572,6 +1798,10 @@ duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2: dependencies: readable-stream "^2.0.2" +duplexer@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" + ecc-jsbn@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" @@ -1599,12 +1829,6 @@ encodeurl@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.1.tgz#79e3d58655346909fe6f0f45a5de68103b294d20" -encoding@^0.1.11: - version "0.1.12" - resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" - dependencies: - iconv-lite "~0.4.13" - enhanced-resolve@^3.0.0: version "3.3.0" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.3.0.tgz#950964ecc7f0332a42321b673b38dc8ff15535b3" @@ -1778,6 +2002,14 @@ estraverse@~4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" +estree-walker@^0.5.0: + version "0.5.2" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.2.tgz#d3850be7529c9580d815600b53126515e146dd39" + +estree-walker@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.0.tgz#5d865327c44a618dde5699f763891ae31f257dae" + esutils@^2.0.0, esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -1813,6 +2045,18 @@ evp_bytestokey@^1.0.0: dependencies: create-hash "^1.1.1" +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + exit-hook@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" @@ -1823,6 +2067,18 @@ expand-brackets@^0.1.4: dependencies: is-posix-bracket "^0.1.0" +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + expand-range@^1.8.1: version "1.8.2" resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" @@ -1862,6 +2118,19 @@ express@^4.13.3: utils-merge "1.0.0" vary "~1.1.1" +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0, extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + extend@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4" @@ -1872,6 +2141,19 @@ extglob@^0.3.1: dependencies: is-extglob "^1.0.0" +extglob@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + extsprintf@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550" @@ -1892,18 +2174,6 @@ faye-websocket@~0.11.0: dependencies: websocket-driver ">=0.5.1" -fbjs@^0.8.9: - version "0.8.12" - resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04" - dependencies: - core-js "^1.0.0" - isomorphic-fetch "^2.1.1" - loose-envify "^1.0.0" - object-assign "^4.1.0" - promise "^7.1.1" - setimmediate "^1.0.5" - ua-parser-js "^0.7.9" - figures@^1.3.5: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" @@ -1922,6 +2192,10 @@ filename-regex@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.0.tgz#996e3e80479b98b9897f15a8a58b3d084e926775" +filesize@^3.5.6: + version "3.6.1" + resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317" + fill-range@^2.1.0: version "2.2.3" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" @@ -1932,6 +2206,15 @@ fill-range@^2.1.0: repeat-element "^1.1.2" repeat-string "^1.5.2" +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + finalhandler@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.0.3.tgz#ef47e77950e999780e86022a560e3217e0d0cc89" @@ -1972,6 +2255,10 @@ for-in@^0.1.5: version "0.1.6" resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.6.tgz#c9f96e89bfad18a545af5ec3ed352a1d9e5b4dc8" +for-in@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + for-own@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.4.tgz#0149b41a39088c7515f51ebe1c1386d45f935072" @@ -2000,6 +2287,12 @@ forwarded@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.0.tgz#19ef9874c4ae1c297bcf078fde63a09b66a84363" +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + dependencies: + map-cache "^0.2.2" + fresh@0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.0.tgz#f474ca5e6a9246d6fd8e0953cfa9b9c805afa78e" @@ -2068,6 +2361,14 @@ get-caller-file@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + getpass@^0.1.1: version "0.1.6" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.6.tgz#283ffd9fc1256840875311c1b60e8c40187110e6" @@ -2142,6 +2443,12 @@ growl@1.9.2: version "1.9.2" resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" +gzip-size@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-3.0.0.tgz#546188e9bdc337f673772f81660464b389dce520" + dependencies: + duplexer "^0.1.1" + handle-thing@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-1.2.5.tgz#fd7aad726bf1a5fd16dfc29b2f7a6601d27139c4" @@ -2165,10 +2472,41 @@ has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" + +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + has@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" @@ -2273,10 +2611,6 @@ iconv-lite@0.4.13: version "0.4.13" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2" -iconv-lite@^0.4.13, iconv-lite@~0.4.13: - version "0.4.15" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb" - ieee754@^1.1.4: version "1.1.8" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4" @@ -2367,6 +2701,18 @@ ipaddr.js@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.3.0.tgz#1e03a52fdad83a8bbb2b25cbf4998b4cffcd3dec" +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + dependencies: + kind-of "^6.0.0" + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" @@ -2381,12 +2727,44 @@ is-buffer@^1.0.2, is-buffer@^1.1.0: version "1.1.4" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b" +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + is-builtin-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" dependencies: builtin-modules "^1.0.0" +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + dependencies: + kind-of "^6.0.0" + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + is-dotfile@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.2.tgz#2c132383f39199f8edc268ca01b9b007d205cc4d" @@ -2397,10 +2775,16 @@ is-equal-shallow@^0.1.3: dependencies: is-primitive "^2.0.0" -is-extendable@^0.1.1: +is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + dependencies: + is-plain-object "^2.0.4" + is-extglob@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" @@ -2437,6 +2821,10 @@ is-glob@^3.1.0: dependencies: is-extglob "^2.1.0" +is-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" + is-my-json-valid@^2.10.0, is-my-json-valid@^2.12.4: version "2.15.0" resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz#936edda3ca3c211fd98f3b2d3e08da43f7b2915b" @@ -2452,6 +2840,16 @@ is-number@^2.0.2, is-number@^2.1.0: dependencies: kind-of "^3.0.2" +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + dependencies: + kind-of "^3.0.2" + +is-obj@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + is-path-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" @@ -2468,6 +2866,12 @@ is-path-inside@^1.0.0: dependencies: path-is-inside "^1.0.1" +is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + dependencies: + isobject "^3.0.1" + is-posix-bracket@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" @@ -2486,7 +2890,7 @@ is-resolvable@^1.0.0: dependencies: tryit "^1.0.1" -is-stream@^1.0.1: +is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -2498,6 +2902,10 @@ is-utf8@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" +is-windows@^1.0.0, is-windows@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -2506,18 +2914,19 @@ isarray@~0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" dependencies: isarray "1.0.0" -isomorphic-fetch@^2.1.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" - dependencies: - node-fetch "^1.0.1" - whatwg-fetch ">=0.10.0" +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" isstream@~0.1.2: version "0.1.2" @@ -2544,6 +2953,10 @@ js-tokens@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" +"js-tokens@^3.0.0 || ^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + js-yaml@^3.5.1: version "3.7.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.7.0.tgz#5c967ddd837a9bfdca5f2de84253abe8a1c03b80" @@ -2555,30 +2968,29 @@ jsbn@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.0.tgz#650987da0dd74f4ebf5a11377a2aa2d273e97dfd" -jsdom@^9.2.1: - version "9.9.1" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.9.1.tgz#84f3972ad394ab963233af8725211bce4d01bfd5" +jsdom@^9.12.0: + version "9.12.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.12.0.tgz#e8c546fffcb06c00d4833ca84410fed7f8a097d4" dependencies: - abab "^1.0.0" - acorn "^2.4.0" - acorn-globals "^1.0.4" + abab "^1.0.3" + acorn "^4.0.4" + acorn-globals "^3.1.0" array-equal "^1.0.0" content-type-parser "^1.0.1" - cssom ">= 0.3.0 < 0.4.0" - cssstyle ">= 0.2.36 < 0.3.0" + cssom ">= 0.3.2 < 0.4.0" + cssstyle ">= 0.2.37 < 0.3.0" escodegen "^1.6.1" html-encoding-sniffer "^1.0.1" - iconv-lite "^0.4.13" nwmatcher ">= 1.3.9 < 2.0.0" parse5 "^1.5.1" - request "^2.55.0" - sax "^1.1.4" - symbol-tree ">= 3.1.0 < 4.0.0" - tough-cookie "^2.3.1" - webidl-conversions "^3.0.1" + request "^2.79.0" + sax "^1.2.1" + symbol-tree "^3.2.1" + tough-cookie "^2.3.2" + webidl-conversions "^4.0.0" whatwg-encoding "^1.0.1" - whatwg-url "^4.1.0" - xml-name-validator ">= 2.0.1 < 3.0.0" + whatwg-url "^4.3.0" + xml-name-validator "^2.0.1" jsesc@^1.3.0: version "1.3.0" @@ -2646,6 +3058,26 @@ kind-of@^3.0.2: dependencies: is-buffer "^1.0.2" +kind-of@^3.0.3, kind-of@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + dependencies: + is-buffer "^1.1.5" + +kind-of@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + labeled-stream-splicer@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/labeled-stream-splicer/-/labeled-stream-splicer-2.0.0.tgz#a52e1d138024c00b86b1c0c91f677918b8ae0a59" @@ -2722,16 +3154,45 @@ loose-envify@^1.0.0, loose-envify@^1.1.0: dependencies: js-tokens "^2.0.0" -loose-envify@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" +loose-envify@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" dependencies: - js-tokens "^3.0.0" + js-tokens "^3.0.0 || ^4.0.0" lru-cache@2: version "2.7.3" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" +lru-cache@^4.0.1: + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + +magic-string@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.14.0.tgz#57224aef1701caeed273b17a39a956e72b172462" + dependencies: + vlq "^0.2.1" + +magic-string@^0.22.4: + version "0.22.5" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.5.tgz#8e9cf5afddf44385c1da5bc2a6a0dbd10b03657e" + dependencies: + vlq "^0.2.2" + +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + dependencies: + object-visit "^1.0.0" + media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" @@ -2769,6 +3230,24 @@ micromatch@^2.1.5, micromatch@^2.3.11: parse-glob "^3.0.4" regex-cache "^0.4.2" +micromatch@^3.1.10: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + miller-rabin@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.0.tgz#4a62fb1d42933c05583982f4c716f6fb9e6c6d3d" @@ -2833,6 +3312,13 @@ minimist@^1.1.0, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" +mixin-deep@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + mkdirp@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.0.tgz#1bbf5ab1ba827af23575143490426455f481fe1e" @@ -2898,16 +3384,29 @@ nan@^2.3.0: version "2.4.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.4.0.tgz#fb3c59d45fe4effe215f0b890f8adf6eb32d2232" +nanomatch@^1.2.9: + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^2.0.2" + extend-shallow "^3.0.2" + fragment-cache "^0.2.1" + is-windows "^1.0.2" + kind-of "^6.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + negotiator@0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" -node-fetch@^1.0.1: - version "1.6.3" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.6.3.tgz#dc234edd6489982d58e8f0db4f695029abcd8c04" - dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" node-libs-browser@^2.0.0: version "2.0.0" @@ -2970,6 +3469,12 @@ normalize-path@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.0.1.tgz#47886ac1662760d4261b7d979d241709d3ce3f7a" +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + dependencies: + path-key "^2.0.0" + npmlog@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.0.2.tgz#d03950e0e78ce1527ba26d2a7592e9348ac3e75f" @@ -2999,6 +3504,20 @@ object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + dependencies: + isobject "^3.0.0" + object.omit@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" @@ -3006,6 +3525,12 @@ object.omit@^2.0.0: for-own "^0.1.4" is-extendable "^0.1.1" +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + dependencies: + isobject "^3.0.1" + obuf@^1.0.0, obuf@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.1.tgz#104124b6c602c6796881a042541d36db43a5264e" @@ -3068,7 +3593,7 @@ os-browserify@~0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.1.2.tgz#49ca0293e0b19590a5f5de10c7f265a617d8fe54" -os-homedir@^1.0.0: +os-homedir@^1.0.0, os-homedir@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" @@ -3090,6 +3615,10 @@ output-file-sync@^1.1.0: mkdirp "^0.5.1" object-assign "^4.1.0" +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + pako@~0.2.0: version "0.2.9" resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75" @@ -3133,6 +3662,10 @@ parseurl@~1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.1.tgz#c8ab8c9223ba34888aa64a297b28853bec18da56" +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + path-browserify@0.0.0, path-browserify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.0.tgz#a0b870729aae214005b7d5032ec2cbbb0fb4451a" @@ -3151,6 +3684,14 @@ path-is-inside@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" +path-key@^2.0.0, path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + +path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + path-platform@~0.11.15: version "0.11.15" resolved "https://registry.yarnpkg.com/path-platform/-/path-platform-0.11.15.tgz#e864217f74c36850f0852b78dc7bf7d4a5721bf2" @@ -3205,6 +3746,10 @@ portfinder@^1.0.9: debug "^2.2.0" mkdirp "0.5.x" +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -3229,18 +3774,13 @@ progress@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" -promise@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf" - dependencies: - asap "~2.0.3" - -prop-types@^15.5.0, prop-types@^15.5.10: - version "15.5.10" - resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154" +prop-types@^15.6.0, prop-types@^15.6.2: + version "15.7.2" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" dependencies: - fbjs "^0.8.9" - loose-envify "^1.3.1" + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.8.1" proxy-addr@~1.1.4: version "1.1.4" @@ -3253,6 +3793,14 @@ prr@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + +psl@^1.1.28: + version "1.1.31" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.31.tgz#e9aa86d0101b5b105cbe93ac6b784cd547276184" + public-encrypt@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.0.tgz#39f699f3a46560dd5ebacbca693caf7c65c18cc6" @@ -3271,6 +3819,10 @@ punycode@^1.2.4, punycode@^1.3.2, punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" +punycode@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + qs@6.4.0: version "6.4.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" @@ -3319,28 +3871,27 @@ rc@~1.1.6: minimist "^1.2.0" strip-json-comments "~1.0.4" -react-addons-test-utils@^15.1.0: - version "15.4.1" - resolved "https://registry.yarnpkg.com/react-addons-test-utils/-/react-addons-test-utils-15.4.1.tgz#1e4caab151bf27cce26df5f9cb714f4fd8359ae1" - -react-dom@^15.5.0: - version "15.6.1" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.6.1.tgz#2cb0ed4191038e53c209eb3a79a23e2a4cf99470" +react-dom@^16.4.1: + version "16.8.3" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.3.tgz#ae236029e66210783ac81999d3015dfc475b9c32" dependencies: - fbjs "^0.8.9" loose-envify "^1.1.0" - object-assign "^4.1.0" - prop-types "^15.5.10" + object-assign "^4.1.1" + prop-types "^15.6.2" + scheduler "^0.13.3" -react@^15.5.0: - version "15.6.1" - resolved "https://registry.yarnpkg.com/react/-/react-15.6.1.tgz#baa8434ec6780bde997cdc380b79cd33b96393df" +react-is@^16.8.1: + version "16.8.3" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.3.tgz#4ad8b029c2a718fc0cfc746c8d4e1b7221e5387d" + +react@^16.4.1: + version "16.8.3" + resolved "https://registry.yarnpkg.com/react/-/react-16.8.3.tgz#c6f988a2ce895375de216edcfaedd6b9a76451d9" dependencies: - create-react-class "^15.6.0" - fbjs "^0.8.9" loose-envify "^1.1.0" - object-assign "^4.1.0" - prop-types "^15.5.10" + object-assign "^4.1.1" + prop-types "^15.6.2" + scheduler "^0.13.3" read-only-stream@^2.0.0: version "2.0.0" @@ -3450,6 +4001,13 @@ regex-cache@^0.4.2: is-equal-shallow "^0.1.3" is-primitive "^2.0.0" +regex-not@^1.0.0, regex-not@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + dependencies: + extend-shallow "^3.0.2" + safe-regex "^1.1.0" + regexpu-core@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-2.0.0.tgz#49d038837b8dcf8bfa5b9a42139938e6ea2ae240" @@ -3472,7 +4030,7 @@ repeat-element@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" -repeat-string@^1.5.2: +repeat-string@^1.5.2, repeat-string@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" @@ -3482,7 +4040,7 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" -request@^2.55.0, request@^2.79.0: +request@^2.79.0: version "2.79.0" resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" dependencies: @@ -3530,6 +4088,10 @@ resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" @@ -3538,6 +4100,12 @@ resolve@^1.1.3, resolve@^1.1.4: version "1.2.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c" +resolve@^1.1.6, resolve@^1.4.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.0.tgz#3bdaaeaf45cc07f375656dfd2e54ed0810b101ba" + dependencies: + path-parse "^1.0.6" + restore-cursor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" @@ -3545,6 +4113,10 @@ restore-cursor@^1.0.1: exit-hook "^1.0.0" onetime "^1.0.0" +ret@~0.1.10: + version "0.1.15" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + right-align@^0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" @@ -3561,6 +4133,62 @@ ripemd160@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-1.0.1.tgz#93a4bbd4942bc574b69a8fa57c71de10ecca7d6e" +rollup-plugin-buble@^0.16.0: + version "0.16.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-buble/-/rollup-plugin-buble-0.16.0.tgz#3c66e2f4703527f5d27a4054f97d5eef463c5bb8" + dependencies: + buble "^0.16.0" + rollup-pluginutils "^2.0.1" + +rollup-plugin-commonjs@^8.2.1: + version "8.4.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.4.1.tgz#5c9cea2b2c3de322f5fbccd147e07ed5e502d7a0" + dependencies: + acorn "^5.2.1" + estree-walker "^0.5.0" + magic-string "^0.22.4" + resolve "^1.4.0" + rollup-pluginutils "^2.0.1" + +rollup-plugin-filesize@^1.4.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-filesize/-/rollup-plugin-filesize-1.5.0.tgz#bb5841242d88be57f231c9e8a3a541925392178b" + dependencies: + boxen "^1.1.0" + colors "^1.1.2" + deep-assign "^2.0.0" + filesize "^3.5.6" + gzip-size "^3.0.0" + +rollup-plugin-node-resolve@^3.0.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.4.0.tgz#908585eda12e393caac7498715a01e08606abc89" + dependencies: + builtin-modules "^2.0.0" + is-module "^1.0.0" + resolve "^1.1.6" + +rollup-plugin-peer-deps-external@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-peer-deps-external/-/rollup-plugin-peer-deps-external-1.0.0.tgz#6fa5b99f8393969cfa1e8e8af20cbaa610756c43" + +rollup-plugin-uglify@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-2.0.1.tgz#67b37ad1efdafbd83af4c36b40c189ee4866c969" + dependencies: + uglify-js "^3.0.9" + +rollup-pluginutils@^2.0.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.4.1.tgz#de43ab54965bbf47843599a7f3adceb723de38db" + dependencies: + estree-walker "^0.6.0" + micromatch "^3.1.10" + +rollup@^0.50.0: + version "0.50.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.50.1.tgz#e4dafcbf8d2bb0d9f5589d0cc6f64d76b8815730" + run-async@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" @@ -3575,13 +4203,26 @@ safe-buffer@5.1.1, safe-buffer@^5.0.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" +safe-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + dependencies: + ret "~0.1.10" + samsam@1.1.2, samsam@~1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.1.2.tgz#bec11fdc83a9fda063401210e40176c3024d1567" -sax@^1.1.4: - version "1.2.1" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.1.tgz#7b8e656190b228e81a66aea748480d828cd2d37a" +sax@^1.2.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + +scheduler@^0.13.3: + version "0.13.3" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.13.3.tgz#bed3c5850f62ea9c716a4d781f9daeb9b2a58896" + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" select-hose@^2.0.0: version "2.0.0" @@ -3591,6 +4232,10 @@ select-hose@^2.0.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" +semver@^5.5.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" + send@0.15.3: version "0.15.3" resolved "https://registry.yarnpkg.com/send/-/send-0.15.3.tgz#5013f9f99023df50d1bd9892c19e3defd1d53309" @@ -3638,7 +4283,25 @@ set-immediate-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" -setimmediate@^1.0.4, setimmediate@^1.0.5: +set-value@^0.4.3: + version "0.4.3" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.1" + to-object-path "^0.3.0" + +set-value@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" + +setimmediate@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" @@ -3659,6 +4322,16 @@ shasum@^1.0.0: json-stable-stringify "~0.0.0" sha.js "~2.4.4" +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + shell-quote@^1.4.3: version "1.6.1" resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767" @@ -3701,6 +4374,33 @@ slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^3.1.0" + sntp@1.x.x: version "1.0.9" resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" @@ -3729,22 +4429,44 @@ source-list-map@~0.1.7: version "0.1.8" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106" +source-map-resolve@^0.5.0: + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + dependencies: + atob "^2.1.1" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + source-map-support@^0.4.2: version "0.4.6" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.6.tgz#32552aa64b458392a85eab3b0b5ee61527167aeb" dependencies: source-map "^0.5.3" +source-map-url@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + source-map@^0.5.0, source-map@^0.5.3, source-map@~0.5.1, source-map@~0.5.3: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" +source-map@^0.5.6: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + source-map@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d" dependencies: amdefine ">=0.0.4" +source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + spdx-correct@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" @@ -3782,6 +4504,12 @@ spdy@^3.4.1: select-hose "^2.0.0" spdy-transport "^2.0.18" +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + dependencies: + extend-shallow "^3.0.0" + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -3801,6 +4529,13 @@ sshpk@^1.7.0: jsbn "~0.1.0" tweetnacl "~0.14.0" +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + "statuses@>= 1.3.1 < 2", statuses@~1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e" @@ -3851,6 +4586,13 @@ string-width@^2.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^3.0.0" +string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + string_decoder@^0.10.25, string_decoder@~0.10.0, string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" @@ -3871,12 +4613,22 @@ strip-ansi@^3.0.0, strip-ansi@^3.0.1: dependencies: ansi-regex "^2.0.0" +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + dependencies: + ansi-regex "^3.0.0" + strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" dependencies: is-utf8 "^0.2.0" +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + strip-json-comments@~1.0.1, strip-json-comments@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91" @@ -3905,9 +4657,15 @@ supports-color@^3.1.0, supports-color@^3.1.1: dependencies: has-flag "^1.0.0" -"symbol-tree@>= 3.1.0 < 4.0.0": - version "3.2.1" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.1.tgz#8549dd1d01fa9f893c18cc9ab0b106b4d9b168cb" +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + dependencies: + has-flag "^3.0.0" + +symbol-tree@^3.2.1: + version "3.2.2" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" syntax-error@^1.1.1: version "1.1.6" @@ -3951,6 +4709,12 @@ tar@~2.2.1: fstream "^1.0.2" inherits "2" +term-size@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/term-size/-/term-size-1.2.0.tgz#458b83887f288fc56d6fffbfad262e26638efa69" + dependencies: + execa "^0.7.0" + text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" @@ -3990,7 +4754,36 @@ to-iso-string@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/to-iso-string/-/to-iso-string-0.0.2.tgz#4dc19e664dfccbe25bd8db508b00c6da158255d1" -tough-cookie@^2.3.1, tough-cookie@~2.3.0: +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + dependencies: + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" + +tough-cookie@^2.3.2: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + +tough-cookie@~2.3.0: version "2.3.2" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a" dependencies: @@ -4041,10 +4834,6 @@ typedarray@~0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -ua-parser-js@^0.7.9: - version "0.7.12" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb" - uglify-js@^2.7.5: version "2.8.29" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" @@ -4054,6 +4843,13 @@ uglify-js@^2.7.5: optionalDependencies: uglify-to-browserify "~1.0.0" +uglify-js@^3.0.9: + version "3.4.9" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3" + dependencies: + commander "~2.17.1" + source-map "~0.6.1" + uglify-to-browserify@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" @@ -4066,10 +4862,30 @@ umd@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.1.tgz#8ae556e11011f63c2596708a8837259f01b3d60e" +union-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^0.4.3" + unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + dependencies: + has-value "^0.3.1" + isobject "^3.0.0" + +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + url-parse@1.0.x: version "1.0.5" resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.0.5.tgz#0854860422afdcfefeb6c965c662d4800169927b" @@ -4091,6 +4907,10 @@ url@^0.11.0, url@~0.11.0: punycode "1.3.2" querystring "0.2.0" +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + user-home@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190" @@ -4146,6 +4966,10 @@ verror@1.3.6: dependencies: extsprintf "1.0.2" +vlq@^0.2.1, vlq@^0.2.2: + version "0.2.3" + resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26" + vm-browserify@0.0.4, vm-browserify@~0.0.1: version "0.0.4" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73" @@ -4166,10 +4990,14 @@ wbuf@^1.1.0, wbuf@^1.7.2: dependencies: minimalistic-assert "^1.0.0" -webidl-conversions@^3.0.0, webidl-conversions@^3.0.1: +webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" +webidl-conversions@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" + webpack-dev-middleware@^1.9.0: version "1.11.0" resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-1.11.0.tgz#09691d0973a30ad1f82ac73a12e2087f0a4754f9" @@ -4249,13 +5077,9 @@ whatwg-encoding@^1.0.1: dependencies: iconv-lite "0.4.13" -whatwg-fetch@>=0.10.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.1.tgz#078b9461bbe91cea73cbce8bb122a05f9e92b772" - -whatwg-url@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.1.1.tgz#567074923352de781e3500d64a86aa92a971b4a4" +whatwg-url@^4.3.0: + version "4.8.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.8.0.tgz#d2981aa9148c1e00a41c5a6131166ab4683bbcc0" dependencies: tr46 "~0.0.3" webidl-conversions "^3.0.0" @@ -4264,12 +5088,24 @@ which-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" +which@^1.2.9: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + dependencies: + isexe "^2.0.0" + wide-align@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.0.tgz#40edde802a71fea1f070da3e62dcda2e7add96ad" dependencies: string-width "^1.0.1" +widest-line@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-2.0.1.tgz#7438764730ec7ef4381ce4df82fb98a53142a3fc" + dependencies: + string-width "^2.1.1" + window-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" @@ -4299,7 +5135,7 @@ write@^0.2.1: dependencies: mkdirp "^0.5.1" -"xml-name-validator@>= 2.0.1 < 3.0.0": +xml-name-validator@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635" @@ -4311,6 +5147,10 @@ y18n@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + yargs-parser@^4.2.0: version "4.2.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c"