@ultraviolet/plus 3.5.1 → 3.6.0
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/CodeEditor/CodeEditor.d.ts +5 -38
- package/dist/components/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/dist/components/CodeEditor/CodeEditor.js +6 -113
- package/dist/components/ContentCard/index.d.ts +3 -34
- package/dist/components/ContentCard/index.d.ts.map +1 -1
- package/dist/components/ContentCard/index.js +4 -103
- package/dist/components/ContentCardGroup/index.d.ts +5 -20
- package/dist/components/ContentCardGroup/index.d.ts.map +1 -1
- package/dist/components/ContentCardGroup/index.js +6 -16
- package/dist/components/Conversation/index.d.ts +5 -49
- package/dist/components/Conversation/index.d.ts.map +1 -1
- package/dist/components/Conversation/index.js +6 -46
- package/dist/components/CustomerSatisfaction/index.d.ts +5 -32
- package/dist/components/CustomerSatisfaction/index.d.ts.map +1 -1
- package/dist/components/CustomerSatisfaction/index.js +6 -84
- package/dist/components/EstimateCost/index.d.ts +9 -3
- package/dist/components/EstimateCost/index.d.ts.map +1 -1
- package/dist/components/EstimateCost/index.js +15 -0
- package/dist/components/FAQ/index.d.ts +5 -13
- package/dist/components/FAQ/index.d.ts.map +1 -1
- package/dist/components/FAQ/index.js +6 -35
- package/dist/components/InfoTable/index.d.ts +5 -1
- package/dist/components/InfoTable/index.d.ts.map +1 -1
- package/dist/components/InfoTable/index.js +11 -0
- package/dist/components/Navigation/index.d.ts +13 -2
- package/dist/components/Navigation/index.d.ts.map +1 -1
- package/dist/components/Navigation/index.js +19 -0
- package/dist/index.js +4 -6
- package/package.json +9 -9
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/defineProperty.js +0 -15
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js +0 -28
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutProperties.js +0 -18
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutPropertiesLoose.js +0 -15
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/toPrimitive.js +0 -17
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/toPropertyKey.js +0 -12
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/typeof.js +0 -14
- package/dist/_virtual/_rolldown/runtime.js +0 -9
- package/dist/components/CodeEditor/styles.css.d.ts +0 -10
- package/dist/components/CodeEditor/styles.css.d.ts.map +0 -1
- package/dist/components/CodeEditor/styles.css.js +0 -24
- package/dist/components/ContentCard/Skeleton.d.ts +0 -6
- package/dist/components/ContentCard/Skeleton.d.ts.map +0 -1
- package/dist/components/ContentCard/Skeleton.js +0 -32
- package/dist/components/ContentCard/styles.css.d.ts +0 -13
- package/dist/components/ContentCard/styles.css.d.ts.map +0 -1
- package/dist/components/ContentCard/styles.css.js +0 -31
- package/dist/components/ContentCardGroup/Card.d.ts +0 -15
- package/dist/components/ContentCardGroup/Card.d.ts.map +0 -1
- package/dist/components/ContentCardGroup/Card.js +0 -57
- package/dist/components/ContentCardGroup/SkeletonCard.d.ts +0 -2
- package/dist/components/ContentCardGroup/SkeletonCard.d.ts.map +0 -1
- package/dist/components/ContentCardGroup/SkeletonCard.js +0 -29
- package/dist/components/ContentCardGroup/styles.css.d.ts +0 -8
- package/dist/components/ContentCardGroup/styles.css.d.ts.map +0 -1
- package/dist/components/ContentCardGroup/styles.css.js +0 -13
- package/dist/components/Conversation/styles.css.js +0 -23
- package/dist/components/CustomerSatisfaction/assets/1-5.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/1-5NB.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/2-5.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/2-5NB.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/3-5.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/3-5NB.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/4-5.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/4-5NB.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/5-5.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/5-5NB.js +0 -5
- package/dist/components/CustomerSatisfaction/styles.css.d.ts +0 -19
- package/dist/components/CustomerSatisfaction/styles.css.d.ts.map +0 -1
- package/dist/components/CustomerSatisfaction/styles.css.js +0 -20
- package/dist/components/EstimateCost/Components/CustomUnitInput.d.ts +0 -10
- package/dist/components/EstimateCost/Components/CustomUnitInput.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/CustomUnitInput.js +0 -41
- package/dist/components/EstimateCost/Components/Item.d.ts +0 -118
- package/dist/components/EstimateCost/Components/Item.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/Item.js +0 -228
- package/dist/components/EstimateCost/Components/LineThrough.d.ts +0 -7
- package/dist/components/EstimateCost/Components/LineThrough.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/LineThrough.js +0 -18
- package/dist/components/EstimateCost/Components/NumberInput.d.ts +0 -11
- package/dist/components/EstimateCost/Components/NumberInput.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/NumberInput.js +0 -35
- package/dist/components/EstimateCost/Components/Region.d.ts +0 -23
- package/dist/components/EstimateCost/Components/Region.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/Region.js +0 -38
- package/dist/components/EstimateCost/Components/Regular.d.ts +0 -11
- package/dist/components/EstimateCost/Components/Regular.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/Regular.js +0 -23
- package/dist/components/EstimateCost/Components/Strong.d.ts +0 -10
- package/dist/components/EstimateCost/Components/Strong.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/Strong.js +0 -16
- package/dist/components/EstimateCost/Components/Unit.d.ts +0 -11
- package/dist/components/EstimateCost/Components/Unit.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/Unit.js +0 -50
- package/dist/components/EstimateCost/Components/Zone.d.ts +0 -23
- package/dist/components/EstimateCost/Components/Zone.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/Zone.js +0 -37
- package/dist/components/EstimateCost/Components/components.css.d.ts +0 -78
- package/dist/components/EstimateCost/Components/components.css.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/components.css.js +0 -161
- package/dist/components/EstimateCost/EstimateCost.d.ts +0 -176
- package/dist/components/EstimateCost/EstimateCost.d.ts.map +0 -1
- package/dist/components/EstimateCost/EstimateCost.js +0 -97
- package/dist/components/EstimateCost/EstimateCostContent.d.ts +0 -3
- package/dist/components/EstimateCost/EstimateCostContent.d.ts.map +0 -1
- package/dist/components/EstimateCost/EstimateCostContent.js +0 -289
- package/dist/components/EstimateCost/EstimateCostProvider.d.ts +0 -26
- package/dist/components/EstimateCost/EstimateCostProvider.d.ts.map +0 -1
- package/dist/components/EstimateCost/EstimateCostProvider.js +0 -33
- package/dist/components/EstimateCost/OverlayComponent.d.ts +0 -27
- package/dist/components/EstimateCost/OverlayComponent.d.ts.map +0 -1
- package/dist/components/EstimateCost/OverlayComponent.js +0 -99
- package/dist/components/EstimateCost/OverlayContext.d.ts +0 -13
- package/dist/components/EstimateCost/OverlayContext.d.ts.map +0 -1
- package/dist/components/EstimateCost/OverlayContext.js +0 -15
- package/dist/components/EstimateCost/constants.d.ts +0 -8
- package/dist/components/EstimateCost/constants.d.ts.map +0 -1
- package/dist/components/EstimateCost/constants.js +0 -26
- package/dist/components/EstimateCost/helper.d.ts +0 -10
- package/dist/components/EstimateCost/helper.d.ts.map +0 -1
- package/dist/components/EstimateCost/helper.js +0 -11
- package/dist/components/EstimateCost/locales/en.d.ts +0 -23
- package/dist/components/EstimateCost/locales/en.d.ts.map +0 -1
- package/dist/components/EstimateCost/locales/en.js +0 -25
- package/dist/components/EstimateCost/styles.css.d.ts +0 -80
- package/dist/components/EstimateCost/styles.css.d.ts.map +0 -1
- package/dist/components/EstimateCost/styles.css.js +0 -70
- package/dist/components/EstimateCost/types.d.ts +0 -148
- package/dist/components/EstimateCost/types.d.ts.map +0 -1
- package/dist/components/FAQ/styles.css.d.ts +0 -2
- package/dist/components/FAQ/styles.css.d.ts.map +0 -1
- package/dist/components/FAQ/styles.css.js +0 -7
- package/dist/components/InfoTable/InfoTable.d.ts +0 -25
- package/dist/components/InfoTable/InfoTable.d.ts.map +0 -1
- package/dist/components/InfoTable/InfoTable.js +0 -28
- package/dist/components/InfoTable/components/Cell.d.ts +0 -10
- package/dist/components/InfoTable/components/Cell.d.ts.map +0 -1
- package/dist/components/InfoTable/components/Cell.js +0 -38
- package/dist/components/InfoTable/components/Row.d.ts +0 -9
- package/dist/components/InfoTable/components/Row.d.ts.map +0 -1
- package/dist/components/InfoTable/components/Row.js +0 -23
- package/dist/components/InfoTable/context.d.ts +0 -4
- package/dist/components/InfoTable/context.d.ts.map +0 -1
- package/dist/components/InfoTable/context.js +0 -7
- package/dist/components/InfoTable/styles.css.d.ts +0 -8
- package/dist/components/InfoTable/styles.css.d.ts.map +0 -1
- package/dist/components/InfoTable/styles.css.js +0 -13
- package/dist/components/Navigation/Footer.d.ts +0 -9
- package/dist/components/Navigation/Footer.d.ts.map +0 -1
- package/dist/components/Navigation/Footer.js +0 -64
- package/dist/components/Navigation/Header.d.ts +0 -7
- package/dist/components/Navigation/Header.d.ts.map +0 -1
- package/dist/components/Navigation/Header.js +0 -24
- package/dist/components/Navigation/Navigation.d.ts +0 -62
- package/dist/components/Navigation/Navigation.d.ts.map +0 -1
- package/dist/components/Navigation/Navigation.js +0 -34
- package/dist/components/Navigation/NavigationContent.d.ts +0 -3
- package/dist/components/Navigation/NavigationContent.d.ts.map +0 -1
- package/dist/components/Navigation/NavigationContent.js +0 -104
- package/dist/components/Navigation/NavigationProvider.d.ts +0 -94
- package/dist/components/Navigation/NavigationProvider.d.ts.map +0 -1
- package/dist/components/Navigation/NavigationProvider.js +0 -121
- package/dist/components/Navigation/animations.css.d.ts +0 -7
- package/dist/components/Navigation/animations.css.d.ts.map +0 -1
- package/dist/components/Navigation/components/Group.d.ts +0 -10
- package/dist/components/Navigation/components/Group.d.ts.map +0 -1
- package/dist/components/Navigation/components/Group.js +0 -39
- package/dist/components/Navigation/components/Item.d.ts +0 -89
- package/dist/components/Navigation/components/Item.d.ts.map +0 -1
- package/dist/components/Navigation/components/Item.js +0 -448
- package/dist/components/Navigation/components/ItemProvider.d.ts +0 -8
- package/dist/components/Navigation/components/ItemProvider.d.ts.map +0 -1
- package/dist/components/Navigation/components/ItemProvider.js +0 -17
- package/dist/components/Navigation/components/PinnedItems.d.ts +0 -24
- package/dist/components/Navigation/components/PinnedItems.d.ts.map +0 -1
- package/dist/components/Navigation/components/PinnedItems.js +0 -105
- package/dist/components/Navigation/components/Separator.d.ts +0 -2
- package/dist/components/Navigation/components/Separator.d.ts.map +0 -1
- package/dist/components/Navigation/components/Separator.js +0 -11
- package/dist/components/Navigation/components/ShowHide.d.ts +0 -16
- package/dist/components/Navigation/components/ShowHide.d.ts.map +0 -1
- package/dist/components/Navigation/components/ShowHide.js +0 -53
- package/dist/components/Navigation/components/items.css.d.ts +0 -71
- package/dist/components/Navigation/components/items.css.d.ts.map +0 -1
- package/dist/components/Navigation/components/items.css.js +0 -87
- package/dist/components/Navigation/components/styles.css.d.ts +0 -25
- package/dist/components/Navigation/components/styles.css.d.ts.map +0 -1
- package/dist/components/Navigation/components/styles.css.js +0 -29
- package/dist/components/Navigation/constants.d.ts +0 -10
- package/dist/components/Navigation/constants.d.ts.map +0 -1
- package/dist/components/Navigation/locales/en.d.ts +0 -11
- package/dist/components/Navigation/locales/en.d.ts.map +0 -1
- package/dist/components/Navigation/locales/en.js +0 -13
- package/dist/components/Navigation/styles.css.d.ts +0 -34
- package/dist/components/Navigation/styles.css.d.ts.map +0 -1
- package/dist/components/Navigation/styles.css.js +0 -36
- package/dist/components/Navigation/types.d.ts +0 -42
- package/dist/components/Navigation/types.d.ts.map +0 -1
- package/dist/components/Navigation/variables.css.d.ts +0 -2
- package/dist/components/Navigation/variables.css.d.ts.map +0 -1
- package/dist/components/Navigation/variables.css.js +0 -7
- package/dist/plus.css +0 -2
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { __name } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import en_default from "./locales/en.js";
|
|
4
|
-
import { maximumFractionDigits, maximumFractionDigitsLong } from "./constants.js";
|
|
5
|
-
import { useEstimateCost } from "./EstimateCostProvider.js";
|
|
6
|
-
import { calculatePrice } from "./helper.js";
|
|
7
|
-
import { OverlayContextProvider } from "./OverlayContext.js";
|
|
8
|
-
import { estimateCostBadgeBeta, estimateCostCalculatorIcon, estimateCostCell, estimateCostCompact, estimateCostCompactText, estimateCostContent, estimateCostEmptyCell, estimateCostEmptyTable, estimateCostFeesTable, estimateCostPriceCell, estimateCostPriceCellContent, estimateCostPriceColumn, estimateCostTable, estimateCostText, estimateCostTimeCell, estimateCostTitle, estimateCostTotalPriceCell, estimatecostFeesText, paddingLeftCell } from "./styles.css.js";
|
|
9
|
-
import { Item } from "./Components/Item.js";
|
|
10
|
-
import { LineThrough } from "./Components/LineThrough.js";
|
|
11
|
-
import { CustomUnitInput } from "./Components/CustomUnitInput.js";
|
|
12
|
-
import { OverlayComponent } from "./OverlayComponent.js";
|
|
13
|
-
import { Alert, Badge, Stack, Text } from "@ultraviolet/ui";
|
|
14
|
-
import { cn } from "@ultraviolet/utils";
|
|
15
|
-
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
16
|
-
import { Children, cloneElement, isValidElement, memo, useEffect, useMemo, useState } from "react";
|
|
17
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
-
import { CalculatorIcon } from "@ultraviolet/icons/CalculatorIcon";
|
|
19
|
-
import { useInView } from "react-intersection-observer";
|
|
20
|
-
|
|
21
|
-
//#region src/components/EstimateCost/EstimateCostContent.tsx
|
|
22
|
-
const DEFAULT_UNIT_LIST = [
|
|
23
|
-
"hours",
|
|
24
|
-
"days",
|
|
25
|
-
"months"
|
|
26
|
-
];
|
|
27
|
-
const DescriptionComponent = memo(({ description, locales }) => description === void 0 || typeof description === "string" ? /* @__PURE__ */ jsx(Text, {
|
|
28
|
-
as: "span",
|
|
29
|
-
variant: "body",
|
|
30
|
-
children: description || locales["estimate.cost.description"]
|
|
31
|
-
}) : description);
|
|
32
|
-
const TitleComponent = memo(({ locales }) => /* @__PURE__ */ jsxs("h3", {
|
|
33
|
-
className: estimateCostTitle,
|
|
34
|
-
children: [/* @__PURE__ */ jsx(CalculatorIcon, {
|
|
35
|
-
className: estimateCostCalculatorIcon,
|
|
36
|
-
sentiment: "primary",
|
|
37
|
-
size: "medium"
|
|
38
|
-
}), locales === null || locales === void 0 ? void 0 : locales["estimate.cost.label"]]
|
|
39
|
-
}));
|
|
40
|
-
const EstimateCostContent = ({ description, alert, alertTitle, alertVariant = "warning", defaultTimeUnit = "hours", timeUnits = DEFAULT_UNIT_LIST, hideOverlay = false, disableOverlayLeft = false, disableOverlayRight = false, hideTimeUnit = false, hideTotal = false, hideHourlyPriceOnTotal = false, discount = 0, OverlayRight, OverlayLeft, isBeta = false, commitmentFees, commitmentFeesContent, monthlyFees, monthlyFeesLabel, monthlyFeesContent, overlayUnit = "hours", children = null, locales = en_default, overlayMargin, onTotalPriceChange, style, compact }) => {
|
|
41
|
-
const { formatNumber } = useEstimateCost();
|
|
42
|
-
const [ref, inView] = useInView();
|
|
43
|
-
const [products, setProducts] = useState([]);
|
|
44
|
-
const [totalPrice, setTotalPrice] = useState({
|
|
45
|
-
hourly: 0,
|
|
46
|
-
maxHourly: 0,
|
|
47
|
-
maxOverlayHourly: 0,
|
|
48
|
-
maxTotal: 0,
|
|
49
|
-
overlayHourly: 0,
|
|
50
|
-
total: 0
|
|
51
|
-
});
|
|
52
|
-
const [iteration, setIteration] = useState({
|
|
53
|
-
unit: defaultTimeUnit !== null && defaultTimeUnit !== void 0 ? defaultTimeUnit : "hours",
|
|
54
|
-
value: 1
|
|
55
|
-
});
|
|
56
|
-
const [isLongFractionDigits, setIsLongFractionDigits] = useState(false);
|
|
57
|
-
const providerValue = useMemo(() => ({ isOverlay: false }), []);
|
|
58
|
-
const totalValue = useMemo(() => formatNumber(totalPrice.total < 0 ? 0 : totalPrice.total, { maximumFractionDigits: isLongFractionDigits ? maximumFractionDigitsLong[iteration.unit] : maximumFractionDigits[iteration.unit] }), [
|
|
59
|
-
formatNumber,
|
|
60
|
-
isLongFractionDigits,
|
|
61
|
-
iteration.unit,
|
|
62
|
-
totalPrice.total
|
|
63
|
-
]);
|
|
64
|
-
const totalMaxValue = useMemo(() => formatNumber(totalPrice.maxTotal < 0 ? 0 : totalPrice.maxTotal, { maximumFractionDigits: isLongFractionDigits ? maximumFractionDigitsLong[iteration.unit] : maximumFractionDigits[iteration.unit] }), [
|
|
65
|
-
formatNumber,
|
|
66
|
-
isLongFractionDigits,
|
|
67
|
-
iteration.unit,
|
|
68
|
-
totalPrice.maxTotal
|
|
69
|
-
]);
|
|
70
|
-
const productsCallback = useMemo(() => ({
|
|
71
|
-
add: (newProduct) => {
|
|
72
|
-
setProducts((total) => {
|
|
73
|
-
if (total.find((product) => product.id === newProduct.id)) return total.map((product) => product.id === newProduct.id ? newProduct : product);
|
|
74
|
-
return [...total, newProduct];
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
remove: ({ id }) => {
|
|
78
|
-
setProducts((total) => total.filter((product) => product.id !== id));
|
|
79
|
-
}
|
|
80
|
-
}), [setProducts]);
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
const isMaxAmountInProducts = products.find((product) => product.maxAmount);
|
|
83
|
-
setIsLongFractionDigits(!!products.find((product) => product.longFractionDigits));
|
|
84
|
-
setTotalPrice({
|
|
85
|
-
hourly: products.reduce((acc, product) => acc + (product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.amount - product.amountFree, 0)), 0),
|
|
86
|
-
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,
|
|
87
|
-
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,
|
|
88
|
-
maxTotal: isMaxAmountInProducts ? products.reduce((acc, product) => acc + calculatePrice({
|
|
89
|
-
amount: product.maxAmount || product.amount,
|
|
90
|
-
amountFree: product.amountFree,
|
|
91
|
-
discount: product.discount,
|
|
92
|
-
price: product.price,
|
|
93
|
-
timeAmount: product.noIteration ? 1 : iteration.value,
|
|
94
|
-
timeUnit: product.noIteration ? "hours" : iteration.unit
|
|
95
|
-
}), 0) : 0,
|
|
96
|
-
overlayHourly: products.reduce((acc, product) => acc + (product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.amount - product.amountFree, 0)), 0),
|
|
97
|
-
total: hideTotal ? 0 : products.reduce((acc, product) => acc + calculatePrice({
|
|
98
|
-
amount: product.amount,
|
|
99
|
-
amountFree: product.amountFree,
|
|
100
|
-
discount: product.discount,
|
|
101
|
-
price: product.price,
|
|
102
|
-
timeAmount: product.noIteration ? 1 : iteration.value,
|
|
103
|
-
timeUnit: product.noIteration ? "hours" : iteration.unit
|
|
104
|
-
}), 0)
|
|
105
|
-
});
|
|
106
|
-
onTotalPriceChange === null || onTotalPriceChange === void 0 || onTotalPriceChange({
|
|
107
|
-
total: totalPrice.total,
|
|
108
|
-
totalMax: totalPrice.maxTotal > 0 ? totalPrice.maxTotal : void 0
|
|
109
|
-
});
|
|
110
|
-
}, [
|
|
111
|
-
hideTotal,
|
|
112
|
-
products,
|
|
113
|
-
iteration,
|
|
114
|
-
setTotalPrice,
|
|
115
|
-
onTotalPriceChange,
|
|
116
|
-
totalPrice.total,
|
|
117
|
-
totalPrice.maxTotal,
|
|
118
|
-
totalValue,
|
|
119
|
-
totalMaxValue
|
|
120
|
-
]);
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
if (hideTimeUnit && (iteration.value > 1 || iteration.unit !== (defaultTimeUnit !== null && defaultTimeUnit !== void 0 ? defaultTimeUnit : "hours"))) setIteration({
|
|
123
|
-
unit: defaultTimeUnit !== null && defaultTimeUnit !== void 0 ? defaultTimeUnit : "hours",
|
|
124
|
-
value: 1
|
|
125
|
-
});
|
|
126
|
-
}, [
|
|
127
|
-
hideTimeUnit,
|
|
128
|
-
iteration,
|
|
129
|
-
defaultTimeUnit
|
|
130
|
-
]);
|
|
131
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [compact ? /* @__PURE__ */ jsxs(Stack, {
|
|
132
|
-
alignItems: "center",
|
|
133
|
-
className: estimateCostCompact,
|
|
134
|
-
direction: "row",
|
|
135
|
-
justifyContent: "space-between",
|
|
136
|
-
children: [/* @__PURE__ */ jsxs(Text, {
|
|
137
|
-
as: "p",
|
|
138
|
-
className: estimateCostCompactText,
|
|
139
|
-
variant: "bodyStrong",
|
|
140
|
-
children: [/* @__PURE__ */ jsx(CalculatorIcon, {
|
|
141
|
-
sentiment: "primary",
|
|
142
|
-
size: "medium"
|
|
143
|
-
}), locales["estimate.cost.label"]]
|
|
144
|
-
}), /* @__PURE__ */ jsxs(Stack, {
|
|
145
|
-
alignItems: "center",
|
|
146
|
-
direction: "row",
|
|
147
|
-
children: [/* @__PURE__ */ jsxs(Text, {
|
|
148
|
-
as: "span",
|
|
149
|
-
variant: "headingSmallStrong",
|
|
150
|
-
children: ["€", totalPrice.total]
|
|
151
|
-
}), /* @__PURE__ */ jsxs(Text, {
|
|
152
|
-
as: "span",
|
|
153
|
-
variant: "bodyStrong",
|
|
154
|
-
children: ["/", iteration.unit.length > 1 && iteration.unit.endsWith("s") ? iteration.unit.slice(0, -1) : iteration.unit]
|
|
155
|
-
})]
|
|
156
|
-
})]
|
|
157
|
-
}) : null, /* @__PURE__ */ jsxs(Stack, {
|
|
158
|
-
className: estimateCostContent[compact ? "compact" : "default"],
|
|
159
|
-
gap: 2,
|
|
160
|
-
style,
|
|
161
|
-
children: [
|
|
162
|
-
hideOverlay ? null : /* @__PURE__ */ jsx(OverlayComponent, {
|
|
163
|
-
disableOverlayLeft,
|
|
164
|
-
disableOverlayRight,
|
|
165
|
-
discount,
|
|
166
|
-
inView,
|
|
167
|
-
isBeta,
|
|
168
|
-
OverlayLeft,
|
|
169
|
-
OverlayRight,
|
|
170
|
-
overlayMargin,
|
|
171
|
-
totalPrice,
|
|
172
|
-
unit: overlayUnit !== null && overlayUnit !== void 0 ? overlayUnit : "hours",
|
|
173
|
-
children
|
|
174
|
-
}),
|
|
175
|
-
description === false ? null : /* @__PURE__ */ jsx(DescriptionComponent, {
|
|
176
|
-
description,
|
|
177
|
-
locales
|
|
178
|
-
}),
|
|
179
|
-
alert ? /* @__PURE__ */ jsx(Alert, {
|
|
180
|
-
sentiment: alertVariant,
|
|
181
|
-
title: alertTitle,
|
|
182
|
-
children: alert
|
|
183
|
-
}) : null,
|
|
184
|
-
/* @__PURE__ */ jsx(OverlayContextProvider, {
|
|
185
|
-
value: providerValue,
|
|
186
|
-
children: /* @__PURE__ */ jsxs("div", { children: [
|
|
187
|
-
children ? /* @__PURE__ */ jsxs("table", {
|
|
188
|
-
cellPadding: "0",
|
|
189
|
-
cellSpacing: "0",
|
|
190
|
-
className: estimateCostTable[hideTotal ? "noTotal" : "total"],
|
|
191
|
-
"data-testid": "summary",
|
|
192
|
-
ref,
|
|
193
|
-
children: [
|
|
194
|
-
/* @__PURE__ */ jsxs("colgroup", { children: [/* @__PURE__ */ jsx("col", {}), /* @__PURE__ */ jsx("col", { className: estimateCostPriceColumn })] }),
|
|
195
|
-
hideTimeUnit ? null : /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", { children: /* @__PURE__ */ jsx(TitleComponent, { locales }) }), /* @__PURE__ */ jsx("th", {
|
|
196
|
-
className: cn(estimateCostPriceCellContent, estimateCostPriceCell),
|
|
197
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
198
|
-
className: estimateCostTimeCell,
|
|
199
|
-
children: /* @__PURE__ */ jsx(CustomUnitInput, {
|
|
200
|
-
defaultTimeUnit,
|
|
201
|
-
iteration,
|
|
202
|
-
setIteration,
|
|
203
|
-
timeUnits
|
|
204
|
-
})
|
|
205
|
-
})
|
|
206
|
-
})] }) }),
|
|
207
|
-
/* @__PURE__ */ jsx("tbody", { children: Children.map(children, (child, index) => isValidElement(child) ? cloneElement(child, {
|
|
208
|
-
discount: discount && !child.props.discount ? discount : child.props.discount,
|
|
209
|
-
isLastElement: index === Children.count(children) - 1,
|
|
210
|
-
iteration,
|
|
211
|
-
productsCallback
|
|
212
|
-
}) : child) })
|
|
213
|
-
]
|
|
214
|
-
}) : null,
|
|
215
|
-
hideTotal ? null : /* @__PURE__ */ jsxs("table", {
|
|
216
|
-
cellPadding: "0",
|
|
217
|
-
cellSpacing: "0",
|
|
218
|
-
className: estimateCostEmptyTable,
|
|
219
|
-
children: [/* @__PURE__ */ jsxs("colgroup", { children: [/* @__PURE__ */ jsx("col", {}), /* @__PURE__ */ jsx("col", { className: estimateCostPriceColumn })] }), /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("td", {
|
|
220
|
-
"aria-label": "control",
|
|
221
|
-
className: estimateCostEmptyCell
|
|
222
|
-
}), /* @__PURE__ */ jsxs("td", {
|
|
223
|
-
className: cn(estimateCostCell({
|
|
224
|
-
hasBorder: false,
|
|
225
|
-
primary: false
|
|
226
|
-
}), estimateCostTotalPriceCell),
|
|
227
|
-
style: assignInlineVars({ [paddingLeftCell]: "16px" }),
|
|
228
|
-
children: [
|
|
229
|
-
isBeta ? /* @__PURE__ */ jsx(Badge, {
|
|
230
|
-
className: estimateCostBadgeBeta[locales[`estimate.cost.beta.${discount > 0 ? "discount" : "free"}`].length > 25 ? "long" : "short"],
|
|
231
|
-
prominence: "strong",
|
|
232
|
-
sentiment: "warning",
|
|
233
|
-
children: `${discount > 0 ? discount * 100 : ""}
|
|
234
|
-
${locales[`estimate.cost.beta.${discount > 0 ? "discount" : "free"}`]}`
|
|
235
|
-
}) : null,
|
|
236
|
-
/* @__PURE__ */ jsx(Text, {
|
|
237
|
-
as: "h3",
|
|
238
|
-
className: estimateCostText[isBeta ? "beta" : "notBeta"],
|
|
239
|
-
sentiment: "primary",
|
|
240
|
-
variant: "heading",
|
|
241
|
-
children: /* @__PURE__ */ jsxs(LineThrough, {
|
|
242
|
-
isActive: isBeta && (discount === 0 || discount >= 1),
|
|
243
|
-
children: [totalValue, totalPrice.maxTotal > 0 ? ` - ${totalMaxValue}` : null]
|
|
244
|
-
})
|
|
245
|
-
}),
|
|
246
|
-
hideHourlyPriceOnTotal && totalPrice.hourly > 0 && totalPrice.hourly !== totalPrice.total && totalPrice.total > 0 ? /* @__PURE__ */ jsx(Text, {
|
|
247
|
-
as: "p",
|
|
248
|
-
placement: "right",
|
|
249
|
-
variant: "body",
|
|
250
|
-
children: /* @__PURE__ */ jsxs(LineThrough, {
|
|
251
|
-
isActive: isBeta && (discount === 0 || discount >= 1),
|
|
252
|
-
children: [
|
|
253
|
-
formatNumber(totalPrice.hourly, { maximumFractionDigits: isLongFractionDigits ? maximumFractionDigitsLong.hours : maximumFractionDigits.hours }),
|
|
254
|
-
totalPrice.maxHourly > 0 ? ` - ${formatNumber(totalPrice.maxHourly, { maximumFractionDigits: isLongFractionDigits ? maximumFractionDigitsLong.hours : maximumFractionDigits.hours })}` : null,
|
|
255
|
-
"/",
|
|
256
|
-
locales["estimate.cost.units.hours.label"].toLowerCase()
|
|
257
|
-
]
|
|
258
|
-
})
|
|
259
|
-
}) : null
|
|
260
|
-
]
|
|
261
|
-
})] }) })]
|
|
262
|
-
}),
|
|
263
|
-
commitmentFees !== void 0 || monthlyFees !== void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Text, {
|
|
264
|
-
as: "h3",
|
|
265
|
-
className: estimatecostFeesText,
|
|
266
|
-
variant: "headingSmall",
|
|
267
|
-
children: locales[`estimate.cost.fees.${commitmentFees ? "oneTime" : "monthly"}.title`]
|
|
268
|
-
}), /* @__PURE__ */ jsx("table", {
|
|
269
|
-
className: estimateCostFeesTable,
|
|
270
|
-
children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx(Item, {
|
|
271
|
-
isLastElement: true,
|
|
272
|
-
label: commitmentFees ? locales["estimate.cost.fees.commitment"] : monthlyFeesLabel,
|
|
273
|
-
noIteration: true,
|
|
274
|
-
price: commitmentFees || monthlyFees,
|
|
275
|
-
productsCallback: {
|
|
276
|
-
add: () => {},
|
|
277
|
-
remove: () => {}
|
|
278
|
-
},
|
|
279
|
-
children: commitmentFees ? commitmentFeesContent : monthlyFeesContent
|
|
280
|
-
}) })
|
|
281
|
-
})] }) : null
|
|
282
|
-
] })
|
|
283
|
-
})
|
|
284
|
-
]
|
|
285
|
-
})] });
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
//#endregion
|
|
289
|
-
export { EstimateCostContent };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import EstimateCostLocales from './locales/en';
|
|
3
|
-
export declare const useEstimateCost: () => {
|
|
4
|
-
locales: Record<"estimate.cost.az.label" | "estimate.cost.beta.badge" | "estimate.cost.beta.discount" | "estimate.cost.beta.free" | "estimate.cost.description" | "estimate.cost.fees.commitment" | "estimate.cost.fees.monthly.title" | "estimate.cost.fees.oneTime.title" | "estimate.cost.label" | "estimate.cost.notDefined" | "estimate.cost.region.label" | "estimate.cost.submit.label" | "estimate.cost.units.days.label" | "estimate.cost.units.gb.label" | "estimate.cost.units.hours.label" | "estimate.cost.units.minutes.label" | "estimate.cost.units.months.label" | "estimate.cost.units.seconds.label" | "estimate.cost.units.years.label", string>;
|
|
5
|
-
formatNumber: (number: number, options: FormatNumberOption) => string;
|
|
6
|
-
};
|
|
7
|
-
type EstimateCostProviderProps = {
|
|
8
|
-
children: ReactNode;
|
|
9
|
-
locales?: Record<keyof typeof EstimateCostLocales, string>;
|
|
10
|
-
currency?: string;
|
|
11
|
-
numberLocales?: string;
|
|
12
|
-
};
|
|
13
|
-
type FormatNumberOption = {
|
|
14
|
-
currencyDisplay?: 'symbol' | 'code' | 'name';
|
|
15
|
-
unit?: string;
|
|
16
|
-
unitDisplay?: 'long' | 'short' | 'narrow';
|
|
17
|
-
useGrouping?: boolean;
|
|
18
|
-
minimumIntegerDigits?: number;
|
|
19
|
-
minimumFractionDigits?: number;
|
|
20
|
-
maximumFractionDigits?: number;
|
|
21
|
-
minimumSignificantDigits?: number;
|
|
22
|
-
maximumSignificantDigits?: number;
|
|
23
|
-
};
|
|
24
|
-
export declare const EstimateCostProvider: ({ children, locales, currency, numberLocales, }: EstimateCostProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=EstimateCostProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EstimateCostProvider.d.ts","sourceRoot":"","sources":["../../../src/components/EstimateCost/EstimateCostProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,mBAAmB,MAAM,cAAc,CAAA;AAQ9C,eAAO,MAAM,eAAe;;;CAAwC,CAAA;AAEpE,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,EAAE,SAAS,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,OAAO,mBAAmB,EAAE,MAAM,CAAC,CAAA;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,eAAe,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;IACzC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC,CAAA;AAED,eAAO,MAAM,oBAAoB,yHAsChC,CAAA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { __name } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import en_default from "./locales/en.js";
|
|
4
|
-
import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js";
|
|
5
|
-
import { createContext, useCallback, useContext, useMemo } from "react";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
|
|
8
|
-
//#region src/components/EstimateCost/EstimateCostProvider.tsx
|
|
9
|
-
const EstimateCostContext = createContext({
|
|
10
|
-
formatNumber: () => "",
|
|
11
|
-
locales: en_default
|
|
12
|
-
});
|
|
13
|
-
const useEstimateCost = () => useContext(EstimateCostContext);
|
|
14
|
-
const EstimateCostProvider = ({ children, locales, currency, numberLocales }) => {
|
|
15
|
-
const newLocales = useMemo(() => locales ? _objectSpread2(_objectSpread2({}, en_default), locales) : en_default, [locales]);
|
|
16
|
-
const formatNumber = useCallback((number, options) => {
|
|
17
|
-
return new Intl.NumberFormat(numberLocales, _objectSpread2({
|
|
18
|
-
currency,
|
|
19
|
-
style: "currency"
|
|
20
|
-
}, options)).format(number);
|
|
21
|
-
}, [currency, numberLocales]);
|
|
22
|
-
const value = useMemo(() => ({
|
|
23
|
-
formatNumber,
|
|
24
|
-
locales: newLocales
|
|
25
|
-
}), [formatNumber, newLocales]);
|
|
26
|
-
return /* @__PURE__ */ jsx(EstimateCostContext.Provider, {
|
|
27
|
-
value,
|
|
28
|
-
children
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { EstimateCostProvider, useEstimateCost };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { JSX, ReactNode } from 'react';
|
|
2
|
-
import type { Units } from './types';
|
|
3
|
-
type OverlayComponentProps = {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
disableOverlayLeft?: boolean;
|
|
6
|
-
disableOverlayRight?: boolean;
|
|
7
|
-
discount?: number;
|
|
8
|
-
inView?: boolean;
|
|
9
|
-
isBeta?: boolean;
|
|
10
|
-
unit: Units;
|
|
11
|
-
OverlayLeft?: (props: {
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
}) => JSX.Element;
|
|
15
|
-
OverlayRight?: (props: {
|
|
16
|
-
children?: ReactNode;
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
}) => JSX.Element;
|
|
19
|
-
totalPrice: {
|
|
20
|
-
maxOverlayHourly: number;
|
|
21
|
-
overlayHourly: number;
|
|
22
|
-
};
|
|
23
|
-
overlayMargin?: string;
|
|
24
|
-
};
|
|
25
|
-
export declare const OverlayComponent: ({ children, inView, discount, OverlayRight, disableOverlayRight, OverlayLeft, disableOverlayLeft, totalPrice, unit, isBeta, overlayMargin, }: OverlayComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
export {};
|
|
27
|
-
//# sourceMappingURL=OverlayComponent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayComponent.d.ts","sourceRoot":"","sources":["../../../src/components/EstimateCost/OverlayComponent.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAgB3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAOpC,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAA;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,KAAK,CAAA;IACX,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QACpB,QAAQ,EAAE,SAAS,CAAA;QACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;KACnB,KAAK,GAAG,CAAC,OAAO,CAAA;IACjB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE;QACrB,QAAQ,CAAC,EAAE,SAAS,CAAA;QACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;KACnB,KAAK,GAAG,CAAC,OAAO,CAAA;IACjB,UAAU,EAAE;QACV,gBAAgB,EAAE,MAAM,CAAA;QACxB,aAAa,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,gBAAgB,kNAwG5B,CAAA"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { __name } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import { estimateCostResourceName } from "./Components/components.css.js";
|
|
4
|
-
import { maximumFractionDigits, multiplier } from "./constants.js";
|
|
5
|
-
import { useEstimateCost } from "./EstimateCostProvider.js";
|
|
6
|
-
import { OverlayContextProvider } from "./OverlayContext.js";
|
|
7
|
-
import { estimateCostBadge, estimateCostList, estimateCostOverlayContainer, estimateCostOverlayRow, estimateCostSideItem, overlayMarginVar } from "./styles.css.js";
|
|
8
|
-
import { LineThrough } from "./Components/LineThrough.js";
|
|
9
|
-
import { Strong } from "./Components/Strong.js";
|
|
10
|
-
import { Badge, Stack } from "@ultraviolet/ui";
|
|
11
|
-
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
12
|
-
import { Children, cloneElement, isValidElement, useMemo } from "react";
|
|
13
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { CalculatorIcon } from "@ultraviolet/icons/CalculatorIcon";
|
|
15
|
-
|
|
16
|
-
//#region src/components/EstimateCost/OverlayComponent.tsx
|
|
17
|
-
const OverlayComponent = ({ children, inView = false, discount = 1, OverlayRight, disableOverlayRight = false, OverlayLeft, disableOverlayLeft = false, totalPrice, unit = "hours", isBeta = false, overlayMargin }) => {
|
|
18
|
-
const { locales, formatNumber } = useEstimateCost();
|
|
19
|
-
const value = useMemo(() => ({ isOverlay: true }), []);
|
|
20
|
-
const totalOverlayPrice = {
|
|
21
|
-
days: totalPrice.maxOverlayHourly * multiplier.days,
|
|
22
|
-
hours: totalPrice.maxOverlayHourly,
|
|
23
|
-
minutes: totalPrice.maxOverlayHourly * multiplier.minutes,
|
|
24
|
-
months: totalPrice.maxOverlayHourly * multiplier.months,
|
|
25
|
-
seconds: totalPrice.maxOverlayHourly * multiplier.seconds
|
|
26
|
-
}[unit];
|
|
27
|
-
const overlayPrice = {
|
|
28
|
-
days: totalPrice.overlayHourly * multiplier.days,
|
|
29
|
-
hours: totalPrice.overlayHourly,
|
|
30
|
-
minutes: totalPrice.overlayHourly * multiplier.minutes,
|
|
31
|
-
months: totalPrice.overlayHourly * multiplier.months,
|
|
32
|
-
seconds: totalPrice.overlayHourly * multiplier.seconds
|
|
33
|
-
}[unit];
|
|
34
|
-
return /* @__PURE__ */ jsx(OverlayContextProvider, {
|
|
35
|
-
value,
|
|
36
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
37
|
-
className: estimateCostOverlayContainer({ inView }),
|
|
38
|
-
"data-testid": "summary-overlay",
|
|
39
|
-
style: assignInlineVars({ [overlayMarginVar]: overlayMargin !== null && overlayMargin !== void 0 ? overlayMargin : "0" }),
|
|
40
|
-
children: /* @__PURE__ */ jsxs("ul", {
|
|
41
|
-
className: estimateCostList,
|
|
42
|
-
children: [
|
|
43
|
-
OverlayLeft ? /* @__PURE__ */ jsx("li", {
|
|
44
|
-
className: estimateCostSideItem,
|
|
45
|
-
children: /* @__PURE__ */ jsx(OverlayLeft, {
|
|
46
|
-
disabled: disableOverlayLeft,
|
|
47
|
-
children: locales["estimate.cost.submit.label"]
|
|
48
|
-
})
|
|
49
|
-
}) : null,
|
|
50
|
-
Children.map(children, (child, index) => isValidElement(child) ? cloneElement(child, {
|
|
51
|
-
isFirstElement: index === 0,
|
|
52
|
-
isLastElement: index === Children.count(children) - 1
|
|
53
|
-
}) : null),
|
|
54
|
-
/* @__PURE__ */ jsxs("li", {
|
|
55
|
-
className: estimateCostOverlayRow(),
|
|
56
|
-
children: [/* @__PURE__ */ jsxs(Stack, {
|
|
57
|
-
alignItems: "center",
|
|
58
|
-
direction: "row",
|
|
59
|
-
gap: 1,
|
|
60
|
-
children: [/* @__PURE__ */ jsx(CalculatorIcon, {
|
|
61
|
-
sentiment: "primary",
|
|
62
|
-
size: "medium"
|
|
63
|
-
}), locales["estimate.cost.label"]]
|
|
64
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
65
|
-
className: estimateCostResourceName(),
|
|
66
|
-
children: [/* @__PURE__ */ jsx(Strong, {
|
|
67
|
-
variant: "big",
|
|
68
|
-
children: /* @__PURE__ */ jsxs(LineThrough, {
|
|
69
|
-
isActive: isBeta && discount === 0,
|
|
70
|
-
children: [
|
|
71
|
-
formatNumber(overlayPrice, { maximumFractionDigits: maximumFractionDigits[unit] }),
|
|
72
|
-
totalOverlayPrice > 0 ? ` - ${formatNumber(totalOverlayPrice, { maximumFractionDigits: maximumFractionDigits[unit] })}` : null,
|
|
73
|
-
"/",
|
|
74
|
-
locales[`estimate.cost.units.${unit}.label`]
|
|
75
|
-
]
|
|
76
|
-
})
|
|
77
|
-
}), isBeta ? /* @__PURE__ */ jsxs(Badge, {
|
|
78
|
-
className: estimateCostBadge,
|
|
79
|
-
prominence: "strong",
|
|
80
|
-
sentiment: "warning",
|
|
81
|
-
children: [discount > 0 ? discount * 100 : "", locales[`estimate.cost.beta.${discount > 0 ? "discount" : "free"}`]]
|
|
82
|
-
}) : null]
|
|
83
|
-
})]
|
|
84
|
-
}),
|
|
85
|
-
OverlayRight ? /* @__PURE__ */ jsx("li", {
|
|
86
|
-
className: estimateCostSideItem,
|
|
87
|
-
children: /* @__PURE__ */ jsx(OverlayRight, {
|
|
88
|
-
disabled: disableOverlayRight,
|
|
89
|
-
children: locales["estimate.cost.submit.label"]
|
|
90
|
-
})
|
|
91
|
-
}) : null
|
|
92
|
-
]
|
|
93
|
-
})
|
|
94
|
-
})
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
//#endregion
|
|
99
|
-
export { OverlayComponent };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
export declare const useOverlay: () => {
|
|
3
|
-
isOverlay: boolean;
|
|
4
|
-
};
|
|
5
|
-
type OverlayContextProviderProps = {
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
value: {
|
|
8
|
-
isOverlay: boolean;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export declare const OverlayContextProvider: ({ children, value, }: OverlayContextProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=OverlayContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayContext.d.ts","sourceRoot":"","sources":["../../../src/components/EstimateCost/OverlayContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,eAAO,MAAM,UAAU;;CAAmC,CAAA;AAE1D,KAAK,2BAA2B,GAAG;IACjC,QAAQ,EAAE,SAAS,CAAA;IACnB,KAAK,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,sBAAsB,gGAKlC,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { __name } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import { createContext, useContext } from "react";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
6
|
-
//#region src/components/EstimateCost/OverlayContext.tsx
|
|
7
|
-
const OverlayContext = createContext({ isOverlay: false });
|
|
8
|
-
const useOverlay = () => useContext(OverlayContext);
|
|
9
|
-
const OverlayContextProvider = ({ children, value }) => /* @__PURE__ */ jsx(OverlayContext.Provider, {
|
|
10
|
-
value,
|
|
11
|
-
children
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
export { OverlayContextProvider, useOverlay };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Units } from './types';
|
|
2
|
-
export declare const APPROXIMATE_HOURS_IN_MONTH = 730;
|
|
3
|
-
export declare const multiplier: Record<Units, number>;
|
|
4
|
-
export declare const maximumFractionDigits: Record<Units, number>;
|
|
5
|
-
export declare const maximumFractionDigitsLong: Record<Units, number>;
|
|
6
|
-
export declare const MAX_CELL_WIDTH = "70%";
|
|
7
|
-
export declare const PRICE_MAX_CELL_WIDTH = "30%";
|
|
8
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/EstimateCost/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,eAAO,MAAM,0BAA0B,MAAM,CAAA;AAI7C,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAMnC,CAAA;AAIV,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAM9C,CAAA;AAEV,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAMlD,CAAA;AAEV,eAAO,MAAM,cAAc,QAAQ,CAAA;AACnC,eAAO,MAAM,oBAAoB,QAAQ,CAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
//#region src/components/EstimateCost/constants.ts
|
|
2
|
-
const APPROXIMATE_HOURS_IN_MONTH = 730;
|
|
3
|
-
const multiplier = {
|
|
4
|
-
days: 24,
|
|
5
|
-
hours: 1,
|
|
6
|
-
minutes: 1 / 60,
|
|
7
|
-
months: 730,
|
|
8
|
-
seconds: 1 / 60 / 60
|
|
9
|
-
};
|
|
10
|
-
const maximumFractionDigits = {
|
|
11
|
-
days: 3,
|
|
12
|
-
hours: 5,
|
|
13
|
-
minutes: 8,
|
|
14
|
-
months: 2,
|
|
15
|
-
seconds: 10
|
|
16
|
-
};
|
|
17
|
-
const maximumFractionDigitsLong = {
|
|
18
|
-
days: 4,
|
|
19
|
-
hours: 8,
|
|
20
|
-
minutes: 10,
|
|
21
|
-
months: 2,
|
|
22
|
-
seconds: 12
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
export { maximumFractionDigits, maximumFractionDigitsLong, multiplier };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Units } from './types';
|
|
2
|
-
export declare const calculatePrice: ({ price, amount, amountFree, timeUnit, timeAmount, discount, }: {
|
|
3
|
-
price: number;
|
|
4
|
-
amount: number;
|
|
5
|
-
amountFree?: number | undefined;
|
|
6
|
-
timeUnit: Units;
|
|
7
|
-
timeAmount: number;
|
|
8
|
-
discount?: number | undefined;
|
|
9
|
-
}) => number;
|
|
10
|
-
//# sourceMappingURL=helper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/components/EstimateCost/helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,eAAO,MAAM,cAAc;;;;;;;YAsB1B,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { __name } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { multiplier } from "./constants.js";
|
|
3
|
-
|
|
4
|
-
//#region src/components/EstimateCost/helper.ts
|
|
5
|
-
const calculatePrice = ({ price, amount, amountFree = 0, timeUnit, timeAmount, discount = 0 }) => {
|
|
6
|
-
const nonNanTimeAmount = Number.isNaN(timeAmount) ? 0 : timeAmount;
|
|
7
|
-
return (price - price * discount) * (nonNanTimeAmount * multiplier[timeUnit]) * Math.max(amount - amountFree, 0);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
export { calculatePrice };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
readonly 'estimate.cost.az.label': "Availability Zone";
|
|
3
|
-
readonly 'estimate.cost.beta.badge': "Beta Version";
|
|
4
|
-
readonly 'estimate.cost.beta.discount': "% off during Beta";
|
|
5
|
-
readonly 'estimate.cost.beta.free': "Free During Beta";
|
|
6
|
-
readonly 'estimate.cost.description': "This summary provides a cost estimation based on your configuration, the amount of time you expect to use the resource for, and the scale of your expected usage. For the purposes of this calculation, we consider that 1 month equals to 730 hours.";
|
|
7
|
-
readonly 'estimate.cost.fees.commitment': "Commitment Fees";
|
|
8
|
-
readonly 'estimate.cost.fees.monthly.title': "Each month";
|
|
9
|
-
readonly 'estimate.cost.fees.oneTime.title': "One time fees";
|
|
10
|
-
readonly 'estimate.cost.label': "Estimated cost";
|
|
11
|
-
readonly 'estimate.cost.notDefined': "Not defined";
|
|
12
|
-
readonly 'estimate.cost.region.label': "Region";
|
|
13
|
-
readonly 'estimate.cost.submit.label': "Create";
|
|
14
|
-
readonly 'estimate.cost.units.days.label': "Day(s)";
|
|
15
|
-
readonly 'estimate.cost.units.gb.label': "GB";
|
|
16
|
-
readonly 'estimate.cost.units.hours.label': "Hour(s)";
|
|
17
|
-
readonly 'estimate.cost.units.minutes.label': "Minute(s)";
|
|
18
|
-
readonly 'estimate.cost.units.months.label': "Month(s)";
|
|
19
|
-
readonly 'estimate.cost.units.seconds.label': "Second(s)";
|
|
20
|
-
readonly 'estimate.cost.units.years.label': "Year(s)";
|
|
21
|
-
};
|
|
22
|
-
export default _default;
|
|
23
|
-
//# sourceMappingURL=en.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/components/EstimateCost/locales/en.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,wBAqBU"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//#region src/components/EstimateCost/locales/en.ts
|
|
2
|
-
var en_default = {
|
|
3
|
-
"estimate.cost.az.label": "Availability Zone",
|
|
4
|
-
"estimate.cost.beta.badge": "Beta Version",
|
|
5
|
-
"estimate.cost.beta.discount": "% off during Beta",
|
|
6
|
-
"estimate.cost.beta.free": "Free During Beta",
|
|
7
|
-
"estimate.cost.description": "This summary provides a cost estimation based on your configuration, the amount of time you expect to use the resource for, and the scale of your expected usage. For the purposes of this calculation, we consider that 1 month equals to 730 hours.",
|
|
8
|
-
"estimate.cost.fees.commitment": "Commitment Fees",
|
|
9
|
-
"estimate.cost.fees.monthly.title": "Each month",
|
|
10
|
-
"estimate.cost.fees.oneTime.title": "One time fees",
|
|
11
|
-
"estimate.cost.label": "Estimated cost",
|
|
12
|
-
"estimate.cost.notDefined": "Not defined",
|
|
13
|
-
"estimate.cost.region.label": "Region",
|
|
14
|
-
"estimate.cost.submit.label": "Create",
|
|
15
|
-
"estimate.cost.units.days.label": "Day(s)",
|
|
16
|
-
"estimate.cost.units.gb.label": "GB",
|
|
17
|
-
"estimate.cost.units.hours.label": "Hour(s)",
|
|
18
|
-
"estimate.cost.units.minutes.label": "Minute(s)",
|
|
19
|
-
"estimate.cost.units.months.label": "Month(s)",
|
|
20
|
-
"estimate.cost.units.seconds.label": "Second(s)",
|
|
21
|
-
"estimate.cost.units.years.label": "Year(s)"
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
export { en_default as default };
|