@ultraviolet/plus 3.0.0-beta.14 → 3.0.0-beta.16
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/components/ContentCard/styles.css.js +0 -1
- package/dist/components/EstimateCost/Components/components.css.js +1 -0
- package/dist/components/InfoTable/components/Cell.js +2 -2
- package/dist/components/InfoTable/styles.css.d.ts +1 -0
- package/dist/components/InfoTable/styles.css.js +2 -0
- package/dist/components/OfferList/OfferList.d.ts +1 -0
- package/dist/components/OfferList/components/Row.d.ts +1 -0
- package/dist/components/OfferList/components/Row.js +1 -1
- package/dist/components/Plans/styles.css.js +1 -0
- package/dist/components/SteppedListCard/Step.d.ts +6 -1
- package/dist/components/SteppedListCard/Step.js +2 -1
- package/dist/components/SteppedListCard/SteppedListCard.d.ts +5 -2
- package/dist/components/SteppedListCard/SteppedListCard.js +10 -6
- package/dist/components/SteppedListCard/SteppedListContent.d.ts +1 -1
- package/dist/components/SteppedListCard/helper.d.ts +1 -1
- package/dist/components/SteppedListCard/helper.js +2 -1
- package/dist/components/SteppedListCard/styles.css.d.ts +1 -0
- package/dist/components/SteppedListCard/styles.css.js +2 -0
- package/dist/plus.css +1 -1
- package/package.json +8 -12
- package/dist/components/CodeEditor/CodeEditor.cjs +0 -50
- package/dist/components/CodeEditor/styles.css.cjs +0 -9
- package/dist/components/ContentCard/Skeleton.cjs +0 -23
- package/dist/components/ContentCard/index.cjs +0 -62
- package/dist/components/ContentCard/styles.css.cjs +0 -28
- package/dist/components/ContentCardGroup/Card.cjs +0 -30
- package/dist/components/ContentCardGroup/SkeletonCard.cjs +0 -15
- package/dist/components/ContentCardGroup/index.cjs +0 -18
- package/dist/components/ContentCardGroup/styles.css.cjs +0 -17
- package/dist/components/Conversation/index.cjs +0 -42
- package/dist/components/Conversation/styles.css.cjs +0 -17
- package/dist/components/CustomerSatisfaction/assets/1-5.svg.cjs +0 -3
- package/dist/components/CustomerSatisfaction/assets/1-5NB.svg.cjs +0 -3
- package/dist/components/CustomerSatisfaction/assets/2-5.svg.cjs +0 -3
- package/dist/components/CustomerSatisfaction/assets/2-5NB.svg.cjs +0 -3
- package/dist/components/CustomerSatisfaction/assets/3-5.svg.cjs +0 -3
- package/dist/components/CustomerSatisfaction/assets/3-5NB.svg.cjs +0 -3
- package/dist/components/CustomerSatisfaction/assets/4-5.svg.cjs +0 -3
- package/dist/components/CustomerSatisfaction/assets/4-5NB.svg.cjs +0 -3
- package/dist/components/CustomerSatisfaction/assets/5-5.svg.cjs +0 -3
- package/dist/components/CustomerSatisfaction/assets/5-5NB.svg.cjs +0 -3
- package/dist/components/CustomerSatisfaction/index.cjs +0 -66
- package/dist/components/CustomerSatisfaction/styles.css.cjs +0 -6
- package/dist/components/EstimateCost/Components/CustomUnitInput.cjs +0 -34
- package/dist/components/EstimateCost/Components/Item.cjs +0 -221
- package/dist/components/EstimateCost/Components/LineThrough.cjs +0 -11
- package/dist/components/EstimateCost/Components/NumberInput.cjs +0 -31
- package/dist/components/EstimateCost/Components/Region.cjs +0 -34
- package/dist/components/EstimateCost/Components/Regular.cjs +0 -23
- package/dist/components/EstimateCost/Components/Strong.cjs +0 -16
- package/dist/components/EstimateCost/Components/Unit.cjs +0 -36
- package/dist/components/EstimateCost/Components/Zone.cjs +0 -33
- package/dist/components/EstimateCost/Components/components.css.cjs +0 -123
- package/dist/components/EstimateCost/EstimateCost.cjs +0 -86
- package/dist/components/EstimateCost/EstimateCostContent.cjs +0 -206
- package/dist/components/EstimateCost/EstimateCostProvider.cjs +0 -37
- package/dist/components/EstimateCost/OverlayComponent.cjs +0 -85
- package/dist/components/EstimateCost/OverlayContext.cjs +0 -15
- package/dist/components/EstimateCost/constants.cjs +0 -28
- package/dist/components/EstimateCost/helper.cjs +0 -16
- package/dist/components/EstimateCost/locales/en.cjs +0 -23
- package/dist/components/EstimateCost/styles.css.cjs +0 -50
- package/dist/components/FAQ/index.cjs +0 -49
- package/dist/components/FAQ/styles.css.cjs +0 -5
- package/dist/components/InfoTable/InfoTable.cjs +0 -20
- package/dist/components/InfoTable/components/Cell.cjs +0 -16
- package/dist/components/InfoTable/components/Row.cjs +0 -25
- package/dist/components/InfoTable/context.cjs +0 -5
- package/dist/components/InfoTable/styles.css.cjs +0 -15
- package/dist/components/Navigation/Footer.cjs +0 -56
- package/dist/components/Navigation/Header.cjs +0 -18
- package/dist/components/Navigation/Navigation.cjs +0 -18
- package/dist/components/Navigation/NavigationContent.cjs +0 -112
- package/dist/components/Navigation/NavigationProvider.cjs +0 -129
- package/dist/components/Navigation/components/Group.cjs +0 -37
- package/dist/components/Navigation/components/Item.cjs +0 -277
- package/dist/components/Navigation/components/ItemProvider.cjs +0 -14
- package/dist/components/Navigation/components/PinnedItems.cjs +0 -80
- package/dist/components/Navigation/components/Separator.cjs +0 -8
- package/dist/components/Navigation/components/items.css.cjs +0 -47
- package/dist/components/Navigation/components/styles.css.cjs +0 -17
- package/dist/components/Navigation/constants.cjs +0 -10
- package/dist/components/Navigation/locales/en.cjs +0 -11
- package/dist/components/Navigation/styles.css.cjs +0 -23
- package/dist/components/Navigation/variables.css.cjs +0 -4
- package/dist/components/OfferList/OfferList.cjs +0 -45
- package/dist/components/OfferList/OfferListProvider.cjs +0 -38
- package/dist/components/OfferList/components/Banner.cjs +0 -21
- package/dist/components/OfferList/components/Cell.cjs +0 -20
- package/dist/components/OfferList/components/Row.cjs +0 -113
- package/dist/components/OfferList/styles.css.cjs +0 -38
- package/dist/components/OrderSummary/NonScrollableContent.cjs +0 -56
- package/dist/components/OrderSummary/Provider.cjs +0 -18
- package/dist/components/OrderSummary/ScrollableContent.cjs +0 -73
- package/dist/components/OrderSummary/constants.cjs +0 -12
- package/dist/components/OrderSummary/helpers.cjs +0 -91
- package/dist/components/OrderSummary/index.cjs +0 -102
- package/dist/components/OrderSummary/locales/en.cjs +0 -11
- package/dist/components/OrderSummary/styles.css.cjs +0 -19
- package/dist/components/Plans/FeatureHint.cjs +0 -24
- package/dist/components/Plans/PlanHeader.cjs +0 -42
- package/dist/components/Plans/index.cjs +0 -102
- package/dist/components/Plans/locales/en.cjs +0 -7
- package/dist/components/Plans/styles.css.cjs +0 -26
- package/dist/components/SteppedListCard/Step.cjs +0 -20
- package/dist/components/SteppedListCard/SteppedListCard.cjs +0 -54
- package/dist/components/SteppedListCard/SteppedListContent.cjs +0 -51
- package/dist/components/SteppedListCard/helper.cjs +0 -38
- package/dist/components/SteppedListCard/styles.css.cjs +0 -17
- package/dist/index.cjs +0 -33
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const react = require("react");
|
|
6
|
-
const EstimateCostProvider = require("../EstimateCostProvider.cjs");
|
|
7
|
-
const styles_css = require("../styles.css.cjs");
|
|
8
|
-
const Item = require("./Item.cjs");
|
|
9
|
-
const Strong = require("./Strong.cjs");
|
|
10
|
-
const Region = react.memo(({
|
|
11
|
-
label,
|
|
12
|
-
image,
|
|
13
|
-
shouldBeHidden = false,
|
|
14
|
-
priceText,
|
|
15
|
-
animated = false,
|
|
16
|
-
isFirstElement,
|
|
17
|
-
isLastElement,
|
|
18
|
-
productsCallback,
|
|
19
|
-
iteration,
|
|
20
|
-
discount,
|
|
21
|
-
noBorder,
|
|
22
|
-
noPrice,
|
|
23
|
-
hideFromOverlay,
|
|
24
|
-
style
|
|
25
|
-
}) => {
|
|
26
|
-
const {
|
|
27
|
-
locales
|
|
28
|
-
} = EstimateCostProvider.useEstimateCost();
|
|
29
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Item.Item, { animated, discount, hideFromOverlay, isFirstElement, isLastElement, iteration, label: locales["estimate.cost.region.label"], noBorder, noPrice, priceText, productsCallback, shouldBeHidden, style, children: /* @__PURE__ */ jsxRuntime.jsxs(Strong.Strong, { children: [
|
|
30
|
-
/* @__PURE__ */ jsxRuntime.jsx("img", { alt: label, className: styles_css.estimateCostImage, src: image }),
|
|
31
|
-
label
|
|
32
|
-
] }) });
|
|
33
|
-
});
|
|
34
|
-
exports.Region = Region;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const react = require("react");
|
|
6
|
-
const OverlayContext = require("../OverlayContext.cjs");
|
|
7
|
-
const components_css = require("./components.css.cjs");
|
|
8
|
-
const Regular = react.memo(({
|
|
9
|
-
variant = "normal",
|
|
10
|
-
isDisabledOnOverlay = false,
|
|
11
|
-
children = null,
|
|
12
|
-
className,
|
|
13
|
-
style
|
|
14
|
-
}) => {
|
|
15
|
-
const {
|
|
16
|
-
isOverlay
|
|
17
|
-
} = OverlayContext.useOverlay();
|
|
18
|
-
return !isDisabledOnOverlay || !isOverlay ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${className ? `${className} ` : ""}${components_css.estimateCostRegular({
|
|
19
|
-
isOverlay,
|
|
20
|
-
variant
|
|
21
|
-
})}`, style, children }) : null;
|
|
22
|
-
});
|
|
23
|
-
exports.Regular = Regular;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const react = require("react");
|
|
6
|
-
const components_css = require("./components.css.cjs");
|
|
7
|
-
const Strong = react.memo(({
|
|
8
|
-
variant = "normal",
|
|
9
|
-
children = null,
|
|
10
|
-
style
|
|
11
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${components_css.estimateCostRegular({
|
|
12
|
-
variant
|
|
13
|
-
})} ${components_css.estimateCostStrong({
|
|
14
|
-
variant
|
|
15
|
-
})}`, style, children }));
|
|
16
|
-
exports.Strong = Strong;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const ui = require("@ultraviolet/ui");
|
|
6
|
-
const react = require("react");
|
|
7
|
-
const OverlayContext = require("../OverlayContext.cjs");
|
|
8
|
-
const components_css = require("./components.css.cjs");
|
|
9
|
-
const Regular = require("./Regular.cjs");
|
|
10
|
-
const Unit = ({
|
|
11
|
-
amount,
|
|
12
|
-
itemCallback,
|
|
13
|
-
getAmountValue,
|
|
14
|
-
unit,
|
|
15
|
-
style
|
|
16
|
-
}) => {
|
|
17
|
-
const {
|
|
18
|
-
isOverlay
|
|
19
|
-
} = OverlayContext.useOverlay();
|
|
20
|
-
const [capacity, setCapacity] = react.useState(amount === 0 ? void 0 : amount);
|
|
21
|
-
react.useEffect(() => {
|
|
22
|
-
setCapacity(amount);
|
|
23
|
-
itemCallback?.(amount, true);
|
|
24
|
-
getAmountValue?.(amount);
|
|
25
|
-
}, [getAmountValue, itemCallback, capacity, amount]);
|
|
26
|
-
return isOverlay ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: components_css.estimateCostItemResourceName(), style, children: /* @__PURE__ */ jsxRuntime.jsx(Regular.Regular, { children: capacity }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
|
|
27
|
-
width: "150px",
|
|
28
|
-
...style
|
|
29
|
-
}, children: /* @__PURE__ */ jsxRuntime.jsx(ui.NumberInput, { className: components_css.estimateCostNumberInput, controls: false, name: "capacity", onChange: (capacityText) => {
|
|
30
|
-
const newCapacity = Number(capacityText) < 0 ? 0 : Number(capacityText);
|
|
31
|
-
setCapacity(newCapacity);
|
|
32
|
-
itemCallback?.(newCapacity, true);
|
|
33
|
-
getAmountValue?.(capacity);
|
|
34
|
-
}, placeholder: "00", size: "small", unit, value: capacity }) });
|
|
35
|
-
};
|
|
36
|
-
exports.Unit = Unit;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const react = require("react");
|
|
6
|
-
const EstimateCostProvider = require("../EstimateCostProvider.cjs");
|
|
7
|
-
const styles_css = require("../styles.css.cjs");
|
|
8
|
-
const Item = require("./Item.cjs");
|
|
9
|
-
const Strong = require("./Strong.cjs");
|
|
10
|
-
const Zone = react.memo(({
|
|
11
|
-
label,
|
|
12
|
-
image,
|
|
13
|
-
shouldBeHidden = false,
|
|
14
|
-
priceText,
|
|
15
|
-
animated = false,
|
|
16
|
-
isFirstElement,
|
|
17
|
-
isLastElement,
|
|
18
|
-
productsCallback,
|
|
19
|
-
iteration,
|
|
20
|
-
discount,
|
|
21
|
-
noBorder,
|
|
22
|
-
noPrice,
|
|
23
|
-
style
|
|
24
|
-
}) => {
|
|
25
|
-
const {
|
|
26
|
-
locales
|
|
27
|
-
} = EstimateCostProvider.useEstimateCost();
|
|
28
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Item.Item, { animated, discount, isFirstElement, isLastElement, iteration, label: locales["estimate.cost.az.label"], noBorder, noPrice, priceText, productsCallback, shouldBeHidden, style, children: /* @__PURE__ */ jsxRuntime.jsxs(Strong.Strong, { children: [
|
|
29
|
-
/* @__PURE__ */ jsxRuntime.jsx("img", { alt: label, className: styles_css.estimateCostImage, src: image }),
|
|
30
|
-
label
|
|
31
|
-
] }) });
|
|
32
|
-
});
|
|
33
|
-
exports.Zone = Zone;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
;/* empty css */
|
|
4
|
-
;/* empty css */
|
|
5
|
-
;/* empty css */
|
|
6
|
-
;/* empty css */
|
|
7
|
-
;/* empty css */
|
|
8
|
-
;/* empty css */
|
|
9
|
-
;/* empty css */
|
|
10
|
-
;/* empty css */
|
|
11
|
-
;/* empty css */
|
|
12
|
-
;/* empty css */
|
|
13
|
-
;/* empty css */
|
|
14
|
-
;/* empty css */
|
|
15
|
-
;/* empty css */
|
|
16
|
-
;/* empty css */
|
|
17
|
-
;/* empty css */
|
|
18
|
-
;/* empty css */
|
|
19
|
-
;/* empty css */
|
|
20
|
-
;/* empty css */
|
|
21
|
-
;/* empty css */
|
|
22
|
-
;/* empty css */
|
|
23
|
-
;/* empty css */
|
|
24
|
-
;/* empty css */
|
|
25
|
-
;/* empty css */
|
|
26
|
-
;/* empty css */
|
|
27
|
-
;/* empty css */
|
|
28
|
-
;/* empty css */
|
|
29
|
-
;/* empty css */
|
|
30
|
-
;/* empty css */
|
|
31
|
-
;/* empty css */
|
|
32
|
-
;/* empty css */
|
|
33
|
-
;/* empty css */
|
|
34
|
-
;/* empty css */
|
|
35
|
-
;/* empty css */
|
|
36
|
-
;/* empty css */
|
|
37
|
-
;/* empty css */
|
|
38
|
-
;/* empty css */
|
|
39
|
-
;/* empty css */
|
|
40
|
-
;/* empty css */
|
|
41
|
-
;/* empty css */
|
|
42
|
-
;/* empty css */
|
|
43
|
-
;/* empty css */
|
|
44
|
-
;/* empty css */
|
|
45
|
-
;/* empty css */
|
|
46
|
-
;/* empty css */
|
|
47
|
-
;/* empty css */
|
|
48
|
-
;/* empty css */
|
|
49
|
-
;/* empty css */
|
|
50
|
-
;/* empty css */
|
|
51
|
-
;/* empty css */
|
|
52
|
-
;/* empty css */
|
|
53
|
-
;/* empty css */
|
|
54
|
-
;/* empty css */
|
|
55
|
-
;/* empty css */
|
|
56
|
-
;/* empty css */
|
|
57
|
-
;/* empty css */
|
|
58
|
-
;/* empty css */
|
|
59
|
-
;/* empty css */
|
|
60
|
-
;/* empty css */
|
|
61
|
-
;/* empty css */
|
|
62
|
-
;/* empty css */
|
|
63
|
-
;/* empty css */
|
|
64
|
-
;/* empty css */
|
|
65
|
-
;/* empty css */
|
|
66
|
-
;/* empty css */
|
|
67
|
-
;/* empty css */
|
|
68
|
-
;/* empty css */
|
|
69
|
-
;/* empty css */
|
|
70
|
-
;/* empty css */
|
|
71
|
-
;/* empty css */
|
|
72
|
-
;/* empty css */
|
|
73
|
-
;/* empty css */
|
|
74
|
-
;/* empty css */
|
|
75
|
-
;/* empty css */
|
|
76
|
-
;/* empty css */
|
|
77
|
-
;/* empty css */
|
|
78
|
-
;/* empty css */
|
|
79
|
-
;/* empty css */
|
|
80
|
-
;/* empty css */
|
|
81
|
-
;/* empty css */
|
|
82
|
-
;/* empty css */
|
|
83
|
-
;/* empty css */
|
|
84
|
-
;/* empty css */
|
|
85
|
-
;/* empty css */
|
|
86
|
-
;/* empty css */
|
|
87
|
-
;/* empty css */
|
|
88
|
-
;/* empty css */
|
|
89
|
-
;/* empty css */
|
|
90
|
-
;/* empty css */
|
|
91
|
-
;/* empty css */
|
|
92
|
-
;/* empty css */
|
|
93
|
-
const createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
94
|
-
var maxWidthTextVar = "var(--uv_plus_1ko5kn20)";
|
|
95
|
-
var maxWidthText = "uv_plus_1ko5kn21";
|
|
96
|
-
var estimateCostTr = "uv_plus_1ko5kn23";
|
|
97
|
-
var styledDiv = "uv_plus_1ko5kn24";
|
|
98
|
-
var estimateCostLeftSide = "uv_plus_1ko5kn25";
|
|
99
|
-
var estimateCostItemResourceName = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_plus_1ko5kn26", variantClassNames: { animated: { true: "uv_plus_1ko5kn27" } }, defaultVariants: { animated: false }, compoundVariants: [] });
|
|
100
|
-
var estimateCostResourceName = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_plus_1ko5kn28", variantClassNames: { isOverlay: { true: "uv_plus_1ko5kn29", false: "uv_plus_1ko5kn2a" }, isAnimated: { true: "uv_plus_1ko5kn2b" } }, defaultVariants: { isAnimated: false, isOverlay: false }, compoundVariants: [] });
|
|
101
|
-
var estimateCostBadgeItem = "uv_plus_1ko5kn2c";
|
|
102
|
-
var estimateCostTextItem = "uv_plus_1ko5kn2d";
|
|
103
|
-
var estimateCostMaxWidthText = "uv_plus_1ko5kn2e";
|
|
104
|
-
var estimateCostTooltip = "uv_plus_1ko5kn2f";
|
|
105
|
-
var estimateCostLineThrough = "uv_plus_1ko5kn2g";
|
|
106
|
-
var estimateCostRegular = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_plus_1ko5kn2h", variantClassNames: { isOverlay: { true: "uv_plus_1ko5kn2i", false: "uv_plus_1ko5kn2j" }, variant: { normal: "uv_plus_1ko5kn2k", big: "uv_plus_1ko5kn2l", capitalized: "uv_plus_1ko5kn2m", small: "uv_plus_1ko5kn2n" } }, defaultVariants: { isOverlay: false, variant: "normal" }, compoundVariants: [] });
|
|
107
|
-
var estimateCostStrong = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_plus_1ko5kn2o", variantClassNames: { variant: { normal: "uv_plus_1ko5kn2p", big: "uv_plus_1ko5kn2q", capitalized: "uv_plus_1ko5kn2r", small: "uv_plus_1ko5kn2s" } }, defaultVariants: { variant: "normal" }, compoundVariants: [] });
|
|
108
|
-
var estimateCostNumberInput = "uv_plus_1ko5kn2t";
|
|
109
|
-
exports.estimateCostBadgeItem = estimateCostBadgeItem;
|
|
110
|
-
exports.estimateCostItemResourceName = estimateCostItemResourceName;
|
|
111
|
-
exports.estimateCostLeftSide = estimateCostLeftSide;
|
|
112
|
-
exports.estimateCostLineThrough = estimateCostLineThrough;
|
|
113
|
-
exports.estimateCostMaxWidthText = estimateCostMaxWidthText;
|
|
114
|
-
exports.estimateCostNumberInput = estimateCostNumberInput;
|
|
115
|
-
exports.estimateCostRegular = estimateCostRegular;
|
|
116
|
-
exports.estimateCostResourceName = estimateCostResourceName;
|
|
117
|
-
exports.estimateCostStrong = estimateCostStrong;
|
|
118
|
-
exports.estimateCostTextItem = estimateCostTextItem;
|
|
119
|
-
exports.estimateCostTooltip = estimateCostTooltip;
|
|
120
|
-
exports.estimateCostTr = estimateCostTr;
|
|
121
|
-
exports.maxWidthText = maxWidthText;
|
|
122
|
-
exports.maxWidthTextVar = maxWidthTextVar;
|
|
123
|
-
exports.styledDiv = styledDiv;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const ui = require("@ultraviolet/ui");
|
|
6
|
-
const dynamic = require("@vanilla-extract/dynamic");
|
|
7
|
-
const react = require("react");
|
|
8
|
-
const components_css = require("./Components/components.css.cjs");
|
|
9
|
-
const Item = require("./Components/Item.cjs");
|
|
10
|
-
const LineThrough = require("./Components/LineThrough.cjs");
|
|
11
|
-
const NumberInput = require("./Components/NumberInput.cjs");
|
|
12
|
-
const Region = require("./Components/Region.cjs");
|
|
13
|
-
const Regular = require("./Components/Regular.cjs");
|
|
14
|
-
const Strong = require("./Components/Strong.cjs");
|
|
15
|
-
const Unit = require("./Components/Unit.cjs");
|
|
16
|
-
const Zone = require("./Components/Zone.cjs");
|
|
17
|
-
const EstimateCostContent = require("./EstimateCostContent.cjs");
|
|
18
|
-
const EstimateCostProvider = require("./EstimateCostProvider.cjs");
|
|
19
|
-
const en = require("./locales/en.cjs");
|
|
20
|
-
const OverlayContext = require("./OverlayContext.cjs");
|
|
21
|
-
const styles_css = require("./styles.css.cjs");
|
|
22
|
-
const DEFAULT_UNIT_LIST = ["hours", "days", "months"];
|
|
23
|
-
const Image = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
24
|
-
"img",
|
|
25
|
-
{
|
|
26
|
-
alt: props.alt,
|
|
27
|
-
...props,
|
|
28
|
-
className: `${props.className ? `${props.className} ` : ""}${styles_css.estimateCostImage}`
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
const EstimateCost = ({
|
|
32
|
-
description,
|
|
33
|
-
alert,
|
|
34
|
-
alertTitle,
|
|
35
|
-
alertVariant = "warning",
|
|
36
|
-
defaultTimeUnit = "hours",
|
|
37
|
-
timeUnits = DEFAULT_UNIT_LIST,
|
|
38
|
-
hideOverlay = false,
|
|
39
|
-
disableOverlayLeft = false,
|
|
40
|
-
disableOverlayRight = false,
|
|
41
|
-
hideTimeUnit = false,
|
|
42
|
-
hideTotal = false,
|
|
43
|
-
discount = 0,
|
|
44
|
-
OverlayRight,
|
|
45
|
-
OverlayLeft,
|
|
46
|
-
overlayMargin,
|
|
47
|
-
isBeta = false,
|
|
48
|
-
commitmentFees,
|
|
49
|
-
commitmentFeesContent,
|
|
50
|
-
monthlyFees,
|
|
51
|
-
monthlyFeesLabel,
|
|
52
|
-
monthlyFeesContent,
|
|
53
|
-
overlayUnit = "hours",
|
|
54
|
-
children = null,
|
|
55
|
-
locales = en,
|
|
56
|
-
numberLocales = "en-EN",
|
|
57
|
-
currency = "EUR",
|
|
58
|
-
style,
|
|
59
|
-
onTotalPriceChange
|
|
60
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(EstimateCostProvider.EstimateCostProvider, { currency, locales, numberLocales, children: /* @__PURE__ */ jsxRuntime.jsx(EstimateCostContent.EstimateCostContent, { alert, alertTitle, alertVariant, commitmentFees, commitmentFeesContent, defaultTimeUnit, description, disableOverlayLeft, disableOverlayRight, discount, hideOverlay, hideTimeUnit, hideTotal, isBeta, locales, monthlyFees, monthlyFeesContent, monthlyFeesLabel, OverlayLeft, OverlayRight, onTotalPriceChange, overlayMargin, overlayUnit, style, timeUnits, children }) });
|
|
61
|
-
EstimateCost.LineThrough = LineThrough.LineThrough;
|
|
62
|
-
EstimateCost.Item = Item.Item;
|
|
63
|
-
EstimateCost.NumberInput = NumberInput.NumberInput;
|
|
64
|
-
EstimateCost.Unit = Unit.Unit;
|
|
65
|
-
EstimateCost.Strong = Strong.Strong;
|
|
66
|
-
EstimateCost.Regular = Regular.Regular;
|
|
67
|
-
EstimateCost.Image = Image;
|
|
68
|
-
EstimateCost.Region = Region.Region;
|
|
69
|
-
EstimateCost.Zone = Zone.Zone;
|
|
70
|
-
const Ellipsis = ({
|
|
71
|
-
children,
|
|
72
|
-
maxWidth = 350,
|
|
73
|
-
"data-testid": dataTestId
|
|
74
|
-
}) => {
|
|
75
|
-
const {
|
|
76
|
-
isOverlay
|
|
77
|
-
} = OverlayContext.useOverlay();
|
|
78
|
-
const text = react.Children.toArray(children).join("").toString();
|
|
79
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": dataTestId, style: {
|
|
80
|
-
display: !isOverlay ? "inline-flex" : void 0
|
|
81
|
-
}, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "p", className: components_css.maxWidthText, oneLine: true, style: dynamic.assignInlineVars({
|
|
82
|
-
[components_css.maxWidthTextVar]: isOverlay ? "200px" : `${maxWidth}px`
|
|
83
|
-
}), variant: "bodyStrong", children: text }) });
|
|
84
|
-
};
|
|
85
|
-
EstimateCost.Ellipsis = Ellipsis;
|
|
86
|
-
exports.EstimateCost = EstimateCost;
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const icons = require("@ultraviolet/icons");
|
|
6
|
-
const ui = require("@ultraviolet/ui");
|
|
7
|
-
const dynamic = require("@vanilla-extract/dynamic");
|
|
8
|
-
const react = require("react");
|
|
9
|
-
const reactIntersectionObserver = require("react-intersection-observer");
|
|
10
|
-
const CustomUnitInput = require("./Components/CustomUnitInput.cjs");
|
|
11
|
-
const Item = require("./Components/Item.cjs");
|
|
12
|
-
const LineThrough = require("./Components/LineThrough.cjs");
|
|
13
|
-
const constants = require("./constants.cjs");
|
|
14
|
-
const EstimateCostProvider = require("./EstimateCostProvider.cjs");
|
|
15
|
-
const helper = require("./helper.cjs");
|
|
16
|
-
const en = require("./locales/en.cjs");
|
|
17
|
-
const OverlayComponent = require("./OverlayComponent.cjs");
|
|
18
|
-
const OverlayContext = require("./OverlayContext.cjs");
|
|
19
|
-
const styles_css = require("./styles.css.cjs");
|
|
20
|
-
const DEFAULT_UNIT_LIST = ["hours", "days", "months"];
|
|
21
|
-
const DescriptionComponent = react.memo(({
|
|
22
|
-
description,
|
|
23
|
-
locales
|
|
24
|
-
}) => description === void 0 || typeof description === "string" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "span", variant: "body", children: description || locales["estimate.cost.description"] }) : description);
|
|
25
|
-
const TitleComponent = react.memo(({
|
|
26
|
-
locales
|
|
27
|
-
}) => /* @__PURE__ */ jsxRuntime.jsxs("h3", { className: styles_css.estimateCostTitle, children: [
|
|
28
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.CalculatorIcon, { className: styles_css.estimateCostCalculatorIcon, sentiment: "primary", size: "medium" }),
|
|
29
|
-
locales?.["estimate.cost.label"]
|
|
30
|
-
] }));
|
|
31
|
-
const EstimateCostContent = ({
|
|
32
|
-
description,
|
|
33
|
-
alert,
|
|
34
|
-
alertTitle,
|
|
35
|
-
alertVariant = "warning",
|
|
36
|
-
defaultTimeUnit = "hours",
|
|
37
|
-
timeUnits = DEFAULT_UNIT_LIST,
|
|
38
|
-
hideOverlay = false,
|
|
39
|
-
disableOverlayLeft = false,
|
|
40
|
-
disableOverlayRight = false,
|
|
41
|
-
hideTimeUnit = false,
|
|
42
|
-
hideTotal = false,
|
|
43
|
-
hideHourlyPriceOnTotal = false,
|
|
44
|
-
discount = 0,
|
|
45
|
-
OverlayRight,
|
|
46
|
-
OverlayLeft,
|
|
47
|
-
isBeta = false,
|
|
48
|
-
commitmentFees,
|
|
49
|
-
commitmentFeesContent,
|
|
50
|
-
monthlyFees,
|
|
51
|
-
monthlyFeesLabel,
|
|
52
|
-
monthlyFeesContent,
|
|
53
|
-
overlayUnit = "hours",
|
|
54
|
-
children = null,
|
|
55
|
-
locales = en,
|
|
56
|
-
overlayMargin,
|
|
57
|
-
onTotalPriceChange,
|
|
58
|
-
style
|
|
59
|
-
}) => {
|
|
60
|
-
const {
|
|
61
|
-
formatNumber
|
|
62
|
-
} = EstimateCostProvider.useEstimateCost();
|
|
63
|
-
const [ref, inView] = reactIntersectionObserver.useInView();
|
|
64
|
-
const [products, setProducts] = react.useState([]);
|
|
65
|
-
const [totalPrice, setTotalPrice] = react.useState({
|
|
66
|
-
hourly: 0,
|
|
67
|
-
maxHourly: 0,
|
|
68
|
-
maxOverlayHourly: 0,
|
|
69
|
-
maxTotal: 0,
|
|
70
|
-
overlayHourly: 0,
|
|
71
|
-
total: 0
|
|
72
|
-
});
|
|
73
|
-
const [iteration, setIteration] = react.useState({
|
|
74
|
-
unit: defaultTimeUnit ?? "hours",
|
|
75
|
-
value: 1
|
|
76
|
-
});
|
|
77
|
-
const [isLongFractionDigits, setIsLongFractionDigits] = react.useState(false);
|
|
78
|
-
const providerValue = react.useMemo(() => ({
|
|
79
|
-
isOverlay: false
|
|
80
|
-
}), []);
|
|
81
|
-
const totalValue = react.useMemo(() => formatNumber(totalPrice.total < 0 ? 0 : totalPrice.total, {
|
|
82
|
-
maximumFractionDigits: isLongFractionDigits ? constants.maximumFractionDigitsLong[iteration.unit] : constants.maximumFractionDigits[iteration.unit]
|
|
83
|
-
}), [formatNumber, isLongFractionDigits, iteration.unit, totalPrice.total]);
|
|
84
|
-
const totalMaxValue = react.useMemo(() => formatNumber(totalPrice.maxTotal < 0 ? 0 : totalPrice.maxTotal, {
|
|
85
|
-
maximumFractionDigits: isLongFractionDigits ? constants.maximumFractionDigitsLong[iteration.unit] : constants.maximumFractionDigits[iteration.unit]
|
|
86
|
-
}), [formatNumber, isLongFractionDigits, iteration.unit, totalPrice.maxTotal]);
|
|
87
|
-
const productsCallback = react.useMemo(() => ({
|
|
88
|
-
add: (newProduct) => {
|
|
89
|
-
setProducts((total) => {
|
|
90
|
-
if (total.find((product) => product.id === newProduct.id)) {
|
|
91
|
-
return total.map((product) => product.id === newProduct.id ? newProduct : product);
|
|
92
|
-
}
|
|
93
|
-
return [...total, newProduct];
|
|
94
|
-
});
|
|
95
|
-
},
|
|
96
|
-
remove: ({
|
|
97
|
-
id
|
|
98
|
-
}) => {
|
|
99
|
-
setProducts((total) => total.filter((product) => product.id !== id));
|
|
100
|
-
}
|
|
101
|
-
}), [setProducts]);
|
|
102
|
-
react.useEffect(() => {
|
|
103
|
-
const isMaxAmountInProducts = products.find((product) => product.maxAmount);
|
|
104
|
-
setIsLongFractionDigits(!!products.find((product) => product.longFractionDigits));
|
|
105
|
-
setTotalPrice({
|
|
106
|
-
hourly: products.reduce((acc, product) => acc + (product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.amount - product.amountFree, 0)), 0),
|
|
107
|
-
maxHourly: isMaxAmountInProducts ? products.reduce((acc, product) => acc && product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.maxAmount - product.amountFree, 0), 0) : 0,
|
|
108
|
-
maxOverlayHourly: isMaxAmountInProducts ? products.reduce((acc, product) => acc + (product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.maxAmount - product.amountFree, 0)), 0) : 0,
|
|
109
|
-
maxTotal: isMaxAmountInProducts ? products.reduce((acc, product) => acc + helper.calculatePrice({
|
|
110
|
-
amount: product.maxAmount || product.amount,
|
|
111
|
-
// Not all products have maxAmount, so we need to check both
|
|
112
|
-
amountFree: product.amountFree,
|
|
113
|
-
discount: product.discount,
|
|
114
|
-
price: product.price,
|
|
115
|
-
timeAmount: product.noIteration ? 1 : iteration.value,
|
|
116
|
-
timeUnit: product.noIteration ? "hours" : iteration.unit
|
|
117
|
-
}), 0) : 0,
|
|
118
|
-
overlayHourly: products.reduce((acc, product) => acc + (product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.amount - product.amountFree, 0)), 0),
|
|
119
|
-
total: !hideTotal ? products.reduce((acc, product) => acc + helper.calculatePrice({
|
|
120
|
-
amount: product.amount,
|
|
121
|
-
amountFree: product.amountFree,
|
|
122
|
-
discount: product.discount,
|
|
123
|
-
price: product.price,
|
|
124
|
-
timeAmount: product.noIteration ? 1 : iteration.value,
|
|
125
|
-
timeUnit: product.noIteration ? "hours" : iteration.unit
|
|
126
|
-
}), 0) : 0
|
|
127
|
-
});
|
|
128
|
-
onTotalPriceChange?.({
|
|
129
|
-
total: totalPrice.total,
|
|
130
|
-
totalMax: totalPrice.maxTotal > 0 ? totalPrice.maxTotal : void 0
|
|
131
|
-
});
|
|
132
|
-
}, [hideTotal, products, iteration, setTotalPrice, onTotalPriceChange, totalPrice.total, totalPrice.maxTotal, totalValue, totalMaxValue]);
|
|
133
|
-
react.useEffect(() => {
|
|
134
|
-
if (hideTimeUnit && (iteration.value > 1 || iteration.unit !== (defaultTimeUnit ?? "hours"))) {
|
|
135
|
-
setIteration({
|
|
136
|
-
unit: defaultTimeUnit ?? "hours",
|
|
137
|
-
value: 1
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}, [hideTimeUnit, iteration, defaultTimeUnit]);
|
|
141
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { gap: 2, style, children: [
|
|
142
|
-
!hideOverlay ? /* @__PURE__ */ jsxRuntime.jsx(OverlayComponent.OverlayComponent, { disableOverlayLeft, disableOverlayRight, discount, inView, isBeta, OverlayLeft, OverlayRight, overlayMargin, totalPrice, unit: overlayUnit ?? "hours", children }) : null,
|
|
143
|
-
description === false ? null : /* @__PURE__ */ jsxRuntime.jsx(DescriptionComponent, { description, locales }),
|
|
144
|
-
alert ? /* @__PURE__ */ jsxRuntime.jsx(ui.Alert, { sentiment: alertVariant, title: alertTitle, children: alert }) : null,
|
|
145
|
-
/* @__PURE__ */ jsxRuntime.jsx(OverlayContext.OverlayContextProvider, { value: providerValue, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
146
|
-
children ? /* @__PURE__ */ jsxRuntime.jsxs("table", { cellPadding: "0", cellSpacing: "0", className: styles_css.estimateCostTable[hideTotal ? "noTotal" : "total"], "data-testid": "summary", ref, children: [
|
|
147
|
-
/* @__PURE__ */ jsxRuntime.jsxs("colgroup", { children: [
|
|
148
|
-
/* @__PURE__ */ jsxRuntime.jsx("col", {}),
|
|
149
|
-
/* @__PURE__ */ jsxRuntime.jsx("col", { className: styles_css.estimateCostPriceColumn })
|
|
150
|
-
] }),
|
|
151
|
-
!hideTimeUnit ? /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
152
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { children: /* @__PURE__ */ jsxRuntime.jsx(TitleComponent, { locales }) }),
|
|
153
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: `${styles_css.estimateCostPriceCellContent} ${styles_css.estimateCostPriceCell}`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_css.estimateCostTimeCell, children: /* @__PURE__ */ jsxRuntime.jsx(CustomUnitInput.CustomUnitInput, { defaultTimeUnit, iteration, setIteration, timeUnits }) }) })
|
|
154
|
-
] }) }) : null,
|
|
155
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: react.Children.map(children, (child, index) => react.isValidElement(child) ? react.cloneElement(child, {
|
|
156
|
-
discount: discount && !child.props.discount ? discount : child.props.discount,
|
|
157
|
-
isLastElement: index === react.Children.count(children) - 1,
|
|
158
|
-
iteration,
|
|
159
|
-
productsCallback
|
|
160
|
-
}) : child) })
|
|
161
|
-
] }) : null,
|
|
162
|
-
!hideTotal ? /* @__PURE__ */ jsxRuntime.jsxs("table", { cellPadding: "0", cellSpacing: "0", className: styles_css.estimateCostEmptyTable, children: [
|
|
163
|
-
/* @__PURE__ */ jsxRuntime.jsxs("colgroup", { children: [
|
|
164
|
-
/* @__PURE__ */ jsxRuntime.jsx("col", {}),
|
|
165
|
-
/* @__PURE__ */ jsxRuntime.jsx("col", { className: styles_css.estimateCostPriceColumn })
|
|
166
|
-
] }),
|
|
167
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
168
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { "aria-label": "control", className: styles_css.estimateCostEmptyCell }),
|
|
169
|
-
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: `${styles_css.estimateCostCell({
|
|
170
|
-
hasBorder: false,
|
|
171
|
-
primary: false
|
|
172
|
-
})} ${styles_css.estimateCostTotalPriceCell}`, style: dynamic.assignInlineVars({
|
|
173
|
-
[styles_css.paddingLeftCell]: `16px`
|
|
174
|
-
}), children: [
|
|
175
|
-
isBeta ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { className: styles_css.estimateCostBadgeBeta[locales[`estimate.cost.beta.${discount > 0 ? "discount" : "free"}`].length > 25 ? "long" : "short"], prominence: "strong", sentiment: "warning", children: `${discount > 0 ? discount * 100 : ""}
|
|
176
|
-
${locales[`estimate.cost.beta.${discount > 0 ? "discount" : "free"}`]}` }) : null,
|
|
177
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "h3", className: styles_css.estimateCostText[isBeta ? "beta" : "notBeta"], sentiment: "primary", variant: "heading", children: /* @__PURE__ */ jsxRuntime.jsxs(LineThrough.LineThrough, { isActive: isBeta && (discount === 0 || discount >= 1), children: [
|
|
178
|
-
totalValue,
|
|
179
|
-
totalPrice.maxTotal > 0 ? ` - ${totalMaxValue}` : null
|
|
180
|
-
] }) }),
|
|
181
|
-
hideHourlyPriceOnTotal && totalPrice.hourly > 0 && totalPrice.hourly !== totalPrice.total && totalPrice.total > 0 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "p", placement: "right", variant: "body", children: /* @__PURE__ */ jsxRuntime.jsxs(LineThrough.LineThrough, { isActive: isBeta && (discount === 0 || discount >= 1), children: [
|
|
182
|
-
formatNumber(totalPrice.hourly, {
|
|
183
|
-
maximumFractionDigits: isLongFractionDigits ? constants.maximumFractionDigitsLong.hours : constants.maximumFractionDigits.hours
|
|
184
|
-
}),
|
|
185
|
-
totalPrice.maxHourly > 0 ? ` - ${formatNumber(totalPrice.maxHourly, {
|
|
186
|
-
maximumFractionDigits: isLongFractionDigits ? constants.maximumFractionDigitsLong.hours : constants.maximumFractionDigits.hours
|
|
187
|
-
})}` : null,
|
|
188
|
-
"/",
|
|
189
|
-
locales[`estimate.cost.units.hours.label`].toLowerCase()
|
|
190
|
-
] }) }) : null
|
|
191
|
-
] })
|
|
192
|
-
] }) })
|
|
193
|
-
] }) : null,
|
|
194
|
-
commitmentFees !== void 0 || monthlyFees !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
195
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "h3", className: styles_css.estimatecostFeesText, variant: "headingSmall", children: locales[`estimate.cost.fees.${commitmentFees ? "oneTime" : "monthly"}.title`] }),
|
|
196
|
-
/* @__PURE__ */ jsxRuntime.jsx("table", { className: styles_css.estimateCostFeesTable, children: /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: /* @__PURE__ */ jsxRuntime.jsx(Item.Item, { isLastElement: true, label: commitmentFees ? locales["estimate.cost.fees.commitment"] : monthlyFeesLabel, noIteration: true, price: commitmentFees || monthlyFees, productsCallback: {
|
|
197
|
-
add: () => {
|
|
198
|
-
},
|
|
199
|
-
remove: () => {
|
|
200
|
-
}
|
|
201
|
-
}, children: commitmentFees ? commitmentFeesContent : monthlyFeesContent }) }) })
|
|
202
|
-
] }) : null
|
|
203
|
-
] }) })
|
|
204
|
-
] });
|
|
205
|
-
};
|
|
206
|
-
exports.EstimateCostContent = EstimateCostContent;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const react = require("react");
|
|
6
|
-
const en = require("./locales/en.cjs");
|
|
7
|
-
const EstimateCostContext = react.createContext({
|
|
8
|
-
formatNumber: () => "",
|
|
9
|
-
locales: en
|
|
10
|
-
});
|
|
11
|
-
const useEstimateCost = () => react.useContext(EstimateCostContext);
|
|
12
|
-
const EstimateCostProvider = ({
|
|
13
|
-
children,
|
|
14
|
-
locales,
|
|
15
|
-
currency,
|
|
16
|
-
numberLocales
|
|
17
|
-
}) => {
|
|
18
|
-
const newLocales = react.useMemo(() => locales ? {
|
|
19
|
-
...en,
|
|
20
|
-
...locales
|
|
21
|
-
} : en, [locales]);
|
|
22
|
-
const formatNumber = react.useCallback((number, options) => {
|
|
23
|
-
const numberFormat = new Intl.NumberFormat(numberLocales, {
|
|
24
|
-
currency,
|
|
25
|
-
style: "currency",
|
|
26
|
-
...options
|
|
27
|
-
});
|
|
28
|
-
return numberFormat.format(number);
|
|
29
|
-
}, [currency, numberLocales]);
|
|
30
|
-
const value = react.useMemo(() => ({
|
|
31
|
-
formatNumber,
|
|
32
|
-
locales: newLocales
|
|
33
|
-
}), [formatNumber, newLocales]);
|
|
34
|
-
return /* @__PURE__ */ jsxRuntime.jsx(EstimateCostContext.Provider, { value, children });
|
|
35
|
-
};
|
|
36
|
-
exports.EstimateCostProvider = EstimateCostProvider;
|
|
37
|
-
exports.useEstimateCost = useEstimateCost;
|