Skip to content

Commit 49520f1

Browse files
author
vvo
committed
fix: react-nouislider will live in our repo for now
I dunno how to author ES6 modules and provide them to our clients. It seems that https://github.com/bloodyowl/stile/blob/68b8350f4134ae2182a60c9f55442be92b4ce26e/scripts/build.js and https://github.com/bloodyowl/stile/blob/68b8350f4134ae2182a60c9f55442be92b4ce26e/webpack.config.js is one solution
1 parent 229bb02 commit 49520f1

File tree

10 files changed

+166
-3
lines changed

10 files changed

+166
-3
lines changed

components/Slider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var React = require('react');
22

3-
var Nouislider = require('react-nouislider');
3+
var Nouislider = require('./react-nouislider/');
44

55
class Slider extends React.Component {
66

components/react-nouislider/.eslintrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"airbnb",
5+
"algolia/es6"
6+
]
7+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: node_js
2+
node_js:
3+
- stable
4+
before_install: npm prune
5+
install: npm install
6+
script: npm test
7+
branches:
8+
only:
9+
- master
10+
- develop
11+
# force container based infra
12+
# http://docs.travis-ci.com/user/workers/container-based-infrastructure/#Routing-your-build-to-container-based-infrastructure
13+
sudo: false
14+
cache:
15+
directories:
16+
- node_modules
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# 1.0.1 (2015-09-12)
2+
3+
* do not use JSX inside the reusable components, only React.DOM
4+
5+
# 1.0.0 (2015-09-12)
6+
7+
* initial
8+

components/react-nouislider/LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Algolia
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

components/react-nouislider/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# react-nouislider
2+
3+
Wraps [leongersen/noUiSlider](https://github.com/leongersen/noUiSlider) in a [react component](https://facebook.github.io/react/docs/component-api.html).
4+
5+
Currently using [Algolia's fork](https://github.com/algolia/noUiSlider/tree/algolia-fork) of noUiSlider to allow setting ranges dynamically and other fixes to be merged in upstream project.

components/react-nouislider/index.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
var React = require('react');
2+
3+
var nouislider = require('nouislider');
4+
5+
class Nouislider extends React.Component {
6+
componentDidMount() {
7+
var slider = this.slider = nouislider.create(React.findDOMNode(this), this.props);
8+
9+
if (this.props.onSlide) {
10+
slider.on('slide', this.props.onSlide);
11+
}
12+
13+
if (this.props.onChange) {
14+
slider.on('change', this.props.onChange);
15+
}
16+
}
17+
18+
componentWillReceiveProps(props) {
19+
this.slider.updateOptions(props);
20+
this.slider.set(props.start);
21+
}
22+
23+
componentWillUnmount() {
24+
this.slider.destroy();
25+
}
26+
27+
render() {
28+
return React.DOM.div();
29+
}
30+
}
31+
32+
Nouislider.propTypes = {
33+
// http://refreshless.com/nouislider/slider-options/#section-animate
34+
animate: React.PropTypes.bool,
35+
// http://refreshless.com/nouislider/slider-options/#section-Connect
36+
connect: React.PropTypes.oneOfType([
37+
React.PropTypes.oneOf(['lower', 'upper']),
38+
React.PropTypes.bool
39+
]),
40+
// http://refreshless.com/nouislider/slider-options/#section-orientation
41+
direction: React.PropTypes.oneOf(['ltr', 'rtl']),
42+
// http://refreshless.com/nouislider/slider-options/#section-limit
43+
limit: React.PropTypes.number,
44+
// http://refreshless.com/nouislider/slider-options/#section-margin
45+
margin: React.PropTypes.number,
46+
// http://refreshless.com/nouislider/slider-options/#section-orientation
47+
orientation: React.PropTypes.oneOf(['horizontal', 'vertical']),
48+
// http://refreshless.com/nouislider/slider-values/#section-range
49+
range: React.PropTypes.object.isRequired,
50+
// http://refreshless.com/nouislider/slider-options/#section-start
51+
start: React.PropTypes.arrayOf(React.PropTypes.number).isRequired,
52+
// http://refreshless.com/nouislider/slider-options/#section-step
53+
step: React.PropTypes.number,
54+
// http://refreshless.com/nouislider/events-callbacks/#section-slide
55+
onSlide: React.PropTypes.func,
56+
// http://refreshless.com/nouislider/events-callbacks/#section-change
57+
onChange: React.PropTypes.func
58+
};
59+
60+
module.exports = Nouislider;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "react-nouislider",
3+
"version": "1.0.1",
4+
"description": "React component wrapping leongersen/noUiSlider",
5+
"main": "index.js",
6+
"scripts": {
7+
"lint": "./scripts/lint.sh",
8+
"test": "npm run lint"
9+
},
10+
"repository": "algolia/intantsearch.js",
11+
"keywords": [
12+
"react",
13+
"nouislider",
14+
"slider",
15+
"component",
16+
"reactjs",
17+
"range",
18+
"slider"
19+
],
20+
"author": "Algolia <[email protected]>",
21+
"license": "MIT",
22+
"bugs": {
23+
"url": "https://github.com/algolia/instansearch.js/issues"
24+
},
25+
"peerDependencies": {
26+
"react": "0.13.x",
27+
"nouislider": "git://github.com/algolia/noUiSlider.git#744f9166cf109de91de516e4af6fe3a6e4e95a7f"
28+
},
29+
"homepage": "https://github.com/algolia/instansearch.js/tree/develop/components/react-nouislider#readme",
30+
"devDependencies": {
31+
"babel-eslint": "4.1.1",
32+
"eslint": "1.4.1",
33+
"eslint-config-airbnb": "0.0.8",
34+
"eslint-config-algolia": "3.0.0",
35+
"eslint-plugin-react": "3.3.2"
36+
}
37+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
set -e # exit when error
4+
5+
printf "\nLint\n"
6+
7+
eslint . --quiet

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"browser": {
2222
"lodash": "lodash-compat"
2323
},
24+
"repository": "algolia/intantsearch.js",
2425
"devDependencies": {
2526
"babel": "5.8.23",
2627
"babel-eslint": "4.1.1",
@@ -47,13 +48,13 @@
4748
},
4849
"dependencies": {
4950
"algoliasearch": "3.7.8",
50-
"algoliasearch-helper": "2.3.0",
51+
"algoliasearch-helper": "2.3.5",
5152
"classnames": "2.1.3",
5253
"hogan.js": "3.0.2",
5354
"lodash": "3.10.1",
55+
"nouislider": "git://github.com/algolia/noUiSlider.git#744f9166cf109de91de516e4af6fe3a6e4e95a7f",
5456
"raw-loader": "0.5.1",
5557
"react": "0.13.3",
56-
"react-nouislider": "1.0.0",
5758
"to-factory": "1.0.0"
5859
},
5960
"license": "MIT"

0 commit comments

Comments
 (0)