react-stars-rating
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -7,10 +7,14 @@ 'use strict'; | ||
var _templateObject = _taggedTemplateLiteral(['\n background: ', ';\n border: none;\n border-radius: 2px;\n color: ', ';\n cursor: pointer;\n display: inline-block;\n font-size: 16px;\n line-height: 40px;\n font-weight: 200;\n margin: 8px 0;\n outline: none;\n padding: 0 12px;\n text-transform: uppercase;\n transition: all 300ms ease;\n &:hover {\n background: ', ';\n }\n'], ['\n background: ', ';\n border: none;\n border-radius: 2px;\n color: ', ';\n cursor: pointer;\n display: inline-block;\n font-size: 16px;\n line-height: 40px;\n font-weight: 200;\n margin: 8px 0;\n outline: none;\n padding: 0 12px;\n text-transform: uppercase;\n transition: all 300ms ease;\n &:hover {\n background: ', ';\n }\n']); | ||
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 _styledComponents = require('styled-components'); | ||
var _templateObject = _taggedTemplateLiteral(['\n height: 40px;\n width: 20%;\n display: block;\n position: relative;\n cursor: pointer;\n &:after {\n transition: all 0.4s ease-out;\n -webkit-font-smoothing: antialiased;\n position: absolute;\n content: \'\u2605\';\n color: ', ';\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n text-align: center;\n font-size: 14px;\n }\n'], ['\n height: 40px;\n width: 20%;\n display: block;\n position: relative;\n cursor: pointer;\n &:after {\n transition: all 0.4s ease-out;\n -webkit-font-smoothing: antialiased;\n position: absolute;\n content: \'\u2605\';\n color: ', ';\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n text-align: center;\n font-size: 14px;\n }\n']); | ||
var _styledComponents2 = _interopRequireDefault(_styledComponents); | ||
var _react = require('react'); | ||
var _polished = require('polished'); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _colors = require('../styles/colors'); | ||
@@ -20,2 +24,6 @@ | ||
var _styledComponents = require('styled-components'); | ||
var _styledComponents2 = _interopRequireDefault(_styledComponents); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -25,20 +33,88 @@ | ||
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; } | ||
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } | ||
var Star = _styledComponents2.default.button(_templateObject, function (_ref) { | ||
var bgColor = _ref.bgColor; | ||
return colors[bgColor]; | ||
}, function (_ref2) { | ||
var fontColor = _ref2.fontColor; | ||
return colors[fontColor]; | ||
}, function (_ref3) { | ||
var bgColor = _ref3.bgColor; | ||
return (0, _polished.darken)(0.1, colors[bgColor]); | ||
var Label = _styledComponents2.default.label(_templateObject, function (_ref) { | ||
var checked = _ref.checked, | ||
theme = _ref.theme; | ||
return checked ? colors[theme] : '#444444'; | ||
}); | ||
// content: ${({checked}) => checked ? '★' : '☆'}; | ||
var Star = function (_Component) { | ||
_inherits(Star, _Component); | ||
function Star() { | ||
var _ref2; | ||
var _temp, _this, _ret; | ||
_classCallCheck(this, Star); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref2 = Star.__proto__ || Object.getPrototypeOf(Star)).call.apply(_ref2, [this].concat(args))), _this), _this.handleForOnStarClick = function (evt) { | ||
var _this$props = _this.props, | ||
index = _this$props.index, | ||
onClick = _this$props.onClick; | ||
onClick(index + 1); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
_createClass(Star, [{ | ||
key: 'render', | ||
/** | ||
* Render method | ||
* @returns {Object} JSX HTML markup | ||
*/ | ||
value: function render() { | ||
var _props = this.props, | ||
index = _props.index, | ||
checked = _props.checked, | ||
theme = _props.theme; | ||
var styles = { | ||
display: 'inline-block', | ||
width: '14px' | ||
}; | ||
return _react2.default.createElement( | ||
'span', | ||
{ className: 'lm-star', style: styles, onClick: this.handleForOnStarClick }, | ||
_react2.default.createElement(Label, { checked: checked, theme: theme }) | ||
); | ||
} | ||
}]); | ||
return Star; | ||
}(_react.Component); | ||
Star.defaultProps = { | ||
bgColor: 'blue', | ||
fontColor: 'white' | ||
disabled: false, | ||
onClick: function onClick() { | ||
return false; | ||
}, | ||
checked: false | ||
}; | ||
Star.propTypes = { | ||
index: _propTypes2.default.number.isRequired, | ||
disabled: _propTypes2.default.bool, | ||
onClick: _propTypes2.default.func, | ||
checked: _propTypes2.default.bool, | ||
theme: _propTypes2.default.string.isRequired | ||
}; | ||
exports.default = Star; |
'use strict'; | ||
var _Star = require('./elements/Star'); | ||
var _StarsRating = require('./components/StarsRating'); | ||
var _Star2 = _interopRequireDefault(_Star); | ||
var _StarsRating2 = _interopRequireDefault(_StarsRating); | ||
@@ -10,3 +10,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
module.exports = { | ||
Star: _Star2.default | ||
StarsRating: _StarsRating2.default | ||
}; |
{ | ||
"name": "react-stars-rating", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A simple react stars rating component", | ||
@@ -39,2 +39,3 @@ "main": "build/index.js", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-preset-stage-2": "^6.24.1", | ||
"eslint": "^4.12.1", | ||
@@ -45,3 +46,2 @@ "eslint-plugin-import": "^2.8.0", | ||
"eslint-watch": "^3.1.3", | ||
"polished": "^1.9.0", | ||
"prop-types": "^15.6.0", | ||
@@ -48,0 +48,0 @@ "react": "^16.2.0", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
22533
9
310