pebble-web 2.10.0 → 2.11.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.
@@ -1095,17 +1095,18 @@ var DropDown = /*#__PURE__*/function (_React$PureComponent) {
1095
1095
  isSelected = _this$props.isSelected,
1096
1096
  disabled = _this$props.disabled,
1097
1097
  labelClassName = _this$props.labelClassName,
1098
+ controlled = _this$props.controlled,
1098
1099
  _onOutsideClick = _this$props.onOutsideClick;
1099
- var isOpen = this.state.isOpen;
1100
+ var _isDropDownOpen = controlled ? !!this.props.isOpen : this.state.isOpen;
1100
1101
  return /*#__PURE__*/createElement(OutsideClick, {
1101
1102
  className: cx(wrapperStyle$1, className),
1102
1103
  onOutsideClick: function onOutsideClick() {
1103
1104
  _this2.setState({
1104
1105
  isOpen: false
1105
1106
  });
1106
- if (_onOutsideClick) _onOutsideClick(isOpen);
1107
+ if (_onOutsideClick) _onOutsideClick(_isDropDownOpen);
1107
1108
  },
1108
- disabled: !isOpen
1109
+ disabled: !_isDropDownOpen
1109
1110
  }, /*#__PURE__*/createElement(Manager, null, /*#__PURE__*/createElement(Reference, null, function (_ref) {
1110
1111
  var ref = _ref.ref;
1111
1112
  return /*#__PURE__*/createElement("div", {
@@ -1115,17 +1116,17 @@ var DropDown = /*#__PURE__*/function (_React$PureComponent) {
1115
1116
  },
1116
1117
  ref: ref
1117
1118
  }, labelComponent ? labelComponent({
1118
- isOpen: isOpen,
1119
+ isOpen: _isDropDownOpen,
1119
1120
  toggleDropdown: _this2.toggleDropdown
1120
1121
  }) : /*#__PURE__*/createElement(DropDownButton, {
1121
1122
  isSelected: !!isSelected,
1122
- isOpen: isOpen,
1123
+ isOpen: _isDropDownOpen,
1123
1124
  onClick: _this2.toggleDropdown,
1124
1125
  disabled: disabled,
1125
1126
  className: labelClassName
1126
1127
  }, buttonLabel));
1127
1128
  }), /*#__PURE__*/createElement(MountTransition, {
1128
- visible: isOpen
1129
+ visible: _isDropDownOpen
1129
1130
  }, function (transitionStyles) {
1130
1131
  return /*#__PURE__*/createElement(animated.div, {
1131
1132
  className: cx(dropDownStyle, dropDownClassName),
@@ -1152,7 +1153,7 @@ var DropDown = /*#__PURE__*/function (_React$PureComponent) {
1152
1153
  "data-placement": placement
1153
1154
  }, children({
1154
1155
  toggle: _this2.toggleDropdown,
1155
- isOpen: _this2.state.isOpen
1156
+ isOpen: _isDropDownOpen
1156
1157
  }));
1157
1158
  }));
1158
1159
  })));
@@ -1535,7 +1536,10 @@ var DateInput = /*#__PURE__*/function (_React$PureComponent) {
1535
1536
  errorMessage = _this$props.errorMessage,
1536
1537
  placement = _this$props.placement,
1537
1538
  wrapperClassName = _this$props.wrapperClassName,
1538
- initiallyOpen = _this$props.initiallyOpen;
1539
+ initiallyOpen = _this$props.initiallyOpen,
1540
+ onOutsideClick = _this$props.onOutsideClick,
1541
+ controlled = _this$props.controlled,
1542
+ isOpen = _this$props.isOpen;
1539
1543
  var _wrapperClassName = cx(wrapperStyle$3, wrapperClassName);
1540
1544
  var _dropDownClassName = cx(dropDownClassName, this.props.dropDownClassName);
1541
1545
  return /*#__PURE__*/createElement(DropDown, {
@@ -1555,7 +1559,7 @@ var DateInput = /*#__PURE__*/function (_React$PureComponent) {
1555
1559
  value: value,
1556
1560
  placeholder: placeholder,
1557
1561
  onClick: function onClick() {
1558
- if (disabled) return;
1562
+ if (disabled || controlled) return;
1559
1563
  toggleDropdown();
1560
1564
  },
1561
1565
  fixLabelAtTop: true
@@ -1573,7 +1577,10 @@ var DateInput = /*#__PURE__*/function (_React$PureComponent) {
1573
1577
  className: _wrapperClassName,
1574
1578
  placement: placement,
1575
1579
  modifiers: modifiers,
1576
- initiallyOpen: initiallyOpen
1580
+ initiallyOpen: initiallyOpen,
1581
+ onOutsideClick: onOutsideClick,
1582
+ controlled: controlled,
1583
+ isOpen: isOpen
1577
1584
  }, function (_ref3) {
1578
1585
  var toggle = _ref3.toggle;
1579
1586
  return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Calendar, Object.assign({
@@ -1584,6 +1591,9 @@ var DateInput = /*#__PURE__*/function (_React$PureComponent) {
1584
1591
  range: false,
1585
1592
  onChange: function onChange(date) {
1586
1593
  _this2.onCalendarDateChange(date);
1594
+ if (controlled) {
1595
+ return;
1596
+ }
1587
1597
  toggle();
1588
1598
  }
1589
1599
  })), errorMessage && /*#__PURE__*/createElement("div", {