@ultraviolet/plus 0.5.6 → 0.5.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/dist/index.d.ts
CHANGED
|
@@ -216,7 +216,7 @@ declare const EstimateCost: {
|
|
|
216
216
|
({ description, alert, alertVariant, defaultTimeUnit, timeUnits, hideOverlay, disableOverlayLeft, disableOverlayRight, hideTimeUnit, hideTotal, discount, OverlayRight, OverlayLeft, isBeta, commitmentFees, commitmentFeesContent, monthlyFees, monthlyFeesLabel, monthlyFeesContent, overlayUnit, children, locales, numberLocales, currency, }: EstimateCostProps): _emotion_react_jsx_runtime.JSX.Element;
|
|
217
217
|
LineThrough: _emotion_styled.StyledComponent<{
|
|
218
218
|
theme?: _emotion_react.Theme | undefined;
|
|
219
|
-
as?: react.ElementType<any> | undefined;
|
|
219
|
+
as?: react.ElementType<any, keyof react.JSX.IntrinsicElements> | undefined;
|
|
220
220
|
} & {
|
|
221
221
|
isActive?: boolean | undefined;
|
|
222
222
|
}, react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
@@ -284,7 +284,7 @@ declare const EstimateCost: {
|
|
|
284
284
|
}) => _emotion_react_jsx_runtime.JSX.Element | null;
|
|
285
285
|
Image: _emotion_styled.StyledComponent<{
|
|
286
286
|
theme?: _emotion_react.Theme | undefined;
|
|
287
|
-
as?: react.ElementType<any> | undefined;
|
|
287
|
+
as?: react.ElementType<any, keyof react.JSX.IntrinsicElements> | undefined;
|
|
288
288
|
}, react.DetailedHTMLProps<react.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
289
289
|
Region: ({ label, image, shouldBeHidden, priceText, animated, isFirstElement, isLastElement, productsCallback, iteration, discount, noBorder, noPrice, }: {
|
|
290
290
|
shouldBeHidden?: boolean | undefined;
|
|
@@ -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.8",
|
|
4
4
|
"description": "Ultraviolet Plus",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@emotion/babel-plugin": "11.11.0",
|
|
44
44
|
"@emotion/react": "11.11.1",
|
|
45
45
|
"@emotion/styled": "11.11.0",
|
|
46
|
-
"@types/react": "18.2.
|
|
47
|
-
"@types/react-dom": "18.2.
|
|
46
|
+
"@types/react": "18.2.45",
|
|
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.3"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@uiw/codemirror-extensions-langs": "4.21.21",
|
|
@@ -55,8 +55,8 @@
|
|
|
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.2"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "rollup -c ../../rollup.config.mjs"
|