cf-component-checkbox
Advanced tools
Comparing version 1.0.0 to 1.0.1
'use strict'; | ||
exports.__esModule = true; | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -17,3 +9,6 @@ | ||
var Checkbox = (function (_React$Component) { | ||
var React = require('react'); | ||
var PropTypes = React.PropTypes; | ||
var Checkbox = function (_React$Component) { | ||
_inherits(Checkbox, _React$Component); | ||
@@ -42,6 +37,6 @@ | ||
return _react2.default.createElement( | ||
return React.createElement( | ||
'label', | ||
{ htmlFor: this.props.name, className: className }, | ||
_react2.default.createElement('input', { type: 'checkbox', | ||
React.createElement('input', { type: 'checkbox', | ||
className: 'cf-checkbox__input', | ||
@@ -53,3 +48,3 @@ id: this.props.name, | ||
onChange: this.handleChange }), | ||
this.props.label && _react2.default.createElement( | ||
this.props.label && React.createElement( | ||
'span', | ||
@@ -63,11 +58,12 @@ { className: 'cf-checkbox__label' }, | ||
return Checkbox; | ||
})(_react2.default.Component); | ||
}(React.Component); | ||
Checkbox.propTypes = { | ||
label: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.oneOf([false])]).isRequired, | ||
name: _react.PropTypes.string.isRequired, | ||
value: _react.PropTypes.string.isRequired, | ||
checked: _react.PropTypes.bool.isRequired, | ||
onChange: _react.PropTypes.func.isRequired | ||
label: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([false])]).isRequired, | ||
name: PropTypes.string.isRequired, | ||
value: PropTypes.string.isRequired, | ||
checked: PropTypes.bool.isRequired, | ||
onChange: PropTypes.func.isRequired | ||
}; | ||
exports.default = Checkbox; | ||
module.exports = Checkbox; |
'use strict'; | ||
exports.__esModule = true; | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _Checkbox = require('./Checkbox'); | ||
var _Checkbox2 = _interopRequireDefault(_Checkbox); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -21,7 +9,9 @@ | ||
function contains(array, item) { | ||
return array.indexOf(item) > -1; | ||
} | ||
var React = require('react'); | ||
var PropTypes = React.PropTypes; | ||
var CheckboxGroup = (function (_React$Component) { | ||
var Checkbox = require('./Checkbox'); | ||
var includes = require('lodash/includes'); | ||
var CheckboxGroup = function (_React$Component) { | ||
_inherits(CheckboxGroup, _React$Component); | ||
@@ -42,5 +32,5 @@ | ||
return checked; | ||
} else { | ||
return contains(_this.props.values, option.value); | ||
} | ||
return includes(_this.props.values, option.value); | ||
}).map(function (option) { | ||
@@ -57,7 +47,7 @@ return option.value; | ||
return _react2.default.createElement( | ||
return React.createElement( | ||
'div', | ||
{ className: 'cf-checkbox__group' }, | ||
this.props.options.map(function (option) { | ||
return _react2.default.createElement(_Checkbox2.default, { | ||
return React.createElement(Checkbox, { | ||
key: option.name, | ||
@@ -67,3 +57,3 @@ label: option.label, | ||
value: option.value, | ||
checked: contains(_this2.props.values, option.value), | ||
checked: includes(_this2.props.values, option.value), | ||
onChange: function onChange(val) { | ||
@@ -77,13 +67,14 @@ return _this2.handleChange(option.value, val); | ||
return CheckboxGroup; | ||
})(_react2.default.Component); | ||
}(React.Component); | ||
CheckboxGroup.propTypes = { | ||
values: _react.PropTypes.arrayOf(_react.PropTypes.string).isRequired, | ||
onChange: _react.PropTypes.func.isRequired, | ||
options: _react.PropTypes.arrayOf(_react.PropTypes.shape({ | ||
label: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.oneOf([false])]).isRequired, | ||
name: _react.PropTypes.string.isRequired, | ||
value: _react.PropTypes.string.isRequired | ||
values: PropTypes.arrayOf(PropTypes.string).isRequired, | ||
onChange: PropTypes.func.isRequired, | ||
options: PropTypes.arrayOf(PropTypes.shape({ | ||
label: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([false])]).isRequired, | ||
name: PropTypes.string.isRequired, | ||
value: PropTypes.string.isRequired | ||
})).isRequired | ||
}; | ||
exports.default = CheckboxGroup; | ||
module.exports = CheckboxGroup; |
'use strict'; | ||
exports.__esModule = true; | ||
exports.CheckboxGroup = exports.Checkbox = undefined; | ||
var _Checkbox2 = require('./Checkbox'); | ||
var _Checkbox3 = _interopRequireDefault(_Checkbox2); | ||
var _CheckboxGroup2 = require('./CheckboxGroup'); | ||
var _CheckboxGroup3 = _interopRequireDefault(_CheckboxGroup2); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.Checkbox = _Checkbox3.default; | ||
exports.CheckboxGroup = _CheckboxGroup3.default; | ||
exports.Checkbox = require('./Checkbox'); | ||
exports.CheckboxGroup = require('./CheckboxGroup'); |
{ | ||
"name": "cf-component-checkbox", | ||
"description": "CloudFlare Checkbox Component", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"build": "babel src -d lib", | ||
"example": "browserify example/script.js -o example/bundle.js -t babelify --debug", | ||
"format": "jsfmt -w *.js src/ test/", | ||
"lint": "eslint *.js src/ test/", | ||
"prepublish": "npm run build", | ||
"test": "karma start" | ||
}, | ||
"author": "James Kyle <jkyle@cloudflare.com>", | ||
"license": "BSD-3-Clause", | ||
"dependencies": { | ||
"lodash": "^4.1.0", | ||
"react": "^0.14.2" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.1.1", | ||
"babel-core": "^6.0.20", | ||
"babel-preset-cf": "^1.2.0", | ||
"babelify": "^7.2.0", | ||
"browserify-istanbul": "^0.2.1", | ||
"chai": "^3.4.1", | ||
"defined": "^1.0.0", | ||
"eslint": "^1.8.0", | ||
"jsfmt": "^0.5.2", | ||
"karma": "^0.13.15", | ||
"karma-beep-reporter": "^0.1.4", | ||
"karma-browserify": "^4.4.0", | ||
"karma-chrome-launcher": "^0.2.1", | ||
"karma-coverage": "^0.5.3", | ||
"karma-firefox-launcher": "^0.1.6", | ||
"karma-mocha": "^0.2.0", | ||
"karma-mocha-reporter": "^1.1.1", | ||
"karma-safari-launcher": "^0.1.1", | ||
"karma-sauce-launcher": "^0.3.0", | ||
"karma-tape-reporter": "^1.0.3", | ||
"minimist": "^1.2.0", | ||
"mocha": "^2.3.3", | ||
"react-dom": "^0.14.2" | ||
} | ||
} |
@@ -14,7 +14,7 @@ # cf-component-checkbox | ||
```js | ||
import React from 'react'; | ||
import { | ||
const React = require('react'); | ||
const { | ||
Checkbox, | ||
CheckboxGroup | ||
} from '../src/index'; | ||
} = require('../../src/index'); | ||
@@ -21,0 +21,0 @@ class Application extends React.Component { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
7864
2
6
110
+ Addedlodash@^4.1.0
+ Addedlodash@4.17.21(transitive)