pebble-web 2.21.0-alpha.0 → 2.22.1

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