Skip to content

Commit 01f85cf

Browse files
committed
0.13.0
1 parent 530e2bf commit 01f85cf

File tree

3 files changed

+128
-23
lines changed

3 files changed

+128
-23
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frigging-bootstrap",
3-
"version": "0.12.0",
3+
"version": "0.13.0",
44
"homepage": "https://github.com/frig-js/frigging-bootstrap",
55
"authors": [
66
"D1plo1d <[email protected]>"

dist/frigging-bootstrap.js

Lines changed: 126 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,7 @@ return /******/ (function(modules) { // webpackBootstrap
549549
value: function _inputHtml() {
550550
return Object.assign({}, this.props.inputHtml, {
551551
type: 'checkbox',
552-
value: this.props.key,
553-
checked: this.props.value,
552+
value: this.props.value,
554553
onChange: this.props.onChange
555554
});
556555
}
@@ -1331,12 +1330,13 @@ return /******/ (function(modules) { // webpackBootstrap
13311330
return Label;
13321331
}(_react2.default.Component), _class.displayName = 'FriggingBootstrap.Label', _class.propTypes = {
13331332
labelWidth: _react2.default.PropTypes.object.isRequired,
1334-
layout: _react2.default.PropTypes.string.isRequired,
1333+
layout: _react2.default.PropTypes.string,
13351334
block: _react2.default.PropTypes.bool,
13361335
label: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.element, _react2.default.PropTypes.bool])
13371336
}, _class.defaultProps = {
13381337
block: false,
1339-
label: ''
1338+
label: '',
1339+
layout: 'vertical'
13401340
}, _temp);
13411341
exports.default = Label;
13421342

@@ -1425,7 +1425,6 @@ return /******/ (function(modules) { // webpackBootstrap
14251425
{
14261426
className: (0, _classnames2.default)({
14271427
'frigb-map': true,
1428-
'frigb-active': this.props.active,
14291428
'frigb-dark': luminosity <= 128,
14301429
'frigb-light': luminosity > 128
14311430
}),
@@ -1462,8 +1461,7 @@ return /******/ (function(modules) { // webpackBootstrap
14621461
requestChange: _react2.default.PropTypes.func.isRequired
14631462
}).isRequired,
14641463

1465-
active: _react2.default.PropTypes.bool.isRequired,
1466-
startDragging: _react2.default.PropTypes.bool.isRequired,
1464+
startDragging: _react2.default.PropTypes.func.isRequired,
14671465
getPercentageValue: _react2.default.PropTypes.func.isRequired
14681466
}, _temp)) || _class);
14691467
exports.default = ColorMap;
@@ -1694,7 +1692,7 @@ return /******/ (function(modules) { // webpackBootstrap
16941692
h: _react2.default.PropTypes.number.isRequired
16951693
}).isRequired,
16961694

1697-
startDragging: _react2.default.PropTypes.bool.isRequired,
1695+
startDragging: _react2.default.PropTypes.func.isRequired,
16981696
getPercentageValue: _react2.default.PropTypes.func.isRequired
16991697
}, _temp)) || _class);
17001698
exports.default = HueSlider;
@@ -2125,18 +2123,23 @@ return /******/ (function(modules) { // webpackBootstrap
21252123
labelWidth: this.props.labelWidth,
21262124
layout: this.props.layout
21272125
};
2128-
var inputLabel = _react2.default.createElement(_label2.default, this.props);
2126+
var inputLabel = _react2.default.createElement(_label2.default, labelProps);
21292127
var saved = _react2.default.createElement(_saved2.default, { saved: this.props.saved });
21302128

21312129
if (this.props.prefix || this.props.suffix) {
2132-
return [inputLabel, _react2.default.createElement(
2130+
return _react2.default.createElement(
21332131
'div',
2134-
{ className: 'input-group' },
2135-
this._inputPrefix(),
2136-
this._input(),
2137-
saved,
2138-
this._inputSuffix()
2139-
)];
2132+
null,
2133+
inputLabel,
2134+
_react2.default.createElement(
2135+
'div',
2136+
{ className: 'input-group' },
2137+
this._inputPrefix(),
2138+
this._input(),
2139+
saved,
2140+
this._inputSuffix()
2141+
)
2142+
);
21402143
}
21412144

21422145
return _react2.default.createElement(
@@ -2365,12 +2368,14 @@ return /******/ (function(modules) { // webpackBootstrap
23652368

23662369
var _react2 = _interopRequireDefault(_react);
23672370

2371+
var _reactDom = __webpack_require__(18);
2372+
2373+
var _reactDom2 = _interopRequireDefault(_reactDom);
2374+
23682375
var _classnames = __webpack_require__(7);
23692376

23702377
var _classnames2 = _interopRequireDefault(_classnames);
23712378

2372-
var _frig = __webpack_require__(8);
2373-
23742379
var _input_error_list = __webpack_require__(9);
23752380

23762381
var _input_error_list2 = _interopRequireDefault(_input_error_list);
@@ -2411,16 +2416,109 @@ return /******/ (function(modules) { // webpackBootstrap
24112416
}
24122417

24132418
_createClass(Select, [{
2419+
key: 'componentWillMount',
2420+
value: function componentWillMount() {
2421+
var hasOptions = this.props.options.length !== 0;
2422+
if (hasOptions && this.props.value === '') {
2423+
this._setInitialValue(this.props);
2424+
}
2425+
}
2426+
}, {
2427+
key: 'componentWillReceiveProps',
2428+
value: function componentWillReceiveProps(nextProps) {
2429+
var hasOptions = nextProps.options.length !== 0;
2430+
// Setting the intial value of the select when the options load
2431+
if (hasOptions && nextProps.value === '') {
2432+
this._setInitialValue(nextProps);
2433+
}
2434+
// Blanking the select's value when the options are removed
2435+
if (!hasOptions && nextProps.value !== '') {
2436+
nextProps.onChange(undefined, { setModified: false });
2437+
}
2438+
}
2439+
2440+
// Default a blank value to the first option (if there are no blank options)
2441+
2442+
}, {
2443+
key: '_setInitialValue',
2444+
value: function _setInitialValue(nextProps) {
2445+
if (nextProps.options.filter(function (_ref) {
2446+
var value = _ref.value;
2447+
return value === '';
2448+
}).length > 0) {
2449+
return;
2450+
}
2451+
var value = nextProps.value || nextProps.options[0].value;
2452+
nextProps.onChange(value, { setModified: false });
2453+
}
2454+
2455+
// Reads the value from the DOM for the select input fields
2456+
2457+
}, {
2458+
key: '_getValue',
2459+
value: function _getValue() {
2460+
var el = _reactDom2.default.findDOMNode(this.refs.input);
2461+
// The value is cast to a string when we get it from DOM.value. This is a
2462+
// mapping of those strings to their original values in the options list.
2463+
var originalValues = {};
2464+
var _iteratorNormalCompletion = true;
2465+
var _didIteratorError = false;
2466+
var _iteratorError = undefined;
2467+
2468+
try {
2469+
for (var _iterator = this.props.options[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
2470+
var option = _step.value;
2471+
2472+
var valueHash = option.value.toString();
2473+
originalValues[valueHash] = option.value;
2474+
}
2475+
} catch (err) {
2476+
_didIteratorError = true;
2477+
_iteratorError = err;
2478+
} finally {
2479+
try {
2480+
if (!_iteratorNormalCompletion && _iterator.return) {
2481+
_iterator.return();
2482+
}
2483+
} finally {
2484+
if (_didIteratorError) {
2485+
throw _iteratorError;
2486+
}
2487+
}
2488+
}
2489+
2490+
return originalValues[el.value] || el.value;
2491+
}
2492+
}, {
2493+
key: '_onChange',
2494+
value: function _onChange() {
2495+
this.props.onChange(this._getValue());
2496+
}
2497+
}, {
24142498
key: '_inputHtml',
24152499
value: function _inputHtml() {
24162500
return Object.assign({}, this.props.inputHtml, {
24172501
key: 'input',
2502+
ref: 'input',
24182503
className: 'form-control',
24192504
value: this.props.value,
24202505
onChange: this.props.onChange,
24212506
options: this.props.options
24222507
});
24232508
}
2509+
}, {
2510+
key: '_selectOption',
2511+
value: function _selectOption(o) {
2512+
var attrs = {
2513+
key: 'option-' + o.label,
2514+
value: o.value || ''
2515+
};
2516+
return _react2.default.createElement(
2517+
'option',
2518+
attrs,
2519+
o.label
2520+
);
2521+
}
24242522
}, {
24252523
key: 'render',
24262524
value: function render() {
@@ -2435,7 +2533,11 @@ return /******/ (function(modules) { // webpackBootstrap
24352533
_react2.default.createElement(
24362534
'div',
24372535
{ className: 'controls' },
2438-
_react2.default.createElement(_frig.ValueLinkedSelect, this._inputHtml()),
2536+
_react2.default.createElement(
2537+
'select',
2538+
this._inputHtml(),
2539+
this.props.options.map(this._selectOption)
2540+
),
24392541
_react2.default.createElement(_input_error_list2.default, { errors: this.props.errors })
24402542
),
24412543
_react2.default.createElement(_saved2.default, { saved: this.props.saved })
@@ -2446,9 +2548,12 @@ return /******/ (function(modules) { // webpackBootstrap
24462548

24472549
return Select;
24482550
}(_react2.default.Component), _class.displayName = 'FriggingBootstrap.Select', _class.defaultProps = Object.assign({}, _default_props2.default, {
2449-
options: {}
2551+
options: []
24502552
}), _class.propTypes = Object.assign({}, _default_prop_types2.default, {
2451-
options: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.array, _react2.default.PropTypes.object, _react2.default.PropTypes.string])
2553+
options: _react2.default.PropTypes.arrayOf(_react2.default.PropTypes.shape({
2554+
value: _react2.default.PropTypes.any.isRequired,
2555+
label: _react2.default.PropTypes.string.isRequired
2556+
}).isRequired)
24522557
}), _temp);
24532558
exports.default = Select;
24542559

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frigging-bootstrap",
3-
"version": "0.13.0-alpha.1",
3+
"version": "0.13.0",
44
"repository": {
55
"type": "git",
66
"url": "frig-js/frigging-bootstrap"

0 commit comments

Comments
 (0)