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