pebble-web 2.10.0 → 2.10.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.
@@ -1048,20 +1048,19 @@ class DropDown extends PureComponent {
1048
1048
  isSelected,
1049
1049
  disabled,
1050
1050
  labelClassName,
1051
+ controlled,
1051
1052
  onOutsideClick
1052
1053
  } = this.props;
1053
- const {
1054
- isOpen
1055
- } = this.state;
1054
+ const _isDropDownOpen = controlled ? !!this.props.isOpen : this.state.isOpen;
1056
1055
  return /*#__PURE__*/createElement(OutsideClick, {
1057
1056
  className: cx(wrapperStyle$1, className),
1058
1057
  onOutsideClick: () => {
1059
1058
  this.setState({
1060
1059
  isOpen: false
1061
1060
  });
1062
- if (onOutsideClick) onOutsideClick(isOpen);
1061
+ if (onOutsideClick) onOutsideClick(_isDropDownOpen);
1063
1062
  },
1064
- disabled: !isOpen
1063
+ disabled: !_isDropDownOpen
1065
1064
  }, /*#__PURE__*/createElement(Manager, null, /*#__PURE__*/createElement(Reference, null, ({
1066
1065
  ref
1067
1066
  }) => /*#__PURE__*/createElement("div", {
@@ -1071,16 +1070,16 @@ class DropDown extends PureComponent {
1071
1070
  },
1072
1071
  ref: ref
1073
1072
  }, labelComponent ? labelComponent({
1074
- isOpen,
1073
+ isOpen: _isDropDownOpen,
1075
1074
  toggleDropdown: this.toggleDropdown
1076
1075
  }) : /*#__PURE__*/createElement(DropDownButton, {
1077
1076
  isSelected: !!isSelected,
1078
- isOpen: isOpen,
1077
+ isOpen: _isDropDownOpen,
1079
1078
  onClick: this.toggleDropdown,
1080
1079
  disabled: disabled,
1081
1080
  className: labelClassName
1082
1081
  }, buttonLabel))), /*#__PURE__*/createElement(MountTransition, {
1083
- visible: isOpen
1082
+ visible: _isDropDownOpen
1084
1083
  }, transitionStyles => /*#__PURE__*/createElement(animated.div, {
1085
1084
  className: cx(dropDownStyle, dropDownClassName),
1086
1085
  style: {
@@ -1109,7 +1108,7 @@ class DropDown extends PureComponent {
1109
1108
  "data-placement": placement
1110
1109
  }, children({
1111
1110
  toggle: this.toggleDropdown,
1112
- isOpen: this.state.isOpen
1111
+ isOpen: _isDropDownOpen
1113
1112
  }));
1114
1113
  })))));
1115
1114
  }
@@ -1466,7 +1465,10 @@ class DateInput extends PureComponent {
1466
1465
  errorMessage,
1467
1466
  placement,
1468
1467
  wrapperClassName,
1469
- initiallyOpen
1468
+ initiallyOpen,
1469
+ onOutsideClick,
1470
+ controlled,
1471
+ isOpen
1470
1472
  } = this.props;
1471
1473
  const _wrapperClassName = cx(wrapperStyle$3, wrapperClassName);
1472
1474
  const _dropDownClassName = cx(dropDownClassName, this.props.dropDownClassName);
@@ -1487,7 +1489,7 @@ class DateInput extends PureComponent {
1487
1489
  value: value,
1488
1490
  placeholder: placeholder,
1489
1491
  onClick: () => {
1490
- if (disabled) return;
1492
+ if (disabled || controlled) return;
1491
1493
  toggleDropdown();
1492
1494
  },
1493
1495
  fixLabelAtTop: true
@@ -1503,7 +1505,10 @@ class DateInput extends PureComponent {
1503
1505
  className: _wrapperClassName,
1504
1506
  placement: placement,
1505
1507
  modifiers: modifiers,
1506
- initiallyOpen: initiallyOpen
1508
+ initiallyOpen: initiallyOpen,
1509
+ onOutsideClick: onOutsideClick,
1510
+ controlled: controlled,
1511
+ isOpen: isOpen
1507
1512
  }, ({
1508
1513
  toggle
1509
1514
  }) => /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Calendar, Object.assign({
@@ -1514,6 +1519,9 @@ class DateInput extends PureComponent {
1514
1519
  range: false,
1515
1520
  onChange: date => {
1516
1521
  this.onCalendarDateChange(date);
1522
+ if (controlled) {
1523
+ return;
1524
+ }
1517
1525
  toggle();
1518
1526
  }
1519
1527
  })), errorMessage && /*#__PURE__*/createElement("div", {