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.
@@ -1113,17 +1113,18 @@ var DropDown = /*#__PURE__*/function (_React$PureComponent) {
1113
1113
  isSelected = _this$props.isSelected,
1114
1114
  disabled = _this$props.disabled,
1115
1115
  labelClassName = _this$props.labelClassName,
1116
+ controlled = _this$props.controlled,
1116
1117
  _onOutsideClick = _this$props.onOutsideClick;
1117
- var isOpen = this.state.isOpen;
1118
+ var _isDropDownOpen = controlled ? !!this.props.isOpen : this.state.isOpen;
1118
1119
  return /*#__PURE__*/createElement(OutsideClick, {
1119
1120
  className: cx(wrapperStyle$1, className),
1120
1121
  onOutsideClick: function onOutsideClick() {
1121
1122
  _this2.setState({
1122
1123
  isOpen: false
1123
1124
  });
1124
- if (_onOutsideClick) _onOutsideClick(isOpen);
1125
+ if (_onOutsideClick) _onOutsideClick(_isDropDownOpen);
1125
1126
  },
1126
- disabled: !isOpen
1127
+ disabled: !_isDropDownOpen
1127
1128
  }, /*#__PURE__*/createElement(Manager, null, /*#__PURE__*/createElement(Reference, null, function (_ref) {
1128
1129
  var ref = _ref.ref;
1129
1130
  return /*#__PURE__*/createElement("div", {
@@ -1133,17 +1134,17 @@ var DropDown = /*#__PURE__*/function (_React$PureComponent) {
1133
1134
  },
1134
1135
  ref: ref
1135
1136
  }, labelComponent ? labelComponent({
1136
- isOpen: isOpen,
1137
+ isOpen: _isDropDownOpen,
1137
1138
  toggleDropdown: _this2.toggleDropdown
1138
1139
  }) : /*#__PURE__*/createElement(DropDownButton, {
1139
1140
  isSelected: !!isSelected,
1140
- isOpen: isOpen,
1141
+ isOpen: _isDropDownOpen,
1141
1142
  onClick: _this2.toggleDropdown,
1142
1143
  disabled: disabled,
1143
1144
  className: labelClassName
1144
1145
  }, buttonLabel));
1145
1146
  }), /*#__PURE__*/createElement(MountTransition, {
1146
- visible: isOpen
1147
+ visible: _isDropDownOpen
1147
1148
  }, function (transitionStyles) {
1148
1149
  return /*#__PURE__*/createElement(animated.div, {
1149
1150
  className: cx(dropDownStyle, dropDownClassName),
@@ -1170,7 +1171,7 @@ var DropDown = /*#__PURE__*/function (_React$PureComponent) {
1170
1171
  "data-placement": placement
1171
1172
  }, children({
1172
1173
  toggle: _this2.toggleDropdown,
1173
- isOpen: _this2.state.isOpen
1174
+ isOpen: _isDropDownOpen
1174
1175
  }));
1175
1176
  }));
1176
1177
  })));
@@ -1563,7 +1564,10 @@ var DateInput = /*#__PURE__*/function (_React$PureComponent) {
1563
1564
  errorMessage = _this$props.errorMessage,
1564
1565
  placement = _this$props.placement,
1565
1566
  wrapperClassName = _this$props.wrapperClassName,
1566
- initiallyOpen = _this$props.initiallyOpen;
1567
+ initiallyOpen = _this$props.initiallyOpen,
1568
+ onOutsideClick = _this$props.onOutsideClick,
1569
+ controlled = _this$props.controlled,
1570
+ isOpen = _this$props.isOpen;
1567
1571
  var _wrapperClassName = cx(wrapperStyle$3, wrapperClassName);
1568
1572
  var _dropDownClassName = cx(dropDownClassName, this.props.dropDownClassName);
1569
1573
  return /*#__PURE__*/createElement(DropDown, {
@@ -1583,7 +1587,7 @@ var DateInput = /*#__PURE__*/function (_React$PureComponent) {
1583
1587
  value: value,
1584
1588
  placeholder: placeholder,
1585
1589
  onClick: function onClick() {
1586
- if (disabled) return;
1590
+ if (disabled || controlled) return;
1587
1591
  toggleDropdown();
1588
1592
  },
1589
1593
  fixLabelAtTop: true
@@ -1601,7 +1605,10 @@ var DateInput = /*#__PURE__*/function (_React$PureComponent) {
1601
1605
  className: _wrapperClassName,
1602
1606
  placement: placement,
1603
1607
  modifiers: modifiers,
1604
- initiallyOpen: initiallyOpen
1608
+ initiallyOpen: initiallyOpen,
1609
+ onOutsideClick: onOutsideClick,
1610
+ controlled: controlled,
1611
+ isOpen: isOpen
1605
1612
  }, function (_ref3) {
1606
1613
  var toggle = _ref3.toggle;
1607
1614
  return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Calendar, Object.assign({
@@ -1612,6 +1619,9 @@ var DateInput = /*#__PURE__*/function (_React$PureComponent) {
1612
1619
  range: false,
1613
1620
  onChange: function onChange(date) {
1614
1621
  _this2.onCalendarDateChange(date);
1622
+ if (controlled) {
1623
+ return;
1624
+ }
1615
1625
  toggle();
1616
1626
  }
1617
1627
  })), errorMessage && /*#__PURE__*/createElement("div", {