UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

38 lines (36 loc) 2.4 kB
define(["require", "exports", "tslib", "react", "office-ui-fabric-react/lib/Checkbox"], function (require, exports, tslib_1, React, Checkbox_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var CheckboxBasicExample = (function (_super) { tslib_1.__extends(CheckboxBasicExample, _super); function CheckboxBasicExample() { var _this = _super.call(this) || this; _this.state = { isChecked: false }; _this._onCheckboxChange = _this._onCheckboxChange.bind(_this); return _this; } CheckboxBasicExample.prototype.render = function () { var _this = this; var isChecked = this.state.isChecked; return (React.createElement("div", null, React.createElement(Checkbox_1.Checkbox, { label: 'Uncontrolled checkbox', onChange: this._onCheckboxChange, inputProps: { onFocus: function () { console.log('Uncontrolled checkbox is focused'); }, onBlur: function () { console.log('Uncontrolled checkbox is blured'); } }, style: { marginTop: 10 } }), React.createElement(Checkbox_1.Checkbox, { label: 'Uncontrolled checkbox with defaultChecked true', defaultChecked: true, onChange: this._onCheckboxChange, style: { marginTop: 10 } }), React.createElement(Checkbox_1.Checkbox, { label: 'Disabled uncontrolled checkbox with defaultChecked true', disabled: true, defaultChecked: true, onChange: this._onCheckboxChange, style: { marginTop: 10 } }), React.createElement(Checkbox_1.Checkbox, { label: 'Controlled checkbox', checked: isChecked, onChange: function (ev, checked) { _this.setState({ isChecked: checked }); }, style: { marginTop: 10 } }), React.createElement(Checkbox_1.Checkbox, { label: 'Checkbox rendered with boxSide "end"', boxSide: 'end', style: { marginTop: 10 } }))); }; CheckboxBasicExample.prototype._onCheckboxChange = function (ev, isChecked) { console.log("The option has been changed to " + isChecked + "."); }; return CheckboxBasicExample; }(React.Component)); exports.CheckboxBasicExample = CheckboxBasicExample; }); //# sourceMappingURL=Checkbox.Basic.Example.js.map