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.
@@ -3699,22 +3699,14 @@ const selectedSwitch = /*#__PURE__*/css( {
3699
3699
  } );
3700
3700
 
3701
3701
  class Switch extends PureComponent {
3702
- constructor() {
3703
- super(...arguments);
3704
- this.state = {
3705
- value: this.props.initialValue || false
3706
- };
3707
- }
3708
3702
  render() {
3709
3703
  const {
3704
+ checked,
3710
3705
  onChange,
3711
3706
  className,
3712
3707
  label,
3713
3708
  disabled
3714
3709
  } = this.props;
3715
- const {
3716
- value
3717
- } = this.state;
3718
3710
  return /*#__PURE__*/createElement("label", {
3719
3711
  className: cx(className, fixedLabelStyle, {
3720
3712
  [disabledStyle$1]: !!disabled
@@ -3723,30 +3715,33 @@ class Switch extends PureComponent {
3723
3715
  className: labelTextStyle
3724
3716
  }, label), /*#__PURE__*/createElement("div", {
3725
3717
  className: cx(labelStyle$1, {
3726
- [selectedLabel]: value,
3718
+ [selectedLabel]: checked,
3727
3719
  [disabledStyle$1]: !!disabled
3728
3720
  })
3729
3721
  }, /*#__PURE__*/createElement("input", {
3730
3722
  type: "checkbox",
3731
- checked: value,
3723
+ checked: checked,
3732
3724
  className: inputStyle$3,
3733
- onChange: () => {
3725
+ onChange: e => {
3734
3726
  this.setState({
3735
- value: !value
3727
+ value: !checked
3736
3728
  });
3737
3729
  if (onChange) {
3738
- onChange(!value);
3730
+ onChange(!checked, e);
3739
3731
  }
3740
3732
  },
3741
3733
  disabled: disabled
3742
3734
  }), /*#__PURE__*/createElement("span", {
3743
3735
  className: cx({
3744
3736
  [switchStyle]: true,
3745
- [selectedSwitch]: value
3737
+ [selectedSwitch]: checked
3746
3738
  })
3747
3739
  })));
3748
3740
  }
3749
3741
  }
3742
+ Switch.defaultProps = {
3743
+ checked: false
3744
+ };
3750
3745
 
3751
3746
  const tagStyle = /*#__PURE__*/css({ ...typography.s.bold,
3752
3747
  ...flexSpaceBetween,