nav-frontend-skjema
Advanced tools
Comparing version 1.0.15 to 1.0.16
@@ -21,2 +21,3 @@ /// <reference types="react" /> | ||
export interface CheckboksPanelState { | ||
checked: boolean; | ||
hasFocus: boolean; | ||
@@ -26,5 +27,7 @@ } | ||
constructor(props: CheckboksPanelProps); | ||
componentWillReceiveProps(newProps: any): void; | ||
toggleOutline(): void; | ||
handleChange: (e: any) => void; | ||
render(): JSX.Element; | ||
} | ||
export default CheckboksPanel; |
@@ -25,3 +25,7 @@ "use strict"; | ||
_this.state = { hasFocus: false }; | ||
_this.handleChange = function (e) { | ||
_this.setState({ checked: e.target.checked }); | ||
if (typeof _this.props.onChange === 'function') _this.props.onChange(e); | ||
}; | ||
_this.state = { hasFocus: false, checked: _this.props.checked }; | ||
return _this; | ||
@@ -31,2 +35,7 @@ } | ||
_createClass(CheckboksPanel, [{ | ||
key: "componentWillReceiveProps", | ||
value: function componentWillReceiveProps(newProps) { | ||
this.setState({ checked: newProps.checked }); | ||
} | ||
}, { | ||
key: "toggleOutline", | ||
@@ -43,3 +52,2 @@ value: function toggleOutline() { | ||
id = _props.id, | ||
checked = _props.checked, | ||
label = _props.label, | ||
@@ -49,3 +57,5 @@ onChange = _props.onChange, | ||
disabled = _props.disabled; | ||
var hasFocus = this.state.hasFocus; | ||
var _state = this.state, | ||
hasFocus = _state.hasFocus, | ||
checked = _state.checked; | ||
@@ -62,3 +72,3 @@ var inputId = id || nav_frontend_js_utils_1.guid(); | ||
return _this2.toggleOutline(); | ||
}, onChange: onChange })), React.createElement("span", { className: "inputPanel__label" }, label)); | ||
}, onChange: this.handleChange })), React.createElement("span", { className: "inputPanel__label" }, label)); | ||
} | ||
@@ -65,0 +75,0 @@ }]); |
{ | ||
"name": "nav-frontend-skjema", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"main": "lib/index.js", | ||
@@ -18,3 +18,3 @@ "types": "lib/index.d.ts", | ||
"nav-frontend-js-utils": "^1.0.6", | ||
"nav-frontend-skjema-style": "^0.3.20", | ||
"nav-frontend-skjema-style": "^1.0.1", | ||
"prop-types": "^15.5.10", | ||
@@ -26,3 +26,3 @@ "react": "^15.4.2 || ^16.0.0" | ||
"nav-frontend-js-utils": "^1.0.6", | ||
"nav-frontend-skjema-style": "^0.3.20", | ||
"nav-frontend-skjema-style": "^1.0.1", | ||
"prop-types": "^15.5.10", | ||
@@ -29,0 +29,0 @@ "react": "^15.4.2 || ^16.0.0" |
Sorry, the diff of this file is not supported yet
219185
2901