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.
@@ -4015,52 +4015,50 @@ var Switch = /*#__PURE__*/function (_React$PureComponent) {
4015
4015
  _inherits(Switch, _React$PureComponent);
4016
4016
  var _super = _createSuper$o(Switch);
4017
4017
  function Switch() {
4018
- var _this;
4019
4018
  _classCallCheck(this, Switch);
4020
- _this = _super.apply(this, arguments);
4021
- _this.state = {
4022
- value: _this.props.initialValue || false
4023
- };
4024
- return _this;
4019
+ return _super.apply(this, arguments);
4025
4020
  }
4026
4021
  _createClass(Switch, [{
4027
4022
  key: "render",
4028
4023
  value: function render() {
4029
4024
  var _cx3,
4030
- _this2 = this,
4025
+ _this = this,
4031
4026
  _cx4;
4032
4027
  var _this$props = this.props,
4028
+ checked = _this$props.checked,
4033
4029
  _onChange = _this$props.onChange,
4034
4030
  className = _this$props.className,
4035
4031
  label = _this$props.label,
4036
4032
  disabled = _this$props.disabled;
4037
- var value = this.state.value;
4038
4033
  return /*#__PURE__*/createElement("label", {
4039
4034
  className: cx(className, fixedLabelStyle, _defineProperty({}, disabledStyle$1, !!disabled))
4040
4035
  }, /*#__PURE__*/createElement("span", {
4041
4036
  className: labelTextStyle
4042
4037
  }, label), /*#__PURE__*/createElement("div", {
4043
- className: cx(labelStyle$1, (_cx3 = {}, _defineProperty(_cx3, selectedLabel, value), _defineProperty(_cx3, disabledStyle$1, !!disabled), _cx3))
4038
+ className: cx(labelStyle$1, (_cx3 = {}, _defineProperty(_cx3, selectedLabel, checked), _defineProperty(_cx3, disabledStyle$1, !!disabled), _cx3))
4044
4039
  }, /*#__PURE__*/createElement("input", {
4045
4040
  type: "checkbox",
4046
- checked: value,
4041
+ checked: checked,
4047
4042
  className: inputStyle$3,
4048
- onChange: function onChange() {
4049
- _this2.setState({
4050
- value: !value
4043
+ onChange: function onChange(e) {
4044
+ _this.setState({
4045
+ value: !checked
4051
4046
  });
4052
4047
  if (_onChange) {
4053
- _onChange(!value);
4048
+ _onChange(!checked, e);
4054
4049
  }
4055
4050
  },
4056
4051
  disabled: disabled
4057
4052
  }), /*#__PURE__*/createElement("span", {
4058
- className: cx((_cx4 = {}, _defineProperty(_cx4, switchStyle, true), _defineProperty(_cx4, selectedSwitch, value), _cx4))
4053
+ className: cx((_cx4 = {}, _defineProperty(_cx4, switchStyle, true), _defineProperty(_cx4, selectedSwitch, checked), _cx4))
4059
4054
  })));
4060
4055
  }
4061
4056
  }]);
4062
4057
  return Switch;
4063
4058
  }(PureComponent);
4059
+ Switch.defaultProps = {
4060
+ checked: false
4061
+ };
4064
4062
 
4065
4063
  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; }
4066
4064
  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; }