@synerise/ds-completed-within 0.7.7 → 0.7.9
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 +16 -0
- package/dist/CompletedWithin.d.ts +1 -1
- package/dist/CompletedWithin.js +21 -21
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.7.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-completed-within@0.7.8...@synerise/ds-completed-within@0.7.9) (2024-10-29)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-completed-within
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.7.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-completed-within@0.7.7...@synerise/ds-completed-within@0.7.8) (2024-10-28)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @synerise/ds-completed-within
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.7.7](https://github.com/Synerise/synerise-design/compare/@synerise/ds-completed-within@0.7.6...@synerise/ds-completed-within@0.7.7) (2024-10-23)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @synerise/ds-completed-within
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CompletedWithinProps } from './CompletedWithin.types';
|
|
3
3
|
export declare const DEFAULT_PERIODS: string[];
|
|
4
|
-
declare const CompletedWithin: React.
|
|
4
|
+
declare const CompletedWithin: ({ value, maxValue, onSetValue, text, periods, placeholder, tooltip, readOnly, }: CompletedWithinProps) => React.JSX.Element;
|
|
5
5
|
export default CompletedWithin;
|
package/dist/CompletedWithin.js
CHANGED
|
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
|
-
import React from 'react';
|
|
7
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
8
8
|
import { useIntl } from 'react-intl';
|
|
9
9
|
import Icon, { ClockM, Close3S } from '@synerise/ds-icon';
|
|
10
10
|
import Dropdown from '@synerise/ds-dropdown';
|
|
@@ -23,7 +23,7 @@ var CompletedWithin = function CompletedWithin(_ref) {
|
|
|
23
23
|
tooltip = _ref.tooltip,
|
|
24
24
|
readOnly = _ref.readOnly;
|
|
25
25
|
var intl = useIntl();
|
|
26
|
-
var texts =
|
|
26
|
+
var texts = useMemo(function () {
|
|
27
27
|
return _objectSpread({
|
|
28
28
|
header: intl.formatMessage({
|
|
29
29
|
id: 'DS.COMPLETED-WITHIN.HEADER',
|
|
@@ -43,7 +43,7 @@ var CompletedWithin = function CompletedWithin(_ref) {
|
|
|
43
43
|
})
|
|
44
44
|
}, text);
|
|
45
45
|
}, [text, intl]);
|
|
46
|
-
var getPeriods =
|
|
46
|
+
var getPeriods = useMemo(function () {
|
|
47
47
|
if (periods !== undefined && periods.length) {
|
|
48
48
|
return periods;
|
|
49
49
|
}
|
|
@@ -59,38 +59,38 @@ var CompletedWithin = function CompletedWithin(_ref) {
|
|
|
59
59
|
});
|
|
60
60
|
}, [periods, intl]);
|
|
61
61
|
|
|
62
|
-
var
|
|
63
|
-
innerValue =
|
|
64
|
-
setInnerValue =
|
|
62
|
+
var _useState = useState(value.value),
|
|
63
|
+
innerValue = _useState[0],
|
|
64
|
+
setInnerValue = _useState[1];
|
|
65
65
|
|
|
66
|
-
var
|
|
67
|
-
innerPeriod =
|
|
68
|
-
setInnerPeriod =
|
|
66
|
+
var _useState2 = useState(value.period),
|
|
67
|
+
innerPeriod = _useState2[0],
|
|
68
|
+
setInnerPeriod = _useState2[1];
|
|
69
69
|
|
|
70
|
-
var
|
|
71
|
-
tooltipVisible =
|
|
72
|
-
setTooltipVisible =
|
|
70
|
+
var _useState3 = useState(false),
|
|
71
|
+
tooltipVisible = _useState3[0],
|
|
72
|
+
setTooltipVisible = _useState3[1];
|
|
73
73
|
|
|
74
|
-
var
|
|
75
|
-
settingsVisible =
|
|
76
|
-
setSettingsVisible =
|
|
74
|
+
var _useState4 = useState(false),
|
|
75
|
+
settingsVisible = _useState4[0],
|
|
76
|
+
setSettingsVisible = _useState4[1];
|
|
77
77
|
|
|
78
|
-
var hasValue =
|
|
78
|
+
var hasValue = useMemo(function () {
|
|
79
79
|
return value.value !== undefined && value.value > 0;
|
|
80
80
|
}, [value]);
|
|
81
|
-
var handleVisibleChange =
|
|
81
|
+
var handleVisibleChange = useCallback(function (visible) {
|
|
82
82
|
setSettingsVisible(visible);
|
|
83
83
|
setTooltipVisible(false);
|
|
84
84
|
|
|
85
85
|
if (!visible && innerValue && innerPeriod) {
|
|
86
|
-
var newValue = maxValue && maxValue < innerValue ? maxValue : innerValue;
|
|
86
|
+
var newValue = maxValue && maxValue < parseFloat("" + innerValue) ? maxValue : innerValue;
|
|
87
87
|
onSetValue({
|
|
88
88
|
value: Number(newValue),
|
|
89
89
|
period: innerPeriod
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
}, [innerPeriod, innerValue, maxValue, onSetValue]);
|
|
93
|
-
var handleClear =
|
|
93
|
+
var handleClear = useCallback(function () {
|
|
94
94
|
setInnerPeriod(undefined);
|
|
95
95
|
setInnerValue(undefined);
|
|
96
96
|
onSetValue({
|
|
@@ -98,11 +98,11 @@ var CompletedWithin = function CompletedWithin(_ref) {
|
|
|
98
98
|
period: undefined
|
|
99
99
|
});
|
|
100
100
|
}, [onSetValue]);
|
|
101
|
-
var triggerMode =
|
|
101
|
+
var triggerMode = useMemo(function () {
|
|
102
102
|
if (hasValue || placeholder) return 'icon-label';
|
|
103
103
|
return 'single-icon';
|
|
104
104
|
}, [hasValue, placeholder]);
|
|
105
|
-
var triggerLabel =
|
|
105
|
+
var triggerLabel = useMemo(function () {
|
|
106
106
|
var _getPeriods$find;
|
|
107
107
|
|
|
108
108
|
return hasValue ? texts.completedLabel + " " + value.value + " " + ((_getPeriods$find = getPeriods.find(function (singlePeriod) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-completed-within",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.9",
|
|
4
4
|
"description": "CompletedWithin UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-button": "^0.21.
|
|
38
|
-
"@synerise/ds-dropdown": "^0.18.
|
|
39
|
-
"@synerise/ds-icon": "^0.66.
|
|
40
|
-
"@synerise/ds-input": "^0.24.
|
|
41
|
-
"@synerise/ds-input-number": "^0.10.
|
|
42
|
-
"@synerise/ds-select": "^0.16.
|
|
43
|
-
"@synerise/ds-tooltip": "^0.14.
|
|
44
|
-
"@synerise/ds-utils": "^0.30.
|
|
37
|
+
"@synerise/ds-button": "^0.21.16",
|
|
38
|
+
"@synerise/ds-dropdown": "^0.18.21",
|
|
39
|
+
"@synerise/ds-icon": "^0.66.2",
|
|
40
|
+
"@synerise/ds-input": "^0.24.11",
|
|
41
|
+
"@synerise/ds-input-number": "^0.10.12",
|
|
42
|
+
"@synerise/ds-select": "^0.16.23",
|
|
43
|
+
"@synerise/ds-tooltip": "^0.14.46",
|
|
44
|
+
"@synerise/ds-utils": "^0.30.2",
|
|
45
45
|
"react-intl": "3.12.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"react": ">=16.9.0 <= 17.0.2",
|
|
51
51
|
"styled-components": "5.0.1"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "c9eddd944cd2f08cb02db807652ba7fb2b536a1c"
|
|
54
54
|
}
|