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