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

react-rating-tooltip

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-rating-tooltip - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

lib/Rating.js

@@ -1,2 +0,2 @@

module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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="",n(n.s=2)}([function(e,t,n){"use strict";e.exports=n(3)},function(e,t,n){var r=n(8);"string"==typeof r&&(r=[[e.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(10)(r,o);r.locals&&(e.exports=r.locals)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=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}}(),o=n(0),i=l(o);n(1);var a=l(n(12)),u=l(n(13));function l(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setSelected=function(e){var t=n.props,r=t.clearRating,o=t.ratingValue,i=t.onChange,a=n.state.current;r&&a===e+1?(n.setState({current:0,hover:-1}),i(0,"-")):(n.setState({current:e+1}),i(e+1,o?o[e]:""))},n.onHover=function(e){n.setState({hover:e+1})},n.onMouseLeave=function(){n.setState({hover:-1})},n.state={current:n.props.defaultRating,hover:-1},n}return function(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)}(t,o.Component),r(t,[{key:"render",value:function(){for(var e=this.props,t=e.max,n=e.counterPosition,r=e.textPosition,o=e.tooltipContent,u=e.ratingValue,l=e.styleConfig,s=this.state,c=s.current,f=s.hover,p=new Array(t),d=f>=0?f:c,y=0;y<p.length;y++)p[y]=i.default.createElement(a.default,{tooltipStyle:l&&l.tooltipStyle?l.tooltipStyle:{},tpText:o&&o[y]?o[y]:null,selected:y<d,key:y,onMouseLeave:this.onMouseLeave,onHover:this.onHover,index:y,selectStar:this.setSelected,InActiveComponent:this.props.InActiveComponent,ActiveComponent:this.props.ActiveComponent});return n&&("left"===n?p.unshift(i.default.createElement("div",{key:p.length+1,style:l&&l.counterStyle?l.counterStyle:{}},c)):p.push(i.default.createElement("div",{key:p.length+1,style:l&&l.counterStyle?l.counterStyle:{}},c))),r&&("left"===r?p.unshift(i.default.createElement("div",{key:p.length+1,style:l&&l.statusStyle?l.statusStyle:{}},u&&u[c-1]?u[c-1]:"-")):p.push(i.default.createElement("div",{key:p.length+1,style:l&&l.statusStyle?l.statusStyle:{}},u&&u[c-1]?u[c-1]:"-"))),i.default.createElement("div",null,i.default.createElement("div",{className:"container"},i.default.createElement("div",{className:"rating-container",style:l&&l.starContainer?l.starContainer:{}},p)))}}]),t}();s.propTypes={max:u.default.number.isRequired,defaultRating:u.default.number,counterPosition:u.default.oneOf(["left","right"]),clearRating:u.default.bool,textPosition:u.default.oneOf(["left","right"]),tooltipContent:u.default.array,ratingValue:u.default.array,styleConfig:u.default.shape({counterStyle:u.default.object,starContainer:u.default.object,statusStyle:u.default.object,tooltipStyle:u.default.object}),onChange:u.default.func.isRequired,ActiveComponent:u.default.oneOfType([u.default.node,u.default.element]).isRequired,InActiveComponent:u.default.oneOfType([u.default.node,u.default.element]).isRequired},s.defaultProps={clearRating:!0,defaultRating:0,styleConfig:{counterStyle:{height:"28px",backgroundColor:"#F58220",paddingLeft:"12px",paddingRight:"12px",color:"#FFF",lineHeight:"28px"},starContainer:{fontSize:"24px",backgroundColor:"#F2F2F2",height:"28px"},statusStyle:{height:"28px",backgroundColor:"#F58220",paddingLeft:"12px",paddingRight:"12px",color:"#FFF",lineHeight:"28px",minWidth:"100px",fontSize:"18px",textAlign:"center"},tooltipStyle:{fontSize:"14px",padding:"5px"}}},t.default=s},function(e,t,n){"use strict";
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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="",n(n.s=2)}([function(e,t,n){"use strict";e.exports=n(3)},function(e,t,n){var r=n(8);"string"==typeof r&&(r=[[e.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(10)(r,o);r.locals&&(e.exports=r.locals)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=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}}(),o=n(0),i=l(o);n(1);var a=l(n(12)),u=l(n(13));function l(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setSelected=function(e){var t=n.props,r=t.clearRating,o=t.ratingValue,i=t.onChange,a=n.state.current;r&&a===e+1?(n.setState({current:0,hover:-1}),i(0,"-")):(n.setState({current:e+1}),i(e+1,o?o[e]:""))},n.onHover=function(e){n.setState({hover:e+1})},n.onMouseLeave=function(){n.setState({hover:-1})},n.state={current:n.props.defaultRating,hover:-1},n}return function(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)}(t,o.Component),r(t,[{key:"render",value:function(){for(var e=this.props,t=e.max,n=e.counterPosition,r=e.textPosition,o=e.tooltipContent,u=e.ratingValue,l=e.styleConfig,s=e.disabled,c=this.state,f=c.current,p=c.hover,d=new Array(t),y=p>=0?p:f,h=0;h<d.length;h++)d[h]=i.default.createElement(a.default,{tooltipStyle:l&&l.tooltipStyle?l.tooltipStyle:{},tpText:o&&o[h]?o[h]:null,selected:h<y,key:h,onMouseLeave:s?function(){}:this.onMouseLeave,onHover:s?function(){}:this.onHover,index:h,selectStar:s?function(){}:this.setSelected,InActiveComponent:this.props.InActiveComponent,ActiveComponent:this.props.ActiveComponent});return n&&("left"===n?d.unshift(i.default.createElement("div",{key:d.length+1,style:l&&l.counterStyle?l.counterStyle:{}},f)):d.push(i.default.createElement("div",{key:d.length+1,style:l&&l.counterStyle?l.counterStyle:{}},f))),r&&("left"===r?d.unshift(i.default.createElement("div",{key:d.length+1,style:l&&l.statusStyle?l.statusStyle:{}},u&&u[f-1]?u[f-1]:"-")):d.push(i.default.createElement("div",{key:d.length+1,style:l&&l.statusStyle?l.statusStyle:{}},u&&u[f-1]?u[f-1]:"-"))),i.default.createElement("div",null,i.default.createElement("div",{className:"container"},i.default.createElement("div",{className:"rating-container",style:l&&l.starContainer?l.starContainer:{}},d)))}}]),t}();s.propTypes={max:u.default.number.isRequired,defaultRating:u.default.number,counterPosition:u.default.oneOf(["left","right"]),clearRating:u.default.bool,disabled:u.default.bool,textPosition:u.default.oneOf(["left","right"]),tooltipContent:u.default.array,ratingValue:u.default.array,styleConfig:u.default.shape({counterStyle:u.default.object,starContainer:u.default.object,statusStyle:u.default.object,tooltipStyle:u.default.object}),onChange:u.default.func.isRequired,ActiveComponent:u.default.oneOfType([u.default.node,u.default.element]).isRequired,InActiveComponent:u.default.oneOfType([u.default.node,u.default.element]).isRequired},s.defaultProps={clearRating:!0,disabled:!1,defaultRating:0,styleConfig:{counterStyle:{height:"28px",backgroundColor:"#F58220",paddingLeft:"12px",paddingRight:"12px",color:"#FFF",lineHeight:"28px"},starContainer:{fontSize:"24px",backgroundColor:"#F2F2F2",height:"28px"},statusStyle:{height:"28px",backgroundColor:"#F58220",paddingLeft:"12px",paddingRight:"12px",color:"#FFF",lineHeight:"28px",minWidth:"100px",fontSize:"18px",textAlign:"center"},tooltipStyle:{fontSize:"14px",padding:"5px"}}},t.default=s},function(e,t,n){"use strict";
/** @license React v16.4.2

@@ -3,0 +3,0 @@ * react.production.min.js

{
"name": "react-rating-tooltip",
"version": "1.1.0",
"version": "1.1.1",
"description": "React Star Rating/Review Component with tooltip support",

@@ -5,0 +5,0 @@ "main": "./lib/Rating.js",

@@ -122,2 +122,3 @@ # React-Rating-Tooltip

| clearRating | Boolean | `Default Value - true`. This determines whether the rating can be cleared/reset. If passed true, clicking again on the same rating count will clear the rating. |
| disabled | Boolean | `Default Value - false`. This determines whether the rating can be enabled/disabled. If passed true, the rating component will be disabled and act as Read only component |
| tooltipContent | Array | The Array of values as tooltip. Tooltips Values are matched to Rating count based on index. If not passed, tooltip will not be added |

@@ -124,0 +125,0 @@ | ratingValue | Array | The Array of values for Rating count. Rating Values are matched to Rating count based on index. If not passed, Values will not be set |

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