@synerise/ds-completed-within 0.7.7 → 0.7.8

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,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.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)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-completed-within
9
+
10
+
11
+
12
+
13
+
6
14
  ## [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
15
 
8
16
  **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.FC<CompletedWithinProps>;
4
+ declare const CompletedWithin: ({ value, maxValue, onSetValue, text, periods, placeholder, tooltip, readOnly, }: CompletedWithinProps) => React.JSX.Element;
5
5
  export default CompletedWithin;
@@ -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 = React.useMemo(function () {
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 = React.useMemo(function () {
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 _React$useState = React.useState(value.value),
63
- innerValue = _React$useState[0],
64
- setInnerValue = _React$useState[1];
62
+ var _useState = useState(value.value),
63
+ innerValue = _useState[0],
64
+ setInnerValue = _useState[1];
65
65
 
66
- var _React$useState2 = React.useState(value.period),
67
- innerPeriod = _React$useState2[0],
68
- setInnerPeriod = _React$useState2[1];
66
+ var _useState2 = useState(value.period),
67
+ innerPeriod = _useState2[0],
68
+ setInnerPeriod = _useState2[1];
69
69
 
70
- var _React$useState3 = React.useState(false),
71
- tooltipVisible = _React$useState3[0],
72
- setTooltipVisible = _React$useState3[1];
70
+ var _useState3 = useState(false),
71
+ tooltipVisible = _useState3[0],
72
+ setTooltipVisible = _useState3[1];
73
73
 
74
- var _React$useState4 = React.useState(false),
75
- settingsVisible = _React$useState4[0],
76
- setSettingsVisible = _React$useState4[1];
74
+ var _useState4 = useState(false),
75
+ settingsVisible = _useState4[0],
76
+ setSettingsVisible = _useState4[1];
77
77
 
78
- var hasValue = React.useMemo(function () {
78
+ var hasValue = useMemo(function () {
79
79
  return value.value !== undefined && value.value > 0;
80
80
  }, [value]);
81
- var handleVisibleChange = React.useCallback(function (visible) {
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 = React.useCallback(function () {
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 = React.useMemo(function () {
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 = React.useMemo(function () {
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.7",
3
+ "version": "0.7.8",
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.14",
38
- "@synerise/ds-dropdown": "^0.18.19",
39
- "@synerise/ds-icon": "^0.66.0",
40
- "@synerise/ds-input": "^0.24.9",
41
- "@synerise/ds-input-number": "^0.10.10",
42
- "@synerise/ds-select": "^0.16.21",
43
- "@synerise/ds-tooltip": "^0.14.44",
44
- "@synerise/ds-utils": "^0.30.0",
37
+ "@synerise/ds-button": "^0.21.15",
38
+ "@synerise/ds-dropdown": "^0.18.20",
39
+ "@synerise/ds-icon": "^0.66.1",
40
+ "@synerise/ds-input": "^0.24.10",
41
+ "@synerise/ds-input-number": "^0.10.11",
42
+ "@synerise/ds-select": "^0.16.22",
43
+ "@synerise/ds-tooltip": "^0.14.45",
44
+ "@synerise/ds-utils": "^0.30.1",
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": "c45f411bd0eac69ae70b6c948da1c530539b01d6"
53
+ "gitHead": "fbadaa2299668c527b52ecc66d61fc2165528bff"
54
54
  }