pebble-web 2.20.0-alpha.1 → 2.21.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4107,52 +4107,50 @@ var Switch = /*#__PURE__*/function (_React$PureComponent) {
4107
4107
  _inherits(Switch, _React$PureComponent);
4108
4108
  var _super = _createSuper$o(Switch);
4109
4109
  function Switch() {
4110
- var _this;
4111
4110
  _classCallCheck(this, Switch);
4112
- _this = _super.apply(this, arguments);
4113
- _this.state = {
4114
- value: _this.props.initialValue || false
4115
- };
4116
- return _this;
4111
+ return _super.apply(this, arguments);
4117
4112
  }
4118
4113
  _createClass(Switch, [{
4119
4114
  key: "render",
4120
4115
  value: function render() {
4121
4116
  var _cx3,
4122
- _this2 = this,
4117
+ _this = this,
4123
4118
  _cx4;
4124
4119
  var _this$props = this.props,
4120
+ checked = _this$props.checked,
4125
4121
  _onChange = _this$props.onChange,
4126
4122
  className = _this$props.className,
4127
4123
  label = _this$props.label,
4128
4124
  disabled = _this$props.disabled;
4129
- var value = this.state.value;
4130
4125
  return /*#__PURE__*/createElement("label", {
4131
4126
  className: cx(className, fixedLabelStyle, _defineProperty({}, disabledStyle$1, !!disabled))
4132
4127
  }, /*#__PURE__*/createElement("span", {
4133
4128
  className: labelTextStyle
4134
4129
  }, label), /*#__PURE__*/createElement("div", {
4135
- className: cx(labelStyle$1, (_cx3 = {}, _defineProperty(_cx3, selectedLabel, value), _defineProperty(_cx3, disabledStyle$1, !!disabled), _cx3))
4130
+ className: cx(labelStyle$1, (_cx3 = {}, _defineProperty(_cx3, selectedLabel, checked), _defineProperty(_cx3, disabledStyle$1, !!disabled), _cx3))
4136
4131
  }, /*#__PURE__*/createElement("input", {
4137
4132
  type: "checkbox",
4138
- checked: value,
4133
+ checked: checked,
4139
4134
  className: inputStyle$3,
4140
- onChange: function onChange() {
4141
- _this2.setState({
4142
- value: !value
4135
+ onChange: function onChange(e) {
4136
+ _this.setState({
4137
+ value: !checked
4143
4138
  });
4144
4139
  if (_onChange) {
4145
- _onChange(!value);
4140
+ _onChange(!checked, e);
4146
4141
  }
4147
4142
  },
4148
4143
  disabled: disabled
4149
4144
  }), /*#__PURE__*/createElement("span", {
4150
- className: cx((_cx4 = {}, _defineProperty(_cx4, switchStyle, true), _defineProperty(_cx4, selectedSwitch, value), _cx4))
4145
+ className: cx((_cx4 = {}, _defineProperty(_cx4, switchStyle, true), _defineProperty(_cx4, selectedSwitch, checked), _cx4))
4151
4146
  })));
4152
4147
  }
4153
4148
  }]);
4154
4149
  return Switch;
4155
4150
  }(PureComponent);
4151
+ Switch.defaultProps = {
4152
+ checked: false
4153
+ };
4156
4154
 
4157
4155
  function ownKeys$r(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4158
4156
  function _objectSpread$r(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$r(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$r(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }