@ultraviolet/plus 0.5.7 → 0.5.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.
|
@@ -36,11 +36,9 @@ const Unit = ({
|
|
|
36
36
|
children: jsx(Regular, {
|
|
37
37
|
children: capacity
|
|
38
38
|
})
|
|
39
|
-
}) :
|
|
40
|
-
// 120px is arbitrary, just to avoid full width input (ugly) nor too small input.
|
|
41
|
-
jsx("div", {
|
|
39
|
+
}) : jsx("div", {
|
|
42
40
|
style: {
|
|
43
|
-
width: '
|
|
41
|
+
width: '150px'
|
|
44
42
|
},
|
|
45
43
|
children: jsx(StyledTextInput, {
|
|
46
44
|
type: "number",
|
|
@@ -44,6 +44,7 @@ const UnitInput = ({
|
|
|
44
44
|
size = 'medium',
|
|
45
45
|
placeholder = '0',
|
|
46
46
|
onChange,
|
|
47
|
+
onBlur,
|
|
47
48
|
onChangeUnitValue,
|
|
48
49
|
value,
|
|
49
50
|
unitValue,
|
|
@@ -73,9 +74,19 @@ const UnitInput = ({
|
|
|
73
74
|
value: value,
|
|
74
75
|
placeholder: placeholder,
|
|
75
76
|
onChange: input => {
|
|
76
|
-
const numericValue =
|
|
77
|
+
const numericValue = parseInt(input, 10);
|
|
77
78
|
onChange(numericValue);
|
|
78
79
|
},
|
|
80
|
+
onBlur: event => {
|
|
81
|
+
const numericValue = parseInt(event.target.value, 10);
|
|
82
|
+
if (Number.isNaN(numericValue) || numericValue < minValue) {
|
|
83
|
+
onChange(minValue);
|
|
84
|
+
}
|
|
85
|
+
if (numericValue > maxValue) {
|
|
86
|
+
onChange(maxValue);
|
|
87
|
+
}
|
|
88
|
+
onBlur?.(event);
|
|
89
|
+
},
|
|
79
90
|
className: className,
|
|
80
91
|
disabled: disabled,
|
|
81
92
|
notice: notice,
|
|
@@ -10,7 +10,8 @@ const calculatePrice = ({
|
|
|
10
10
|
timeAmount,
|
|
11
11
|
discount = 0
|
|
12
12
|
}) => {
|
|
13
|
-
const
|
|
13
|
+
const nonNanTimeAmount = Number.isNaN(timeAmount) ? 0 : timeAmount;
|
|
14
|
+
const value = (price - price * discount) * (nonNanTimeAmount * multiplier[`${timeUnit}`]) * Math.max(amount - amountFree, 0);
|
|
14
15
|
|
|
15
16
|
// Avoid having negative price in any cases
|
|
16
17
|
if (value < 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/plus",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "Ultraviolet Plus",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -33,21 +33,21 @@
|
|
|
33
33
|
"default": "./dist/src/index.js"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@emotion/react": "11.11.
|
|
36
|
+
"@emotion/react": "11.11.3",
|
|
37
37
|
"@emotion/styled": "11.11.0",
|
|
38
38
|
"react": "18.2.0",
|
|
39
39
|
"react-dom": "18.2.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@babel/core": "7.23.
|
|
42
|
+
"@babel/core": "7.23.7",
|
|
43
43
|
"@emotion/babel-plugin": "11.11.0",
|
|
44
|
-
"@emotion/react": "11.11.
|
|
44
|
+
"@emotion/react": "11.11.3",
|
|
45
45
|
"@emotion/styled": "11.11.0",
|
|
46
46
|
"@types/react": "18.2.45",
|
|
47
47
|
"@types/react-dom": "18.2.18",
|
|
48
48
|
"react": "18.2.0",
|
|
49
49
|
"react-dom": "18.2.0",
|
|
50
|
-
"@ultraviolet/icons": "2.7.
|
|
50
|
+
"@ultraviolet/icons": "2.7.4"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@uiw/codemirror-extensions-langs": "4.21.21",
|
|
@@ -55,10 +55,11 @@
|
|
|
55
55
|
"@uiw/react-codemirror": "4.21.21",
|
|
56
56
|
"react-flatten-children": "1.1.2",
|
|
57
57
|
"react-intersection-observer": "9.5.3",
|
|
58
|
-
"@ultraviolet/themes": "1.
|
|
59
|
-
"@ultraviolet/ui": "1.29.
|
|
58
|
+
"@ultraviolet/themes": "1.6.0",
|
|
59
|
+
"@ultraviolet/ui": "1.29.3"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
|
-
"build": "rollup -c ../../rollup.config.mjs"
|
|
62
|
+
"build": "rollup -c ../../rollup.config.mjs",
|
|
63
|
+
"typecheck": "tsc --noEmit"
|
|
63
64
|
}
|
|
64
65
|
}
|