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

react-star-rating-input

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-star-rating-input - npm Package Compare versions

Comparing version 5.0.0 to 6.0.0

src/intlMessages.js

13

demo.js

@@ -5,2 +5,3 @@ (function () {

var React = require('react'),
IntlMixin = require('react-intl').IntlMixin,
insertCss = require('insert-css'),

@@ -10,2 +11,4 @@ StarRatingInput = require('./index'),

Container = React.createClass({
mixins: [IntlMixin],
render: function () {

@@ -25,3 +28,11 @@ return React.createElement(StarRatingInput.Klass, {

insertCss(StarRatingInput.css);
React.render(React.createElement(Container), global.document.body);
React.render(
React.createElement(
Container,
{messages: StarRatingInput.intlMessages().en}
),
global.document.body
);
}());

4

index.js

@@ -5,6 +5,8 @@ (function () {

var StarRatingInput = require('./src/StarRatingInput'),
css = require('./src/css');
css = require('./src/css'),
intlMessages = require('./src/intlMessages');
exports.Klass = StarRatingInput;
exports.css = css;
exports.intlMessages = intlMessages;
}());
{
"name": "react-star-rating-input",
"version": "5.0.0",
"version": "6.0.0",
"description": "React.js component for entering 0-5 stars",

@@ -9,3 +9,4 @@ "main": "index.js",

"test": "mocha --require ./test-hook -b tests/*.spec.js",
"build": "browserify demo.js | uglifyjs > www/bundle.js"
"build": "browserify demo.js | uglifyjs > www/bundle.js",
"tdd": "mocha --require ./test-hook -b -R min -w tests/*.spec.js"
},

@@ -45,13 +46,12 @@ "browserify": {

"devDependencies": {
"brfs": "^1.2.0",
"browserify": "^6.3.2",
"brfs": "^1.4.0",
"browserify": "^9.0.8",
"insert-css": "^0.2.0",
"intl": "^0.1.4",
"jsdom": "^1.2.1",
"jsdom-test-browser": "^2.0.0",
"jshint": "^2.5.5",
"jsdom-test-browser": "^2.1.0",
"jshint": "^2.7.0",
"mocha": "^2.2.4",
"sinon": "^1.10.3",
"uglify-js": "^2.4.15"
"sinon": "^1.14.1",
"uglify-js": "^2.4.20"
}
}

@@ -37,6 +37,18 @@ [![Build Status](https://travis-ci.org/ikr/react-star-rating-input.svg?branch=master)](https://travis-ci.org/ikr/react-star-rating-input)

```js
{clear: Your own text for "Clear"'}
{
'react-star-rating-input': {
clear: 'Clear',
clearHint: 'Reset value to no stars'
}
}
```
This component depends on global `Intl` object. You can polyfill it with
Why have a `react-intl` dependency instead of just setting the `clear` and `clearHint` text as
props?
Well, that allows using `react-star-rating-input` uniformly in bigger applications, and passing all
the namespaced translations, from the root, down the React components hierarchy, -- automatically,
with the help of `IntlMixin`.
Please note, that `react-intl` depends on global `Intl` object. You can polyfill it with
[intl](https://github.com/andyearnshaw/Intl.js) package:

@@ -49,7 +61,1 @@

```
Why have a `react-intl` dependency instead of just setting the `clear` text as a prop?
Well, that allows using `react-star-rating-input` uniformly in bigger applications, and passing all
the namespaced translations, from the root, down the React components hierarchy, -- automatically,
with the help of `IntlMixin`.

@@ -21,6 +21,3 @@ (function () {

size: 5,
showClear: true,
messages: {
clear: 'Clear'
}
showClear: true
};

@@ -46,3 +43,3 @@ },

className: 'star-rating-clear',
title: 'Reset value to no stars',
title: this.getIntlMessage('react-star-rating-input.clearHint'),
href: '',

@@ -57,3 +54,5 @@ ref: 's0',

}.bind(this)
}, React.createElement(FormattedMessage, {message: this.getIntlMessage('clear')}))
}, React.createElement(FormattedMessage, {
message: this.getIntlMessage('react-star-rating-input.clear')
}))
);

@@ -60,0 +59,0 @@ },

@@ -6,3 +6,4 @@ describe('package index', function () {

bro = require('jsdom-test-browser'),
api = require('../index.js');
api = require('../index'),
intlMessages = require('../src/intlMessages');

@@ -19,2 +20,6 @@ assert(bro);

});
it('exports the intlMessages', function () {
assert.strictEqual(api.intlMessages, intlMessages);
});
});

@@ -10,5 +10,7 @@ describe('StarRatingInput', function () {

StarRatingInput = require('../src/StarRatingInput'),
intlMessages = require('../src/intlMessages'),
props = function (value, size, showClear, onChange) {
return {
messages: intlMessages().en,
value: value,

@@ -92,3 +94,3 @@ size: size || 5,

component = TestUtils.renderIntoDocument(
React.createElement(StarRatingInput, {onChange: function () {}})
React.createElement(StarRatingInput, props())
);

@@ -159,3 +161,6 @@ });

properties.messages = {
clear: 'Очистить'
'react-star-rating-input': {
clear: 'Очистить',
clearHint: 'Сбросить'
}
};

@@ -168,6 +173,10 @@

it('has the translatable link', function () {
it('includes link text', function () {
assert.strictEqual(bro.$('a.star-rating-clear', element()).text(), 'Очистить');
});
it('includes link title', function () {
assert.strictEqual(bro.$('a.star-rating-clear', element()).attr('title'), 'Сбросить');
});
});
});
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