Socket
Book a DemoInstallSign in
Socket

react-controlfacades

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-controlfacades - npm Package Compare versions

Comparing version

to
0.3.0

lib/CFSelect.js

22

lib/ControlFacadeMixin.js

@@ -27,3 +27,3 @@ var ControlFacadeMixin, PropTypes, React, div, input, merge, span, _ref;

_render: function() {
var wrapperProps, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6;
var value, wrapperProps, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6;
wrapperProps = merge(this._getWrapperProps(), {

@@ -35,8 +35,22 @@ style: merge(this.props.style, {

});
value = (_ref1 = (_ref2 = this.props.value) != null ? _ref2 : this.state.value) != null ? _ref1 : this.props.defaultValue;
return this.props.wrapper(wrapperProps, this.props.facade({
checked: (_ref1 = (_ref2 = this.props.checked) != null ? _ref2 : this.state.checked) != null ? _ref1 : this.props.defaultChecked,
selected: (_ref3 = (_ref4 = this.props.selected) != null ? _ref4 : this.state.selected) != null ? _ref3 : this.props.defaultSelected,
value: (_ref5 = (_ref6 = this.props.value) != null ? _ref6 : this.state.value) != null ? _ref5 : this.props.defaultValue
checked: (_ref3 = (_ref4 = this.props.checked) != null ? _ref4 : this.state.checked) != null ? _ref3 : this.props.defaultChecked,
selected: (_ref5 = (_ref6 = this.props.selected) != null ? _ref6 : this.state.selected) != null ? _ref5 : this.props.defaultSelected,
value: value,
label: this.getLabel(value)
}), this.props.control(this._getControlProps(), this.props.children));
},
getLabel: function(value) {
var child, _i, _len, _ref1, _ref2;
if (this.props.children) {
_ref1 = this.props.children;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
child = _ref1[_i];
if (child.props.value === value) {
return (_ref2 = child.props.children) != null ? _ref2.toString() : void 0;
}
}
}
},
_getWrapperProps: function() {

@@ -43,0 +57,0 @@ var props;

7

lib/index.js

@@ -1,7 +0,10 @@

var CFCheckbox;
var CFCheckbox, CFSelect;
CFCheckbox = require('./CFCheckbox');
CFSelect = require('./CFSelect');
module.exports = {
CFCheckbox: CFCheckbox
CFCheckbox: CFCheckbox,
CFSelect: CFSelect
};
{
"name": "react-controlfacades",
"version": "0.2.0",
"version": "0.3.0",
"description": "Style form controls but use their default behavior",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -40,7 +40,7 @@ react-controlfacades

border: '2px solid black',
backgroundColor: props.isChecked ? 'black': 'white'
backgroundColor: props.checked ? 'black': 'white'
};
return (
<div style={ style } />
<div style={ style } />
);

@@ -51,3 +51,23 @@ }

The facade will recieve the following props:
<table>
<tr>
<td><code>checked</code></td>
<td>For checkboxes, indicates whether the box is checked or not.</td>
</tr>
<tr>
<td><code>value</code></td>
<td>The value of the control.</td>
</tr>
<tr>
<td><code>label</code></td>
<td>
For select boxes, the option string that corresponds to the selected
value.
</td>
</tr>
</table>
[jquery.icbiacontrol]: https://github.com/matthewwithanm/jquery-icbiacontrol
SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.