@synerise/ds-completed-within 0.8.2 → 0.8.3
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 +8 -0
- package/dist/CompletedWithin.js +15 -30
- package/dist/Settings/Settings.js +8 -9
- package/dist/Settings/Settings.styles.js +2 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.8.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-completed-within@0.8.2...@synerise/ds-completed-within@0.8.3) (2024-11-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-completed-within
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [0.8.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-completed-within@0.8.1...@synerise/ds-completed-within@0.8.2) (2024-11-21)
|
|
7
15
|
|
|
8
16
|
|
package/dist/CompletedWithin.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
4
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
8
|
-
|
|
9
5
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
|
-
|
|
11
6
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
12
7
|
import { useIntl } from 'react-intl';
|
|
13
8
|
import Icon, { ClockM, Close3S } from '@synerise/ds-icon';
|
|
@@ -16,16 +11,15 @@ import Tooltip from '@synerise/ds-tooltip';
|
|
|
16
11
|
import Settings from './Settings/Settings';
|
|
17
12
|
import * as S from './CompleteWithin.styles';
|
|
18
13
|
export var DEFAULT_PERIODS = ['SECONDS', 'MINUTES', 'HOURS', 'DAYS', 'MONTHS', 'YEARS'];
|
|
19
|
-
|
|
20
14
|
var CompletedWithin = function CompletedWithin(_ref) {
|
|
21
15
|
var value = _ref.value,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
maxValue = _ref.maxValue,
|
|
17
|
+
onSetValue = _ref.onSetValue,
|
|
18
|
+
text = _ref.text,
|
|
19
|
+
periods = _ref.periods,
|
|
20
|
+
placeholder = _ref.placeholder,
|
|
21
|
+
tooltip = _ref.tooltip,
|
|
22
|
+
readOnly = _ref.readOnly;
|
|
29
23
|
var intl = useIntl();
|
|
30
24
|
var texts = useMemo(function () {
|
|
31
25
|
return _objectSpread({
|
|
@@ -51,7 +45,6 @@ var CompletedWithin = function CompletedWithin(_ref) {
|
|
|
51
45
|
if (periods !== undefined && periods.length) {
|
|
52
46
|
return periods;
|
|
53
47
|
}
|
|
54
|
-
|
|
55
48
|
return DEFAULT_PERIODS.map(function (period) {
|
|
56
49
|
return {
|
|
57
50
|
value: period,
|
|
@@ -62,30 +55,24 @@ var CompletedWithin = function CompletedWithin(_ref) {
|
|
|
62
55
|
};
|
|
63
56
|
});
|
|
64
57
|
}, [periods, intl]);
|
|
65
|
-
|
|
66
58
|
var _useState = useState(value.value),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
innerValue = _useState[0],
|
|
60
|
+
setInnerValue = _useState[1];
|
|
70
61
|
var _useState2 = useState(value.period),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
62
|
+
innerPeriod = _useState2[0],
|
|
63
|
+
setInnerPeriod = _useState2[1];
|
|
74
64
|
var _useState3 = useState(false),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
65
|
+
tooltipVisible = _useState3[0],
|
|
66
|
+
setTooltipVisible = _useState3[1];
|
|
78
67
|
var _useState4 = useState(false),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
settingsVisible = _useState4[0],
|
|
69
|
+
setSettingsVisible = _useState4[1];
|
|
82
70
|
var hasValue = useMemo(function () {
|
|
83
71
|
return value.value !== undefined && value.value > 0;
|
|
84
72
|
}, [value]);
|
|
85
73
|
var handleVisibleChange = useCallback(function (visible) {
|
|
86
74
|
setSettingsVisible(visible);
|
|
87
75
|
setTooltipVisible(false);
|
|
88
|
-
|
|
89
76
|
if (!visible && innerValue && innerPeriod) {
|
|
90
77
|
var newValue = maxValue && maxValue < parseFloat("" + innerValue) ? maxValue : innerValue;
|
|
91
78
|
onSetValue({
|
|
@@ -108,7 +95,6 @@ var CompletedWithin = function CompletedWithin(_ref) {
|
|
|
108
95
|
}, [hasValue, placeholder]);
|
|
109
96
|
var triggerLabel = useMemo(function () {
|
|
110
97
|
var _getPeriods$find;
|
|
111
|
-
|
|
112
98
|
return hasValue ? texts.completedLabel + " " + value.value + " " + ((_getPeriods$find = getPeriods.find(function (singlePeriod) {
|
|
113
99
|
return singlePeriod.value === value.period;
|
|
114
100
|
})) == null ? void 0 : _getPeriods$find.label) : placeholder;
|
|
@@ -162,5 +148,4 @@ var CompletedWithin = function CompletedWithin(_ref) {
|
|
|
162
148
|
component: /*#__PURE__*/React.createElement(Close3S, null)
|
|
163
149
|
}))));
|
|
164
150
|
};
|
|
165
|
-
|
|
166
151
|
export default CompletedWithin;
|
|
@@ -3,15 +3,14 @@ import { InputGroup } from '@synerise/ds-input';
|
|
|
3
3
|
import InputNumber from '@synerise/ds-input-number';
|
|
4
4
|
import Select from '@synerise/ds-select';
|
|
5
5
|
import * as S from './Settings.styles';
|
|
6
|
-
|
|
7
6
|
var Settings = function Settings(_ref) {
|
|
8
7
|
var value = _ref.value,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
text = _ref.text,
|
|
9
|
+
onPeriodChange = _ref.onPeriodChange,
|
|
10
|
+
onValueChange = _ref.onValueChange,
|
|
11
|
+
periods = _ref.periods,
|
|
12
|
+
maxValue = _ref.maxValue,
|
|
13
|
+
readOnly = _ref.readOnly;
|
|
15
14
|
return /*#__PURE__*/React.createElement(S.Settings, {
|
|
16
15
|
"data-testid": "completed-within-dropdown"
|
|
17
16
|
}, /*#__PURE__*/React.createElement(InputGroup, {
|
|
@@ -31,7 +30,8 @@ var Settings = function Settings(_ref) {
|
|
|
31
30
|
readOnly: readOnly,
|
|
32
31
|
size: 'default',
|
|
33
32
|
value: value.period,
|
|
34
|
-
placeholder: text.periodPlaceholder
|
|
33
|
+
placeholder: text.periodPlaceholder
|
|
34
|
+
// @ts-ignore
|
|
35
35
|
,
|
|
36
36
|
onChange: function onChange(option) {
|
|
37
37
|
onPeriodChange(option);
|
|
@@ -46,5 +46,4 @@ var Settings = function Settings(_ref) {
|
|
|
46
46
|
}, period.label);
|
|
47
47
|
}))));
|
|
48
48
|
};
|
|
49
|
-
|
|
50
49
|
export default Settings;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
import { InputGroupWrapper } from '@synerise/ds-input/dist/InputGroup.styles';
|
|
2
|
+
import { InputGroupWrapper } from '@synerise/ds-input/dist/InputGroup.styles';
|
|
3
3
|
|
|
4
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
4
5
|
export var Settings = styled.div.withConfig({
|
|
5
6
|
displayName: "Settingsstyles__Settings",
|
|
6
7
|
componentId: "sc-11xtzjt-0"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-completed-within",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "CompletedWithin UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,13 +34,13 @@
|
|
|
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.67.
|
|
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.
|
|
37
|
+
"@synerise/ds-button": "^0.21.20",
|
|
38
|
+
"@synerise/ds-dropdown": "^0.18.25",
|
|
39
|
+
"@synerise/ds-icon": "^0.67.1",
|
|
40
|
+
"@synerise/ds-input": "^0.24.15",
|
|
41
|
+
"@synerise/ds-input-number": "^0.10.16",
|
|
42
|
+
"@synerise/ds-select": "^0.16.27",
|
|
43
|
+
"@synerise/ds-tooltip": "^0.14.50",
|
|
44
44
|
"@synerise/ds-utils": "^0.31.2"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
51
51
|
"styled-components": "5.0.1"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "4a56ee7ef816c22341ce704154dc7aa65b7d1dcc"
|
|
54
54
|
}
|