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.
@@ -4107,50 +4107,52 @@ 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;
4110
4111
  _classCallCheck(this, Switch);
4111
- return _super.apply(this, arguments);
4112
+ _this = _super.apply(this, arguments);
4113
+ _this.state = {
4114
+ value: _this.props.initialValue || false
4115
+ };
4116
+ return _this;
4112
4117
  }
4113
4118
  _createClass(Switch, [{
4114
4119
  key: "render",
4115
4120
  value: function render() {
4116
4121
  var _cx3,
4117
- _this = this,
4122
+ _this2 = this,
4118
4123
  _cx4;
4119
4124
  var _this$props = this.props,
4120
- checked = _this$props.checked,
4121
4125
  _onChange = _this$props.onChange,
4122
4126
  className = _this$props.className,
4123
4127
  label = _this$props.label,
4124
4128
  disabled = _this$props.disabled;
4129
+ var value = this.state.value;
4125
4130
  return /*#__PURE__*/createElement("label", {
4126
4131
  className: cx(className, fixedLabelStyle, _defineProperty({}, disabledStyle$1, !!disabled))
4127
4132
  }, /*#__PURE__*/createElement("span", {
4128
4133
  className: labelTextStyle
4129
4134
  }, label), /*#__PURE__*/createElement("div", {
4130
- className: cx(labelStyle$1, (_cx3 = {}, _defineProperty(_cx3, selectedLabel, checked), _defineProperty(_cx3, disabledStyle$1, !!disabled), _cx3))
4135
+ className: cx(labelStyle$1, (_cx3 = {}, _defineProperty(_cx3, selectedLabel, value), _defineProperty(_cx3, disabledStyle$1, !!disabled), _cx3))
4131
4136
  }, /*#__PURE__*/createElement("input", {
4132
4137
  type: "checkbox",
4133
- checked: checked,
4138
+ checked: value,
4134
4139
  className: inputStyle$3,
4135
- onChange: function onChange(e) {
4136
- _this.setState({
4137
- value: !checked
4140
+ onChange: function onChange() {
4141
+ _this2.setState({
4142
+ value: !value
4138
4143
  });
4139
4144
  if (_onChange) {
4140
- _onChange(!checked, e);
4145
+ _onChange(!value);
4141
4146
  }
4142
4147
  },
4143
4148
  disabled: disabled
4144
4149
  }), /*#__PURE__*/createElement("span", {
4145
- className: cx((_cx4 = {}, _defineProperty(_cx4, switchStyle, true), _defineProperty(_cx4, selectedSwitch, checked), _cx4))
4150
+ className: cx((_cx4 = {}, _defineProperty(_cx4, switchStyle, true), _defineProperty(_cx4, selectedSwitch, value), _cx4))
4146
4151
  })));
4147
4152
  }
4148
4153
  }]);
4149
4154
  return Switch;
4150
4155
  }(PureComponent);
4151
- Switch.defaultProps = {
4152
- checked: false
4153
- };
4154
4156
 
4155
4157
  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; }
4156
4158
  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; }