Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-rating

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-rating - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

9

lib/react-rating.min.js

@@ -1,8 +0,3 @@

/*! react-rating - 1.3.0 | (c) 2015, 2018 dreyescat | MIT | https://github.com/dreyescat/react-rating */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactRating=t(require("react")):e.ReactRating=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="/lib",t(0)}([function(e,t,n){"use strict";e.exports=n(9)},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function i(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function a(){v&&d&&(v=!1,d.length?y=d.concat(y):h=-1,y.length&&u())}function u(){if(!v){var e=o(a);v=!0;for(var t=y.length;t;){for(d=y,y=[];++h<t;)d&&d[h].run();h=-1,t=y.length}d=null,v=!1,i(e)}}function l(e,t){this.fun=e,this.array=t}function s(){}var c,f,p=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(e){c=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(e){f=r}}();var d,y=[],v=!1,h=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];y.push(new l(e,t)),1!==y.length||v||o(u)},l.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=s,p.addListener=s,p.once=s,p.off=s,p.removeListener=s,p.removeAllListeners=s,p.emit=s,p.prependListener=s,p.prependOnceListener=s,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t){"use strict";function n(e){return function(){return e}}var r=function(){};r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){(function(t){"use strict";function n(e,t,n,o,i,a,u,l){if(r(t),!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,o,i,a,u,l],f=0;s=new Error(t.replace(/%s/g,function(){return c[f++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}var r=function(e){};"production"!==t.env.NODE_ENV&&(r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=n}).call(t,n(1))},function(e,t,n){(function(t){if("production"!==t.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,o=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},i=!0;e.exports=n(17)(o,i)}else e.exports=n(16)()}).call(t,n(1))},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(t,n){t.exports=e},function(e,t,n){(function(t){"use strict";var r=n(2),o=r;if("production"!==t.env.NODE_ENV){var i=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=0,i="Warning: "+e.replace(/%s/g,function(){return n[o++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}};o=function(e,t){if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==t.indexOf("Failed Composite propType: ")&&!e){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];i.apply(void 0,[t].concat(r))}}}e.exports=o}).call(t,n(1))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function(e,t,n){for(var r=!0;r;){var o=e,i=t,a=n;r=!1,null===o&&(o=Function.prototype);var u=Object.getOwnPropertyDescriptor(o,i);if(void 0!==u){if("value"in u)return u.value;var l=u.get;if(void 0===l)return;return l.call(a)}var s=Object.getPrototypeOf(o);if(null===s)return;e=s,t=i,n=a,r=!0,u=s=void 0}},s=n(6),c=r(s),f=n(4),p=(r(f),n(10)),d=r(p),y=function(e){function t(e){o(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.state={displayValue:this.props.value,interacting:!1,dirty:!1},this.onMouseEnter=this.onMouseEnter.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.symbolMouseMove=this.symbolMouseMove.bind(this),this.symbolClick=this.symbolClick.bind(this)}return i(t,e),u(t,[{key:"componentWillReceiveProps",value:function(e){var t=this.props.value!==e.value;this.setState(function(n){return{dirty:t||n.dirty,displayValue:t?e.value:n.displayValue}})}},{key:"componentDidUpdate",value:function(e,t){t.displayValue!==this.state.displayValue&&this.state.interacting&&this.props.onHover(this.state.displayValue),t.interacting&&!this.state.interacting&&this.props.onHover()}},{key:"symbolClick",value:function(e,t){var n=this.calculateDisplayValue(e,t);this.props.onClick(n,t)}},{key:"symbolMouseMove",value:function(e,t){var n=this.calculateDisplayValue(e,t);n!==this.state.displayValue&&this.setState({displayValue:n})}},{key:"onMouseEnter",value:function(){this.setState({interacting:!this.props.readonly})}},{key:"onMouseLeave",value:function(){this.setState({displayValue:this.props.value,interacting:!1})}},{key:"calculateDisplayValue",value:function(e,t){var n=this.calculateHoverPercentage(t),r=Math.ceil(n%1*this.props.fractions)/this.props.fractions,o=Math.pow(10,3),i=e+(Math.floor(n)+Math.floor(r*o)/o);return i>0?i>this.props.totalSymbols?this.props.totalSymbols:i:1/this.props.fractions}},{key:"calculateHoverPercentage",value:function(e){var t=e.nativeEvent.type.indexOf("touch")>-1?e.nativeEvent.type.indexOf("touchend")>-1?e.changedTouches[0].clientX:e.touches[0].clientX:e.clientX,n=e.target.getBoundingClientRect(),r="rtl"===this.props.direction?n.right-t:t-n.left;return r<0?0:r/n.width}},{key:"render",value:function(){var e=this.props,t=e.readonly,n=e.quiet,r=e.totalSymbols,o=e.value,i=e.placeholderValue,u=e.direction,l=e.emptySymbol,s=e.fullSymbol,f=e.placeholderSymbol,p=e.className,y=e.id,v=e.style,h=e.tabIndex,b=this.state,m=b.displayValue,g=b.interacting,O=[],w=[].concat(l),j=[].concat(s),T=[].concat(f),E=0!==i&&0===o&&!g,k=void 0;k=E?i:n?o:m;for(var x=Math.floor(k),P=0;P<r;P++){var _=void 0;_=P-x<0?100:P-x===0?100*(k-P):0,O.push(c.default.createElement(d.default,a({key:P,index:P,readonly:t,inactiveIcon:w[P%w.length],activeIcon:E?T[P%j.length]:j[P%j.length],percent:_,direction:u},!t&&{onClick:this.symbolClick,onMouseMove:this.symbolMouseMove,onTouchMove:this.symbolMouseMove,onTouchEnd:this.symbolClick})))}return c.default.createElement("span",a({id:y,style:a({},v,{display:"inline-block",direction:u}),className:p,tabIndex:h,"aria-label":this.props["aria-label"]},!t&&{onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave}),O)}}]),t}(c.default.PureComponent);y.propTypes=!1,t.default=y,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var o=e,i=t,a=n;r=!1,null===o&&(o=Function.prototype);var u=Object.getOwnPropertyDescriptor(o,i);if(void 0!==u){if("value"in u)return u.value;var l=u.get;if(void 0===l)return;return l.call(a)}var s=Object.getPrototypeOf(o);if(null===s)return;e=s,t=i,n=a,r=!0,u=s=void 0}},l=n(6),s=r(l),c=n(4),f=(r(c),n(13)),p=r(f),d=n(8),y=r(d),v=n(12),h=r(v),b=function(e){function t(e){o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.state={value:e.initialRating},this.handleClick=this.handleClick.bind(this),this.handleHover=this.handleHover.bind(this)}return i(t,e),a(t,[{key:"componentWillReceiveProps",value:function(e){this.setState({value:e.initialRating})}},{key:"handleClick",value:function(e,t){var n=this,r=this.translateDisplayValueToValue(e);this.state.value!==r&&this.setState({value:r},function(){return n.props.onChange(n.state.value)})}},{key:"handleHover",value:function(e){var t=void 0===e?e:this.translateDisplayValueToValue(e);this.props.onHover(t)}},{key:"translateDisplayValueToValue",value:function(e){var t=e*this.props.step+this.props.start;return t===this.props.start?t+1/this.props.fractions:t}},{key:"tranlateValueToDisplayValue",value:function(e){return void 0===e?0:(e-this.props.start)/this.props.step}},{key:"render",value:function(){function e(e,t,n){return Math.floor((t-e)/n)}var t=this.props,n=t.step,r=t.emptySymbol,o=t.fullSymbol,i=t.placeholderSymbol,a=t.readonly,u=t.quiet,l=t.fractions,c=t.direction,f=t.start,p=t.stop,d=t.id,v=t.className,h=t.style,b=t.tabIndex;return s.default.createElement(y.default,{id:d,style:h,className:v,tabIndex:b,"aria-label":this.props["aria-label"],totalSymbols:e(f,p,n),value:this.tranlateValueToDisplayValue(this.state.value),placeholderValue:this.tranlateValueToDisplayValue(this.props.placeholderRating),readonly:a,quiet:u,fractions:l,direction:c,emptySymbol:r,fullSymbol:o,placeholderSymbol:i,onClick:this.handleClick,onHover:this.handleHover})}}]),t}(s.default.PureComponent);b.defaultProps={start:0,stop:5,step:1,readonly:!1,quiet:!1,fractions:1,direction:"ltr",onChange:h.default,onHover:h.default,emptySymbol:p.default.empty,fullSymbol:p.default.full,placeholderSymbol:p.default.placeholder},b.propTypes=!1,t.default=b,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function(e,t,n){for(var r=!0;r;){var o=e,i=t,a=n;r=!1,null===o&&(o=Function.prototype);var u=Object.getOwnPropertyDescriptor(o,i);if(void 0!==u){if("value"in u)return u.value;var l=u.get;if(void 0===l)return;return l.call(a)}var s=Object.getPrototypeOf(o);if(null===s)return;e=s,t=i,n=a,r=!0,u=s=void 0}},s=n(6),c=r(s),f=n(4),p=(r(f),function(e){return c.default.isValidElement(e)?e:"object"==typeof e&&null!==e?c.default.createElement("span",{style:e}):"[object String]"===Object.prototype.toString.call(e)?c.default.createElement("span",{className:e}):void 0}),d=function(e){function t(){i(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return a(t,e),u(t,[{key:"render",value:function(){function e(e){y&&y(i,e)}function t(e){d&&(e.preventDefault(),d(i,e))}var n,r=this.props,i=r.index,a=r.inactiveIcon,u=r.activeIcon,l=r.percent,s=r.direction,f=r.readonly,d=r.onClick,y=r.onMouseMove,v=p(a),h=p(u),b=(n={display:"inline-block",position:"absolute",overflow:"hidden",top:0},o(n,"rtl"===s?"right":"left",0),o(n,"width",l+"%"),n),m={cursor:f?"inherit":"pointer",display:"inline-block",position:"relative"};return c.default.createElement("span",{style:m,onClick:t,onMouseMove:e,onTouchMove:e,onTouchEnd:t},v,c.default.createElement("span",{style:b},h))}}]),t}(c.default.PureComponent);d.propTypes=!1,t.default=d,e.exports=t.default},function(e,t){"use strict";e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}},function(e,t){"use strict";function n(){}Object.defineProperty(t,"__esModule",{value:!0}),n._name="react_rating_noop",t.default=n,e.exports=t.default},function(e,t,n){"use strict";var r=n(11),o={display:"inline-block",borderRadius:"50%",border:"5px double white",width:30,height:30};e.exports={empty:r(o,{backgroundColor:"#ccc"}),full:r(o,{backgroundColor:"black"}),placeholder:r(o,{backgroundColor:"red"})}},function(e,t){/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=r()?Object.assign:function(e,t){for(var r,u,l=n(e),s=1;s<arguments.length;s++){r=Object(arguments[s]);for(var c in r)i.call(r,c)&&(l[c]=r[c]);if(o){u=o(r);for(var f=0;f<u.length;f++)a.call(r,u[f])&&(l[u[f]]=r[u[f]])}}return l}},function(e,t,n){(function(t){"use strict";function r(e,n,r,l,s){if("production"!==t.env.NODE_ENV)for(var c in e)if(e.hasOwnProperty(c)){var f;try{o("function"==typeof e[c],"%s: %s type `%s` is invalid; it must be a function, usually from the `prop-types` package, but received `%s`.",l||"React class",r,c,typeof e[c]),f=e[c](n,c,l,r,null,a)}catch(e){f=e}if(i(!f||f instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",l||"React class",r,c,typeof f),f instanceof Error&&!(f.message in u)){u[f.message]=!0;var p=s?s():"";i(!1,"Failed %s type: %s%s",r,f.message,null!=p?p:"")}}}if("production"!==t.env.NODE_ENV)var o=n(3),i=n(7),a=n(5),u={};e.exports=r}).call(t,n(1))},function(e,t,n){"use strict";var r=n(2),o=n(3),i=n(5);e.exports=function(){function e(e,t,n,r,a,u){u!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){(function(t){"use strict";var r=n(2),o=n(3),i=n(7),a=n(14),u=n(5),l=n(15);e.exports=function(e,n){function s(e){var t=e&&(M&&e[M]||e[V]);if("function"==typeof t)return t}function c(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function f(e){this.message=e,this.stack=""}function p(e){function r(r,s,c,p,d,y,v){if(p=p||R,y=y||c,v!==u)if(n)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var h=p+":"+c;!a[h]&&l<3&&(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",y,p),a[h]=!0,l++)}return null==s[c]?r?new f(null===s[c]?"The "+d+" `"+y+"` is marked as required "+("in `"+p+"`, but its value is `null`."):"The "+d+" `"+y+"` is marked as required in "+("`"+p+"`, but its value is `undefined`.")):null:e(s,c,p,d,y)}if("production"!==t.env.NODE_ENV)var a={},l=0;var s=r.bind(null,!1);return s.isRequired=r.bind(null,!0),s}function d(e){function t(t,n,r,o,i,a){var u=t[n],l=x(u);if(l!==e){var s=P(u);return new f("Invalid "+o+" `"+i+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return p(t)}function y(){return p(r.thatReturnsNull)}function v(e){function t(t,n,r,o,i){if("function"!=typeof e)return new f("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){var l=x(a);return new f("Invalid "+o+" `"+i+"` of type "+("`"+l+"` supplied to `"+r+"`, expected an array."))}for(var s=0;s<a.length;s++){var c=e(a,s,r,o,i+"["+s+"]",u);if(c instanceof Error)return c}return null}return p(t)}function h(){function t(t,n,r,o,i){var a=t[n];if(!e(a)){var u=x(a);return new f("Invalid "+o+" `"+i+"` of type "+("`"+u+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return p(t)}function b(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var a=e.name||R,u=S(t[n]);return new f("Invalid "+o+" `"+i+"` of type "+("`"+u+"` supplied to `"+r+"`, expected ")+("instance of `"+a+"`."))}return null}return p(t)}function m(e){function n(t,n,r,o,i){for(var a=t[n],u=0;u<e.length;u++)if(c(a,e[u]))return null;var l=JSON.stringify(e);return new f("Invalid "+o+" `"+i+"` of value `"+a+"` "+("supplied to `"+r+"`, expected one of "+l+"."))}return Array.isArray(e)?p(n):("production"!==t.env.NODE_ENV?i(!1,"Invalid argument supplied to oneOf, expected an instance of array."):void 0,r.thatReturnsNull)}function g(e){function t(t,n,r,o,i){if("function"!=typeof e)return new f("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var a=t[n],l=x(a);if("object"!==l)return new f("Invalid "+o+" `"+i+"` of type "+("`"+l+"` supplied to `"+r+"`, expected an object."));for(var s in a)if(a.hasOwnProperty(s)){var c=e(a,s,r,o,i+"."+s,u);if(c instanceof Error)return c}return null}return p(t)}function O(e){function n(t,n,r,o,i){for(var a=0;a<e.length;a++){var l=e[a];if(null==l(t,n,r,o,i,u))return null}return new f("Invalid "+o+" `"+i+"` supplied to "+("`"+r+"`."))}if(!Array.isArray(e))return"production"!==t.env.NODE_ENV?i(!1,"Invalid argument supplied to oneOfType, expected an instance of array."):void 0,r.thatReturnsNull;for(var o=0;o<e.length;o++){var a=e[o];if("function"!=typeof a)return i(!1,"Invalid argument supplied to oneOfType. Expected an array of check functions, but received %s at index %s.",_(a),o),r.thatReturnsNull}return p(n)}function w(){function e(e,t,n,r,o){return E(e[t])?null:new f("Invalid "+r+" `"+o+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return p(e)}function j(e){function t(t,n,r,o,i){var a=t[n],l=x(a);if("object"!==l)return new f("Invalid "+o+" `"+i+"` of type `"+l+"` "+("supplied to `"+r+"`, expected `object`."));for(var s in e){var c=e[s];if(c){var p=c(a,s,r,o,i+"."+s,u);if(p)return p}}return null}return p(t)}function T(e){function t(t,n,r,o,i){var l=t[n],s=x(l);if("object"!==s)return new f("Invalid "+o+" `"+i+"` of type `"+s+"` "+("supplied to `"+r+"`, expected `object`."));var c=a({},t[n],e);for(var p in c){var d=e[p];if(!d)return new f("Invalid "+o+" `"+i+"` key `"+p+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=d(l,p,r,o,i+"."+p,u);if(y)return y}return null}return p(t)}function E(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(E);if(null===t||e(t))return!0;var n=s(t);if(!n)return!1;var r,o=n.call(t);if(n!==t.entries){for(;!(r=o.next()).done;)if(!E(r.value))return!1}else for(;!(r=o.next()).done;){var i=r.value;if(i&&!E(i[1]))return!1}return!0;default:return!1}}function k(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function x(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":k(t,e)?"symbol":t}function P(e){if("undefined"==typeof e||null===e)return""+e;var t=x(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function _(e){var t=P(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function S(e){return e.constructor&&e.constructor.name?e.constructor.name:R}var M="function"==typeof Symbol&&Symbol.iterator,V="@@iterator",R="<<anonymous>>",N={array:d("array"),bool:d("boolean"),func:d("function"),number:d("number"),object:d("object"),string:d("string"),symbol:d("symbol"),any:y(),arrayOf:v,element:h(),instanceOf:b,node:w(),objectOf:g,oneOf:m,oneOfType:O,shape:j,exact:T};return f.prototype=Error.prototype,N.checkPropTypes=l,N.PropTypes=N,N}}).call(t,n(1))}])});
/*! react-rating - 1.3.1 | (c) 2015, 2018 dreyescat | MIT | https://github.com/dreyescat/react-rating */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactRating=t(require("react")):e.ReactRating=t(e.React)}(window,function(e){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/lib",n(n.s=3)}([function(e,t,n){e.exports=n(4)()},function(t,n){t.exports=e},function(e,t,n){"use strict";var o=n(8),r={display:"inline-block",borderRadius:"50%",border:"5px double white",width:30,height:30};e.exports={empty:o(r,{backgroundColor:"#ccc"}),full:o(r,{backgroundColor:"black"}),placeholder:o(r,{backgroundColor:"red"})}},function(e,t,n){e.exports=n(9)},function(e,t,n){"use strict";var o=n(5),r=n(6),i=n(7);e.exports=function(){function e(e,t,n,o,a,l){l!==i&&r(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=o,n.PropTypes=n,n}},function(e,t,n){"use strict";function o(e){return function(){return e}}var r=function(){};r.thatReturns=o,r.thatReturnsFalse=o(!1),r.thatReturnsTrue=o(!0),r.thatReturnsNull=o(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";var o=function(e){};e.exports=function(e,t,n,r,i,a,l,u){if(o(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,i,a,l,u],p=0;(c=new Error(t.replace(/%s/g,function(){return s[p++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}},function(e,t,n){"use strict";n.r(t);var o=n(1),r=n.n(o),i=(n(0),n(2)),a=n.n(i);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function c(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var y=function(e){return r.a.isValidElement(e)?e:"object"===f(e)&&null!==e?r.a.createElement("span",{style:e}):"[object String]"===Object.prototype.toString.call(e)?r.a.createElement("span",{className:e}):void 0},b=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),c(this,s(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(t,r.a.PureComponent),function(e,t,n){t&&u(e.prototype,t),n&&u(e,n)}(t,[{key:"render",value:function(){var e,t=this.props,n=t.index,o=t.inactiveIcon,i=t.activeIcon,a=t.percent,u=t.direction,c=t.readonly,s=t.onClick,p=t.onMouseMove,f=y(o),b=y(i),h=(l(e={display:"inline-block",position:"absolute",overflow:"hidden",top:0},"rtl"===u?"right":"left",0),l(e,"width","".concat(a,"%")),e),d={cursor:c?"inherit":"pointer",display:"inline-block",position:"relative"};function v(e){p&&p(n,e)}function m(e){s&&(e.preventDefault(),s(n,e))}return r.a.createElement("span",{style:d,onClick:m,onMouseMove:v,onTouchMove:v,onTouchEnd:m},f,r.a.createElement("span",{style:h},b))}}]),t}();b.propTypes=!1;var h=b;function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(){return(m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function g(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var j=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?k(e):t}(this,O(t).call(this,e))).state={displayValue:n.props.value,interacting:!1,dirty:!1},n.onMouseEnter=n.onMouseEnter.bind(k(k(n))),n.onMouseLeave=n.onMouseLeave.bind(k(k(n))),n.symbolMouseMove=n.symbolMouseMove.bind(k(k(n))),n.symbolClick=n.symbolClick.bind(k(k(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(t,r.a.PureComponent),function(e,t,n){t&&g(e.prototype,t),n&&g(e,n)}(t,[{key:"componentWillReceiveProps",value:function(e){var t=this.props.value!==e.value;this.setState(function(n){return{dirty:t||n.dirty,displayValue:t?e.value:n.displayValue}})}},{key:"componentDidUpdate",value:function(e,t){t.displayValue!==this.state.displayValue&&this.state.interacting&&this.props.onHover(this.state.displayValue),t.interacting&&!this.state.interacting&&this.props.onHover()}},{key:"symbolClick",value:function(e,t){var n=this.calculateDisplayValue(e,t);this.props.onClick(n,t)}},{key:"symbolMouseMove",value:function(e,t){var n=this.calculateDisplayValue(e,t);n!==this.state.displayValue&&this.setState({displayValue:n})}},{key:"onMouseEnter",value:function(){this.setState({interacting:!this.props.readonly})}},{key:"onMouseLeave",value:function(){this.setState({displayValue:this.props.value,interacting:!1})}},{key:"calculateDisplayValue",value:function(e,t){var n=this.calculateHoverPercentage(t),o=Math.ceil(n%1*this.props.fractions)/this.props.fractions,r=Math.pow(10,3),i=e+(Math.floor(n)+Math.floor(o*r)/r);return i>0?i>this.props.totalSymbols?this.props.totalSymbols:i:1/this.props.fractions}},{key:"calculateHoverPercentage",value:function(e){var t=e.nativeEvent.type.indexOf("touch")>-1?e.nativeEvent.type.indexOf("touchend")>-1?e.changedTouches[0].clientX:e.touches[0].clientX:e.clientX,n=e.target.getBoundingClientRect(),o="rtl"===this.props.direction?n.right-t:t-n.left;return o<0?0:o/n.width}},{key:"render",value:function(){var e,t=this.props,n=t.readonly,o=t.quiet,i=t.totalSymbols,a=t.value,l=t.placeholderValue,u=t.direction,c=t.emptySymbol,s=t.fullSymbol,p=t.placeholderSymbol,f=t.className,y=t.id,b=t.style,d=t.tabIndex,g=this.state,O=g.displayValue,S=g.interacting,k=[],j=[].concat(c),w=[].concat(s),_=[].concat(p),P=0!==l&&0===a&&!S;e=P?l:o?a:O;for(var M=Math.floor(e),T=0;T<i;T++){var E=void 0;E=T-M<0?100:T-M==0?100*(e-T):0,k.push(r.a.createElement(h,m({key:T,index:T,readonly:n,inactiveIcon:j[T%j.length],activeIcon:P?_[T%w.length]:w[T%w.length],percent:E,direction:u},!n&&{onClick:this.symbolClick,onMouseMove:this.symbolMouseMove,onTouchMove:this.symbolMouseMove,onTouchEnd:this.symbolClick})))}return r.a.createElement("span",m({id:y,style:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){v(e,t,n[t])})}return e}({},b,{display:"inline-block",direction:u}),className:f,tabIndex:d,"aria-label":this.props["aria-label"]},!n&&{onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave}),k)}}]),t}();j.propTypes=!1;var w=j;function _(){}_._name="react_rating_noop";var P=_;function M(e){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function T(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function V(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var C=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==M(t)&&"function"!=typeof t?V(e):t}(this,E(t).call(this,e))).state={value:e.initialRating},n.handleClick=n.handleClick.bind(V(V(n))),n.handleHover=n.handleHover.bind(V(V(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}(t,r.a.PureComponent),function(e,t,n){t&&T(e.prototype,t),n&&T(e,n)}(t,[{key:"componentWillReceiveProps",value:function(e){this.setState({value:e.initialRating})}},{key:"handleClick",value:function(e,t){var n=this,o=this.translateDisplayValueToValue(e);this.state.value!==o&&this.setState({value:o},function(){return n.props.onChange(n.state.value)})}},{key:"handleHover",value:function(e){var t=void 0===e?e:this.translateDisplayValueToValue(e);this.props.onHover(t)}},{key:"translateDisplayValueToValue",value:function(e){var t=e*this.props.step+this.props.start;return t===this.props.start?t+1/this.props.fractions:t}},{key:"tranlateValueToDisplayValue",value:function(e){return void 0===e?0:(e-this.props.start)/this.props.step}},{key:"render",value:function(){var e=this.props,t=e.step,n=e.emptySymbol,o=e.fullSymbol,i=e.placeholderSymbol,a=e.readonly,l=e.quiet,u=e.fractions,c=e.direction,s=e.start,p=e.stop,f=e.id,y=e.className,b=e.style,h=e.tabIndex;return r.a.createElement(w,{id:f,style:b,className:y,tabIndex:h,"aria-label":this.props["aria-label"],totalSymbols:function(e,t,n){return Math.floor((t-e)/n)}(s,p,t),value:this.tranlateValueToDisplayValue(this.state.value),placeholderValue:this.tranlateValueToDisplayValue(this.props.placeholderRating),readonly:a,quiet:l,fractions:u,direction:c,emptySymbol:n,fullSymbol:o,placeholderSymbol:i,onClick:this.handleClick,onHover:this.handleHover})}}]),t}();C.defaultProps={start:0,stop:5,step:1,readonly:!1,quiet:!1,fractions:1,direction:"ltr",onChange:P,onHover:P,emptySymbol:a.a.empty,fullSymbol:a.a.full,placeholderSymbol:a.a.placeholder},C.propTypes=!1;t.default=C}])});
//# sourceMappingURL=react-rating.min.js.map
{
"name": "react-rating",
"version": "1.3.0",
"version": "1.3.1",
"description": "A rating react component with custom symbols",

@@ -15,3 +15,3 @@ "main": "lib/react-rating.js",

"scripts": {
"test": "mocha --compilers js:babel/register --recursive",
"test": "mocha --compilers js:@babel/register --recursive",
"lint": "eslint src --ext .js,.jsx",

@@ -46,16 +46,17 @@ "dev": "webpack-dev-server --progress --colors --host 0.0.0.0 --port 8080",

"devDependencies": {
"babel": "^5.8.20",
"babel-core": "^5.7.4",
"babel-eslint": "^7.2.2",
"babel-loader": "^5.3.2",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"@babel/standalone": "^7.0.0",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.2",
"bootstrap": "^3.3.5",
"chai": "^3.2.0",
"create-react-class": "^15.5.1",
"cross-env": "^3.2.4",
"eslint": "^4.7.2",
"eslint-loader": "^1.7.1",
"eslint-plugin-react": "^7.4.0",
"chai": "^4.1.2",
"cross-env": "^5.2.0",
"eslint": "^5.5.0",
"eslint-loader": "^2.1.0",
"eslint-plugin-react": "^7.11.1",
"font-awesome": "^4.3.0",
"mocha": "^2.2.5",
"node-libs-browser": "^0.5.2",
"mocha": "^5.2.0",
"prismjs": "^1.6.0",

@@ -65,5 +66,6 @@ "prop-types": "^15.6.0",

"react-dom": "^16.0.0",
"react-test-renderer": "^16.2.0",
"webpack": "^1.10.1",
"webpack-dev-server": "^1.10.1"
"react-test-renderer": "^16.4.2",
"webpack": "^4.17.1",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.7"
},

@@ -70,0 +72,0 @@ "dependencies": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc