@cashub/ui 0.48.12 → 0.48.13

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.
@@ -50,8 +50,8 @@ const DatetimePickerV3 = _ref => {
50
50
  return selected ? new Date(Date.parse(selected)) : '';
51
51
  }, [selected]);
52
52
  const handleChange = (0, _react.useCallback)(date => {
53
- // when time can be empty and no value yet
54
- if (showTimeInput && allowTimeInputEmpty && !selected && date) {
53
+ // when showTimeInput and DatetimePicker no value yet
54
+ if (showTimeInput && !selected && date) {
55
55
  // if time selected before date, use selected time
56
56
  if (pendingTimeRef.current) {
57
57
  setDateTime(date, pendingTimeRef.current);
@@ -63,7 +63,7 @@ const DatetimePickerV3 = _ref => {
63
63
  }
64
64
  }
65
65
  onChange(date);
66
- }, [allowTimeInputEmpty, onChange, selected, showTimeInput]);
66
+ }, [onChange, selected, showTimeInput]);
67
67
  const datePickerProps = {
68
68
  dateFormat,
69
69
  disabled,
@@ -75,22 +75,19 @@ const TimePickerV2 = _ref => {
75
75
  update();
76
76
  };
77
77
  const handleChange = (type, value) => {
78
- setTime(previous => {
79
- return _objectSpread(_objectSpread({}, previous), {}, {
80
- [type]: value
81
- });
78
+ const next = _objectSpread(_objectSpread({}, time), {}, {
79
+ [type]: value
82
80
  });
81
+ setTime(next);
82
+ if (typeof onSelect === 'function' && next.hour && next.minute && next.second) {
83
+ onSelect("".concat(next.hour, ":").concat(next.minute, ":").concat(next.second));
84
+ }
83
85
  };
84
86
 
85
87
  // sync time picker state when selected value changes
86
88
  (0, _react.useEffect)(() => {
87
89
  setTime(getTimeFromSelected(selected, allowEmpty));
88
90
  }, [allowEmpty, selected]);
89
- (0, _react.useEffect)(() => {
90
- if (typeof onSelect === 'function' && time.hour && time.minute && time.second) {
91
- onSelect("".concat(time.hour, ":").concat(time.minute, ":").concat(time.second));
92
- }
93
- }, [onSelect, time.hour, time.minute, time.second]);
94
91
  (0, _react.useEffect)(() => {
95
92
  if (display) {
96
93
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cashub/ui",
3
- "version": "0.48.12",
3
+ "version": "0.48.13",
4
4
  "private": false,
5
5
  "author": "CasHUB Team",
6
6
  "description": "CasHUB UI components library",