pebble-web 2.20.0 → 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.
@@ -3791,22 +3791,14 @@ const selectedSwitch = /*#__PURE__*/css( {
3791
3791
  });
3792
3792
 
3793
3793
  class Switch extends PureComponent {
3794
- constructor() {
3795
- super(...arguments);
3796
- this.state = {
3797
- value: this.props.initialValue || false
3798
- };
3799
- }
3800
3794
  render() {
3801
3795
  const {
3796
+ checked,
3802
3797
  onChange,
3803
3798
  className,
3804
3799
  label,
3805
3800
  disabled
3806
3801
  } = this.props;
3807
- const {
3808
- value
3809
- } = this.state;
3810
3802
  return /*#__PURE__*/createElement("label", {
3811
3803
  className: cx(className, fixedLabelStyle, {
3812
3804
  [disabledStyle$1]: !!disabled
@@ -3815,30 +3807,33 @@ class Switch extends PureComponent {
3815
3807
  className: labelTextStyle
3816
3808
  }, label), /*#__PURE__*/createElement("div", {
3817
3809
  className: cx(labelStyle$1, {
3818
- [selectedLabel]: value,
3810
+ [selectedLabel]: checked,
3819
3811
  [disabledStyle$1]: !!disabled
3820
3812
  })
3821
3813
  }, /*#__PURE__*/createElement("input", {
3822
3814
  type: "checkbox",
3823
- checked: value,
3815
+ checked: checked,
3824
3816
  className: inputStyle$3,
3825
- onChange: () => {
3817
+ onChange: e => {
3826
3818
  this.setState({
3827
- value: !value
3819
+ value: !checked
3828
3820
  });
3829
3821
  if (onChange) {
3830
- onChange(!value);
3822
+ onChange(!checked, e);
3831
3823
  }
3832
3824
  },
3833
3825
  disabled: disabled
3834
3826
  }), /*#__PURE__*/createElement("span", {
3835
3827
  className: cx({
3836
3828
  [switchStyle]: true,
3837
- [selectedSwitch]: value
3829
+ [selectedSwitch]: checked
3838
3830
  })
3839
3831
  })));
3840
3832
  }
3841
3833
  }
3834
+ Switch.defaultProps = {
3835
+ checked: false
3836
+ };
3842
3837
 
3843
3838
  const tagStyle = /*#__PURE__*/css({ ...typography.s.bold,
3844
3839
  ...flexSpaceBetween,