@synerise/ds-completed-within 0.5.0 → 0.5.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.5.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-completed-within@0.5.0...@synerise/ds-completed-within@0.5.1) (2022-05-13)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **completed-within:** fixes clearing tooltip ([b9e0520](https://github.com/Synerise/synerise-design/commit/b9e05208d75069b03e9671981ea061f0e6183c99))
12
+ * **completed-within:** fixes maxValues in btn label ([46c73ad](https://github.com/Synerise/synerise-design/commit/46c73ad326737bd355ba949fcfeceb58b0035d3e))
13
+
14
+
15
+
16
+
17
+
6
18
  # [0.5.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-completed-within@0.4.0...@synerise/ds-completed-within@0.5.0) (2022-04-29)
7
19
 
8
20
 
@@ -70,21 +70,25 @@ var CompletedWithin = function CompletedWithin(_ref) {
70
70
  tooltipVisible = _React$useState3[0],
71
71
  setTooltipVisible = _React$useState3[1];
72
72
 
73
+ var _React$useState4 = React.useState(false),
74
+ settingsVisible = _React$useState4[0],
75
+ setSettingsVisible = _React$useState4[1];
76
+
73
77
  var hasValue = React.useMemo(function () {
74
78
  return value.value !== undefined && value.value > 0;
75
79
  }, [value]);
76
80
  var handleVisibleChange = React.useCallback(function (visible) {
81
+ setSettingsVisible(visible);
82
+ setTooltipVisible(false);
83
+
77
84
  if (!visible && innerValue && innerPeriod) {
85
+ var newValue = maxValue && maxValue < innerValue ? maxValue : innerValue;
78
86
  onSetValue({
79
- value: Number(innerValue),
87
+ value: Number(newValue),
80
88
  period: innerPeriod
81
89
  });
82
90
  }
83
-
84
- if (visible) {
85
- setTooltipVisible(false);
86
- }
87
- }, [innerPeriod, innerValue, onSetValue]);
91
+ }, [innerPeriod, innerValue, maxValue, onSetValue]);
88
92
  var handleClear = React.useCallback(function () {
89
93
  setInnerPeriod(undefined);
90
94
  setInnerValue(undefined);
@@ -126,7 +130,7 @@ var CompletedWithin = function CompletedWithin(_ref) {
126
130
  description: tooltip,
127
131
  trigger: ['hover'],
128
132
  onVisibleChange: setTooltipVisible,
129
- visible: tooltipVisible
133
+ visible: !settingsVisible && tooltipVisible
130
134
  }, /*#__PURE__*/React.createElement(S.TriggerButton, {
131
135
  className: "ds-completed-within",
132
136
  type: "tertiary",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-completed-within",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "CompletedWithin UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -43,5 +43,5 @@
43
43
  "@synerise/ds-core": "*",
44
44
  "react": ">=16.9.0 < 17.0.0"
45
45
  },
46
- "gitHead": "4a658911645846d1e329609ba9db06a7bc64962b"
46
+ "gitHead": "25e5737ebe9d4319de963b369bc281651872887c"
47
47
  }