UNPKG

3.23 kBJavaScriptView Raw
1'use strict';
2
3var _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; }; }();
4
5function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
7function _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; }
8
9function _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; }
10
11var React = require('react');
12var PropTypes = require('prop-types');
13var InfoSprinkle = require('./info-sprinkle');
14
15/**
16 * A checkbox in the create collection dialog.
17 */
18
19var ModalCheckbox = function (_React$Component) {
20 _inherits(ModalCheckbox, _React$Component);
21
22 function ModalCheckbox() {
23 _classCallCheck(this, ModalCheckbox);
24
25 return _possibleConstructorReturn(this, (ModalCheckbox.__proto__ || Object.getPrototypeOf(ModalCheckbox)).apply(this, arguments));
26 }
27
28 _createClass(ModalCheckbox, [{
29 key: 'render',
30
31
32 /**
33 * Render the input.
34 *
35 * @returns {React.Component} The react component.
36 */
37 value: function render() {
38 return React.createElement(
39 'div',
40 null,
41 React.createElement(
42 'label',
43 null,
44 React.createElement('input', {
45 type: 'checkbox',
46 onChange: this.props.onClickHandler,
47 checked: this.props.checked,
48 className: this.props.inputClassName }),
49 React.createElement(
50 'p',
51 { className: this.props.titleClassName },
52 this.props.name
53 )
54 ),
55 React.createElement(InfoSprinkle, {
56 helpLink: this.props.helpUrl,
57 onClickHandler: this.props.onLinkClickHandler })
58 );
59 }
60 }]);
61
62 return ModalCheckbox;
63}(React.Component);
64
65ModalCheckbox.displayName = 'ModalCheckboxComponent';
66
67ModalCheckbox.propTypes = {
68 onClickHandler: PropTypes.func.isRequired,
69 onLinkClickHandler: PropTypes.func.isRequired,
70 checked: PropTypes.bool,
71 helpUrl: PropTypes.string,
72 titleClassName: PropTypes.string,
73 inputClassName: PropTypes.string,
74 name: PropTypes.string.isRequired
75};
76
77module.exports = ModalCheckbox;
\No newline at end of file