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